Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
mitkAutoSegmentationWithPreviewTool.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkAutoSegmentationWithPreviewTool_h_Included
14 #define mitkAutoSegmentationWithPreviewTool_h_Included
15 
17 #include "mitkCommon.h"
18 #include "mitkDataNode.h"
19 #include "mitkToolCommand.h"
21 
22 namespace mitk
23 {
39  {
40  public:
41 
43 
44  void Activated() override;
45  void Deactivated() override;
46 
47  void ConfirmSegmentation();
48 
49  itkSetMacro(CreateAllTimeSteps, bool);
50  itkGetMacro(CreateAllTimeSteps, bool);
51  itkBooleanMacro(CreateAllTimeSteps);
52 
53  itkSetMacro(KeepActiveAfterAccept, bool);
54  itkGetMacro(KeepActiveAfterAccept, bool);
55  itkBooleanMacro(KeepActiveAfterAccept);
56 
57  itkSetMacro(IsTimePointChangeAware, bool);
58  itkGetMacro(IsTimePointChangeAware, bool);
59  itkBooleanMacro(IsTimePointChangeAware);
60 
61  itkSetMacro(ResetsToEmptyPreview, bool);
62  itkGetMacro(ResetsToEmptyPreview, bool);
63  itkBooleanMacro(ResetsToEmptyPreview);
64 
65  bool CanHandle(const BaseData* referenceData, const BaseData* workingData) const override;
66 
74  void UpdatePreview(bool ignoreLazyPreviewSetting = false);
75 
77  bool IsUpdating() const;
78 
79  protected:
81 
87  virtual void InitiateToolByInput();
88 
92  virtual void UpdatePrepare();
93 
97  virtual void UpdateCleanUp();
98 
105  virtual void DoUpdatePreview(const Image* inputAtTimeStep, const Image* oldSegAtTimeStep, Image* previewImage, TimeStepType timeStep) = 0;
106 
107  AutoSegmentationWithPreviewTool(bool lazyDynamicPreviews = false); // purposely hidden
108  AutoSegmentationWithPreviewTool(bool lazyDynamicPreviews, const char* interactorType, const us::Module* interactorModule = nullptr); // purposely hidden
109 
111 
114  Image* GetPreviewSegmentation();
115  DataNode* GetPreviewSegmentationNode();
116 
122  const Image* GetSegmentationInput() const;
123 
126  const Image* GetReferenceData() const;
127 
129  void ResetPreviewNode();
130 
131  TimePointType GetLastTimePointOfUpdate() const;
132 
133  itkSetObjectMacro(WorkingPlaneGeometry, PlaneGeometry);
134  itkGetConstObjectMacro(WorkingPlaneGeometry, PlaneGeometry);
135 
136  private:
137  void TransferImageAtTimeStep(const Image* sourceImage, Image* destinationImage, const TimeStepType timeStep);
138 
139  void CreateResultSegmentationFromPreview();
140 
141  void OnRoiDataChanged();
142  void OnTimePointChanged();
143 
145  DataNode::Pointer m_PreviewSegmentationNode;
147  DataNode::Pointer m_ReferenceDataNode;
150  DataNode::Pointer m_SegmentationInputNode;
151 
154  bool m_CreateAllTimeSteps = false;
155 
157  bool m_KeepActiveAfterAccept = false;
158 
164  bool m_LazyDynamicPreviews = false;
165 
166  bool m_IsTimePointChangeAware = true;
167 
170  bool m_ResetsToEmptyPreview = false;
171 
172  TimePointType m_LastTimePointOfUpdate = 0.;
173 
174  bool m_IsUpdating = false;
175 
181  PlaneGeometry::Pointer m_WorkingPlaneGeometry;
182  };
183 
184 } // namespace
185 
186 #endif
Base of all data objects.
Definition: mitkBaseData.h:42
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
Image class for storing images.
Definition: mitkImage.h:69
Superclass for tool that create a new segmentation without user interaction in render windows...
mitk::ScalarType TimePointType
std::vcl_size_t TimeStepType
Describes a two-dimensional, rectangular plane.
Base class for any auto segmentation tool that provides a preview of the new segmentation.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57