Medical Imaging Interaction Toolkit  2018.4.99-fa2b431b
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  bool CanHandle(const BaseData* referenceData, const BaseData* workingData) const override;
62 
70  void UpdatePreview(bool ignoreLazyPreviewSetting = false);
71 
72  protected:
74 
80  virtual void InitiateToolByInput();
81 
82  virtual void UpdatePrepare();
83  virtual void UpdateCleanUp();
84 
89  virtual void DoUpdatePreview(const Image* inputAtTimeStep, Image* previewImage, TimeStepType timeStep) = 0;
90 
91  AutoSegmentationWithPreviewTool(bool lazyDynamicPreviews = false);
93 
96  Image* GetPreviewSegmentation();
97  DataNode* GetPreviewSegmentationNode();
98 
104  const Image* GetSegmentationInput() const;
105 
108  const Image* GetReferenceData() const;
109 
111  void ResetPreviewNode();
112 
113  TimePointType GetLastTimePointOfUpdate() const;
114 
115  private:
116  void TransferImageAtTimeStep(const Image* sourceImage, Image* destinationImage, const TimeStepType timeStep);
117 
118  void CreateResultSegmentationFromPreview();
119 
120  void OnRoiDataChanged();
121  void OnTimePointChanged();
122 
124  DataNode::Pointer m_PreviewSegmentationNode;
126  DataNode::Pointer m_ReferenceDataNode;
129  DataNode::Pointer m_SegmentationInputNode;
130 
133  bool m_CreateAllTimeSteps = false;
134 
136  bool m_KeepActiveAfterAccept = false;
137 
143  bool m_LazyDynamicPreviews = false;
144 
145  bool m_IsTimePointChangeAware = true;
146 
147  TimePointType m_LastTimePointOfUpdate = 0.;
148  };
149 
150 } // namespace
151 
152 #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:40
Image class for storing images.
Definition: mitkImage.h:73
Superclass for tool that create a new segmentation without user interaction in render windows...
mitk::ScalarType TimePointType
std::vcl_size_t TimeStepType
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