NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkMorphologicalSegmentorPipelineManager.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkMorphologicalSegmentorPipelineManager_h
16 #define niftkMorphologicalSegmentorPipelineManager_h
17 
18 #include "niftkMIDASExports.h"
19 
20 #include <itkLightObject.h>
21 
22 #include <mitkDataStorage.h>
23 #include <mitkImage.h>
24 #include <mitkToolManager.h>
25 
29 
30 namespace niftk
31 {
32 
49 class NIFTKMIDAS_EXPORT MorphologicalSegmentorPipelineManager : public itk::LightObject
50 {
51 
52 public:
53 
56 
59 
60 
61  mitkClassMacroItkParent(MorphologicalSegmentorPipelineManager, itk::Object)
63 
65  void SetDataStorage(mitk::DataStorage::Pointer dataStorage);
66 
68  mitk::DataStorage::Pointer GetDataStorage() const;
69 
71  void SetToolManager(mitk::ToolManager::Pointer toolManager);
72 
74  mitk::ToolManager::Pointer GetToolManager() const;
75 
76 // void SetErosionSubtractionsInput(mitk::Image::ConstPointer erosionSubtractions, mitk::Image::Pointer segmentation);
77 // void SetDilationSubtractionsInput(mitk::Image::ConstPointer dilationSubtractions, mitk::Image::Pointer segmentation);
78 
84  void OnThresholdingValuesChanged(double lowerThreshold, double upperThreshold, int axialSliceNumber);
85 
90  void OnErosionsValuesChanged(double upperThreshold, int numberOfErosions);
91 
97  void OnDilationsValuesChanged(double lowerPercentage, double upperPercentage, int numberOfDilations);
98 
102  void OnRethresholdingValuesChanged(int boxSize);
103 
107  void OnTabChanged(int tabIndex);
108 
110  bool HasSegmentationNode() const;
111 
113  mitk::Image::ConstPointer GetReferenceImage() const;
114 
116  mitk::Image::Pointer GetWorkingImage(unsigned int dataIndex) const;
117 
119  mitk::DataNode::Pointer GetSegmentationNode() const;
120 
122  mitk::Image::Pointer GetSegmentationImage() const;
123 
125  void GetPipelineParamsFromSegmentationNode(MorphologicalSegmentorPipelineParams& params) const;
126 
128  virtual bool IsNodeASegmentationImage(const mitk::DataNode::Pointer node) const;
129 
131  virtual bool IsNodeAWorkingImage(const mitk::DataNode::Pointer node) const;
132 
134  virtual bool CanStartSegmentationForBinaryNode(const mitk::DataNode::Pointer node) const;
135 
137  virtual std::vector<mitk::DataNode*> GetWorkingDataFromSegmentationNode(const mitk::DataNode::Pointer node) const;
138 
140  virtual mitk::DataNode* GetSegmentationNodeFromWorkingData(const mitk::DataNode::Pointer node) const;
141 
143  void SetSegmentationNodePropsFromReferenceImage();
144 
146  void UpdateSegmentation();
147 
149  void FinalizeSegmentation();
150 
152  void ClearWorkingData();
153 
155  void RemoveWorkingData();
156 
158  void DestroyPipeline(mitk::Image::Pointer segmentation);
159 
160 protected:
161 
163  virtual ~MorphologicalSegmentorPipelineManager();
164 
165  MorphologicalSegmentorPipelineManager(const MorphologicalSegmentorPipelineManager&); // Purposefully not implemented.
166  MorphologicalSegmentorPipelineManager& operator=(const MorphologicalSegmentorPipelineManager&); // Purposefully not implemented.
167 
168 private:
169 
171  template<typename TPixel, unsigned int VImageDimension>
172  void InvokeITKPipeline(
173  const itk::Image<TPixel, VImageDimension>* referenceImage,
174  const std::vector<typename itk::Image<unsigned char, VImageDimension>::ConstPointer>& workingImages,
176  const std::vector<int>& editingRegion,
177  const std::vector<bool>& editingFlags,
178  bool isRestarting,
179  mitk::Image::Pointer outputImage
180  );
181 
183  template<typename TPixel, unsigned int VImageDimension>
184  void FinalizeITKPipeline(
185  const itk::Image<TPixel, VImageDimension>* referenceImage,
186  mitk::Image::Pointer segmentation
187  );
188 
190  template<typename TPixel, unsigned int VImageDimension>
191  void ClearITKImage(
192  itk::Image<TPixel, VImageDimension>* itkImage
193  );
194 
196  std::map<mitk::Image::Pointer, MorphologicalSegmentorPipelineInterface*> m_Pipelines;
197 
199  mitk::DataStorage::Pointer m_DataStorage;
200 
202  mitk::ToolManager::Pointer m_ToolManager;
203 
204 };
205 
206 }
207 
208 #endif
Definition: niftkMeshSmoother.cxx:19
const GLfloat * params
Definition: glew.h:1515
Definition: ReceptorMemberCommandTest.cxx:25
Abstract interface to plug ITK pipeline into MITK framework to represent the MIDAS Morphological Segm...
Definition: MorphologicalSegmentorPipelineInterface.h:26
Definition: niftkITKAffineResampleImage.cxx:74
static const std::string SEGMENTATION_OF_LAST_STAGE_NAME
The output of the previous stage of the segmentation pipeline.
Definition: niftkMorphologicalSegmentorPipelineManager.h:58
Class to contain all the ITK/MITK logic for the MIDAS Morphological Segmentor pipeline, to separate from MorphologicalSegmentationView to make unit testing easier.
Definition: niftkMorphologicalSegmentorPipelineManager.h:49
The parameters for the MorphologicalSegmentorPipeline, which closely resemble the GUI controls...
Definition: MorphologicalSegmentorPipelineParams.h:25
static const std::string PROPERTY_MIDAS_MORPH_SEGMENTATION_FINISHED
A static string, (to avoid code duplication), to hold the name of the property that determines if a m...
Definition: niftkMorphologicalSegmentorPipelineManager.h:55
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194