Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkFastMarchingTool_h_Included
18 #define mitkFastMarchingTool_h_Included
19 
20 #include "mitkDataNode.h"
22 #include "mitkLegacyAdaptors.h"
23 #include "mitkPointSet.h"
24 #include "mitkToolCommand.h"
26 
27 #include "mitkMessage.h"
28 
29 #include "itkImage.h"
30 
31 // itk filter
32 #include "itkBinaryThresholdImageFilter.h"
33 #include "itkCurvatureAnisotropicDiffusionImageFilter.h"
34 #include "itkFastMarchingImageFilter.h"
35 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
36 #include "itkSigmoidImageFilter.h"
37 
38 namespace us
39 {
40  class ModuleResource;
41 }
42 
43 namespace mitk
44 {
45  class StateMachineAction;
46  class InteractionEvent;
47 
59  {
60  mitkNewMessageMacro(Ready);
61 
62  public:
64  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
65 
66  /* typedefs for itk pipeline */
67  typedef float InternalPixelType;
68  typedef itk::Image<InternalPixelType, 2> InternalImageType;
70  typedef itk::Image<OutputPixelType, 2> OutputImageType;
71 
72  typedef itk::BinaryThresholdImageFilter<InternalImageType, OutputImageType> ThresholdingFilterType;
73  typedef itk::CurvatureAnisotropicDiffusionImageFilter<InternalImageType, InternalImageType> SmoothingFilterType;
74  typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<InternalImageType, InternalImageType> GradientFilterType;
75  typedef itk::SigmoidImageFilter<InternalImageType, InternalImageType> SigmoidFilterType;
76  typedef itk::FastMarchingImageFilter<InternalImageType, InternalImageType> FastMarchingFilterType;
77  typedef FastMarchingFilterType::NodeContainer NodeContainer;
78  typedef FastMarchingFilterType::NodeType NodeType;
79 
80  /* icon stuff */
81  virtual const char **GetXPM() const override;
82  virtual const char *GetName() const override;
83 
84  virtual us::ModuleResource GetCursorIconResource() const override;
85  us::ModuleResource GetIconResource() const override;
86 
88  void SetUpperThreshold(double);
89 
91  void SetLowerThreshold(double);
92 
94  void SetStoppingValue(double);
95 
97  void SetSigma(double);
98 
100  void SetAlpha(double);
101 
103  void SetBeta(double);
104 
106  virtual void ConfirmSegmentation();
107 
109  virtual void SetCurrentTimeStep(int t);
110 
112  void ClearSeeds();
113 
115  void Update();
116 
117  protected:
119  virtual ~FastMarchingTool();
120 
121  void ConnectActionsAndFunctions() override;
122 
123  // virtual float CanHandleEvent( StateEvent const *stateEvent) const;
124 
125  virtual void Activated() override;
126  virtual void Deactivated() override;
127  virtual void Initialize();
128 
129  virtual void BuildITKPipeline();
130 
132  virtual void OnAddPoint(StateMachineAction *, InteractionEvent *interactionEvent);
133 
135  virtual void OnDelete(StateMachineAction *, InteractionEvent *interactionEvent);
136 
138  void Reset();
139 
140  mitk::ToolCommand::Pointer m_ProgressCommand;
141 
142  Image::Pointer m_ReferenceImage;
143  Image::Pointer m_ReferenceImageSlice;
144 
145  bool m_NeedUpdate;
146 
147  int m_CurrentTimeStep;
148 
150 
151  float m_LowerThreshold; // used in Threshold filter
152  float m_UpperThreshold; // used in Threshold filter
153  float m_StoppingValue; // used in Fast Marching filter
154  float m_Sigma; // used in GradientMagnitude filter
155  float m_Alpha; // used in Sigmoid filter
156  float m_Beta; // used in Sigmoid filter
157 
158  NodeContainer::Pointer m_SeedContainer; // seed points for FastMarching
159 
160  InternalImageType::Pointer m_ReferenceImageSliceAsITK; // the reference image as itk::Image
161 
162  mitk::DataNode::Pointer m_ResultImageNode; // holds the result as a preview image
163 
164  mitk::DataNode::Pointer m_SeedsAsPointSetNode; // used to visualize the seed points
165  mitk::PointSet::Pointer m_SeedsAsPointSet;
166 
167  ThresholdingFilterType::Pointer m_ThresholdFilter;
168  SmoothingFilterType::Pointer m_SmoothFilter;
169  GradientFilterType::Pointer m_GradientMagnitudeFilter;
170  SigmoidFilterType::Pointer m_SigmoidFilter;
171  FastMarchingFilterType::Pointer m_FastMarchingFilter;
172 
173  private:
174  PlaneGeometry::Pointer m_WorkingPlane;
175  };
176 
177 } // namespace
178 
179 #endif
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:92
Super class for all position events.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
itk::SigmoidImageFilter< InternalImageType, InternalImageType > SigmoidFilterType
#define mitkNewMessageMacro(msgHandleObject)
Definition: mitkMessage.h:28
itk::Image< InternalPixelType, 2 > InternalImageType
A command to get tool process feedback.
mitk::Tool::DefaultSegmentationDataType OutputPixelType
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual void ConnectActionsAndFunctions() override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Image class for storing images.
Definition: mitkImage.h:76
itk::CurvatureAnisotropicDiffusionImageFilter< InternalImageType, InternalImageType > SmoothingFilterType
itk::FastMarchingImageFilter< InternalImageType, InternalImageType > FastMarchingFilterType
itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType
Base class for tools that use a contour for feedback.
FastMarchingFilterType::NodeType NodeType
mitk::Label::PixelType DefaultSegmentationDataType
Definition: mitkTool.h:95
itk::Image< OutputPixelType, 2 > OutputImageType
itk::GradientMagnitudeRecursiveGaussianImageFilter< InternalImageType, InternalImageType > GradientFilterType
static std::string GetName(std::string fileName, std::string suffix)
Describes a two-dimensional, rectangular plane.
FastMarching semgentation tool.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
FastMarchingFilterType::NodeContainer NodeContainer
Super-class that provides the functionality of a StateMachine to DataInteractors. ...