Medical Imaging Interaction Toolkit  2018.4.99-c670e289
Medical Imaging Interaction Toolkit
mitkFastMarchingTool.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 mitkFastMarchingTool_h_Included
14 #define mitkFastMarchingTool_h_Included
15 
16 #include "mitkDataNode.h"
18 #include "mitkPointSet.h"
19 #include "mitkToolCommand.h"
21 
22 #include "mitkMessage.h"
23 
24 #include "itkImage.h"
25 
26 // itk filter
27 #include "itkBinaryThresholdImageFilter.h"
28 #include "itkCurvatureAnisotropicDiffusionImageFilter.h"
29 #include "itkFastMarchingImageFilter.h"
30 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
31 #include "itkSigmoidImageFilter.h"
32 
33 namespace us
34 {
35  class ModuleResource;
36 }
37 
38 namespace mitk
39 {
40  class StateMachineAction;
41  class InteractionEvent;
42 
54  {
55  mitkNewMessageMacro(Ready);
56 
57  public:
59  itkFactorylessNewMacro(Self);
60  itkCloneMacro(Self);
61 
62  /* typedefs for itk pipeline */
63  typedef float InternalPixelType;
64  typedef itk::Image<InternalPixelType, 2> InternalImageType;
66  typedef itk::Image<OutputPixelType, 2> OutputImageType;
67 
68  typedef itk::BinaryThresholdImageFilter<InternalImageType, OutputImageType> ThresholdingFilterType;
69  typedef itk::CurvatureAnisotropicDiffusionImageFilter<InternalImageType, InternalImageType> SmoothingFilterType;
70  typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<InternalImageType, InternalImageType> GradientFilterType;
71  typedef itk::SigmoidImageFilter<InternalImageType, InternalImageType> SigmoidFilterType;
72  typedef itk::FastMarchingImageFilter<InternalImageType, InternalImageType> FastMarchingFilterType;
73  typedef FastMarchingFilterType::NodeContainer NodeContainer;
74  typedef FastMarchingFilterType::NodeType NodeType;
75 
76  /* icon stuff */
77  const char **GetXPM() const override;
78  const char *GetName() const override;
79 
80  us::ModuleResource GetCursorIconResource() const override;
81  us::ModuleResource GetIconResource() const override;
82 
84  void SetUpperThreshold(double);
85 
87  void SetLowerThreshold(double);
88 
90  void SetStoppingValue(double);
91 
93  void SetSigma(double);
94 
96  void SetAlpha(double);
97 
99  void SetBeta(double);
100 
102  virtual void ConfirmSegmentation();
103 
105  virtual void SetCurrentTimeStep(int t);
106 
108  void ClearSeeds();
109 
111  void Update();
112 
113  protected:
115  ~FastMarchingTool() override;
116 
117  void ConnectActionsAndFunctions() override;
118 
119  // virtual float CanHandleEvent( StateEvent const *stateEvent) const;
120 
121  void Activated() override;
122  void Deactivated() override;
123  virtual void Initialize();
124 
125  virtual void BuildITKPipeline();
126 
128  virtual void OnAddPoint(StateMachineAction *, InteractionEvent *interactionEvent);
129 
131  virtual void OnDelete(StateMachineAction *, InteractionEvent *interactionEvent);
132 
134  void Reset();
135 
137 
140 
142 
144 
146 
147  float m_LowerThreshold; // used in Threshold filter
148  float m_UpperThreshold; // used in Threshold filter
149  float m_StoppingValue; // used in Fast Marching filter
150  float m_Sigma; // used in GradientMagnitude filter
151  float m_Alpha; // used in Sigmoid filter
152  float m_Beta; // used in Sigmoid filter
153 
154  NodeContainer::Pointer m_SeedContainer; // seed points for FastMarching
155 
156  InternalImageType::Pointer m_ReferenceImageSliceAsITK; // the reference image as itk::Image
157 
158  mitk::DataNode::Pointer m_ResultImageNode; // holds the result as a preview image
159 
160  mitk::DataNode::Pointer m_SeedsAsPointSetNode; // used to visualize the seed points
162 
163  ThresholdingFilterType::Pointer m_ThresholdFilter;
164  SmoothingFilterType::Pointer m_SmoothFilter;
165  GradientFilterType::Pointer m_GradientMagnitudeFilter;
166  SigmoidFilterType::Pointer m_SigmoidFilter;
167  FastMarchingFilterType::Pointer m_FastMarchingFilter;
168 
169  private:
170  PlaneGeometry::Pointer m_WorkingPlane;
171  };
172 
173 } // namespace
174 
175 #endif
mitk::InteractionPositionEvent::Pointer m_PositionEvent
SigmoidFilterType::Pointer m_SigmoidFilter
mitk::ToolCommand::Pointer m_ProgressCommand
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
ThresholdingFilterType::Pointer m_ThresholdFilter
itk::SigmoidImageFilter< InternalImageType, InternalImageType > SigmoidFilterType
#define mitkNewMessageMacro(msgHandleObject)
Definition: mitkMessage.h:24
itk::Image< InternalPixelType, 2 > InternalImageType
mitk::PointSet::Pointer m_SeedsAsPointSet
mitk::Tool::DefaultSegmentationDataType OutputPixelType
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
itk::CurvatureAnisotropicDiffusionImageFilter< InternalImageType, InternalImageType > SmoothingFilterType
itk::FastMarchingImageFilter< InternalImageType, InternalImageType > FastMarchingFilterType
InternalImageType::Pointer m_ReferenceImageSliceAsITK
SmoothingFilterType::Pointer m_SmoothFilter
Image::Pointer m_ReferenceImageSlice
itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType
Base class for tools that use a contour for feedback.
mitk::DataNode::Pointer m_ResultImageNode
FastMarchingFilterType::NodeType NodeType
GradientFilterType::Pointer m_GradientMagnitudeFilter
mitk::DataNode::Pointer m_SeedsAsPointSetNode
mitk::Label::PixelType DefaultSegmentationDataType
Definition: mitkTool.h:89
itk::Image< OutputPixelType, 2 > OutputImageType
itk::GradientMagnitudeRecursiveGaussianImageFilter< InternalImageType, InternalImageType > GradientFilterType
FastMarchingFilterType::Pointer m_FastMarchingFilter
NodeContainer::Pointer m_SeedContainer
FastMarching semgentation tool.
FastMarchingFilterType::NodeContainer NodeContainer
Super-class that provides the functionality of a StateMachine to DataInteractors. ...