Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkSurfaceInterpolationController.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 mitkSurfaceInterpolationController_h
14 #define mitkSurfaceInterpolationController_h
15 
16 #include <mitkDataStorage.h>
17 #include <mitkLabelSetImage.h>
18 #include <mitkLabel.h>
19 #include <mitkSurface.h>
20 
22 
23 namespace mitk
24 {
25  class ComputeContourSetNormalsFilter;
26  class CreateDistanceImageFromSurfaceFilter;
27  class LabelSetImage;
28  class ReduceContourSetFilter;
29 
31  {
32  public:
34  itkFactorylessNewMacro(Self);
35  itkCloneMacro(Self);
36 
38  {
43 
45  : Plane(nullptr),
46  LabelValue(std::numeric_limits<Label::PixelType>::max()),
47  TimeStep(std::numeric_limits<TimeStepType>::max())
48  {
49  }
50 
53  Label::PixelType labelValue,
54  TimeStepType timeStep)
55  :
56  Contour(contour),
57  Plane(plane),
58  LabelValue(labelValue),
59  TimeStep(timeStep)
60  {
61  }
62 
63  bool IsPlaceHolder() const
64  {
65  return Contour.IsNull();
66  }
67  };
68 
69  typedef std::vector<ContourPositionInformation> CPIVector;
70 
71  static SurfaceInterpolationController *GetInstance();
72 
77  void AddNewContours(const std::vector<ContourPositionInformation>& newCPIs, bool reinitializeAction = false, bool silent = false);
78 
85  bool RemoveContour(ContourPositionInformation contourInfo, bool keepPlaceholderForUndo = false);
86 
87  void RemoveObservers();
88 
93  void Interpolate(const LabelSetImage* segmentationImage, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
94 
100  mitk::Surface::Pointer GetInterpolationResult(const LabelSetImage* segmentationImage, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
101 
109  void SetMinSpacing(double minSpacing);
110 
116  void SetMaxSpacing(double maxSpacing);
117 
122  void SetDistanceImageVolume(unsigned int distImageVolume);
123 
128  mitk::LabelSetImage* GetCurrentSegmentation();
129 
130  void SetDataStorage(DataStorage::Pointer ds);
131 
136  void SetCurrentInterpolationSession(LabelSetImage* currentSegmentationImage);
137 
142  void RemoveInterpolationSession(const LabelSetImage* segmentationImage);
143 
147  void RemoveAllInterpolationSessions();
148 
156  CPIVector* GetContours(LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
157 
158  std::vector<LabelSetImage::LabelValueType> GetAffectedLabels(const LabelSetImage* seg, TimeStepType timeStep, const PlaneGeometry* plane) const;
159 
165  void CompleteReinitialization(const std::vector<ContourPositionInformation>& newCPIs);
166 
175  void RemoveContours(const LabelSetImage* segmentationImage, mitk::Label::PixelType label, TimeStepType timeStep);
176 
184  void RemoveContours(const LabelSetImage* segmentationImage, mitk::Label::PixelType label);
185 
186  unsigned int GetNumberOfInterpolationSessions();
187 
193  mitk::DataNode* GetSegmentationImageNode() const;
194 
195  protected:
197 
198  ~SurfaceInterpolationController() override;
199 
200  template <typename TPixel, unsigned int VImageDimension>
201  void GetImageBase(itk::Image<TPixel, VImageDimension> *input, itk::ImageBase<3>::Pointer &result);
202 
203  private:
204 
211  void OnSegmentationDeleted(const itk::Object *caller, const itk::EventObject &event);
212 
218  void OnRemoveLabel(const itk::Object* caller, const itk::EventObject& event);
219 
228  void AddPlaneGeometryNodeToDataStorage(const ContourPositionInformation& contourInfo) const;
229 
230  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode) const;
231  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode, LabelSetImage::LabelValueType labelValue) const;
232  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep) const;
233 
237  void AddActiveLabelContoursForInterpolation(ReduceContourSetFilter* reduceFilter, const LabelSetImage* segmentationImage, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
238 
243  void ClearInterpolationSession();
244 
245  void RemoveObserversInternal(const mitk::LabelSetImage* segmentationImage);
246 
253  void AddToCPIMap(ContourPositionInformation& contourInfo, bool reinitializationAction = false);
254 
255  unsigned int m_DistanceImageVolume;
256  mitk::DataStorage::Pointer m_DataStorage;
257 
258  WeakPointer<LabelSetImage> m_SelectedSegmentation;
259  };
260 }
261 
262 #endif
mitk::SurfaceInterpolationController::ContourPositionInformation::ContourPositionInformation
ContourPositionInformation()
Definition: mitkSurfaceInterpolationController.h:44
mitkLabel.h
mitk::SurfaceInterpolationController::ContourPositionInformation
Definition: mitkSurfaceInterpolationController.h:37
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::SurfaceInterpolationController::ContourPositionInformation::LabelValue
Label::PixelType LabelValue
Definition: mitkSurfaceInterpolationController.h:41
mitkDataStorage.h
MITKSURFACEINTERPOLATION_EXPORT
#define MITKSURFACEINTERPOLATION_EXPORT
Definition: MitkSurfaceInterpolationExports.h:15
mitk::Plane
Plane surface representation.
Definition: mitkPlane.h:31
itk::SmartPointer< const Self >
mitk::SurfaceInterpolationController::ContourPositionInformation::ContourPositionInformation
ContourPositionInformation(Surface::ConstPointer contour, PlaneGeometry::ConstPointer plane, Label::PixelType labelValue, TimeStepType timeStep)
Definition: mitkSurfaceInterpolationController.h:51
mitk::Label::PixelType
unsigned short PixelType
Definition: mitkLabel.h:34
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::SurfaceInterpolationController::ContourPositionInformation::TimeStep
TimeStepType TimeStep
Definition: mitkSurfaceInterpolationController.h:42
mitk::SurfaceInterpolationController::ContourPositionInformation::Plane
PlaneGeometry::ConstPointer Plane
Definition: mitkSurfaceInterpolationController.h:40
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:29
mitk::SurfaceInterpolationController
Definition: mitkSurfaceInterpolationController.h:30
mitk::PixelType
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
mitk::SurfaceInterpolationController::CPIVector
std::vector< ContourPositionInformation > CPIVector
Definition: mitkSurfaceInterpolationController.h:69
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
MitkSurfaceInterpolationExports.h
mitk::SurfaceInterpolationController::ContourPositionInformation::IsPlaceHolder
bool IsPlaceHolder() const
Definition: mitkSurfaceInterpolationController.h:63
mitk::Contour
Stores vertices for drawing a contour.
Definition: mitkContour.h:31
mitk::WeakPointer
Definition: mitkWeakPointer.h:22
mitk::ReduceContourSetFilter
A filter that reduces the number of points of contours represented by a mitk::Surface.
Definition: mitkReduceContourSetFilter.h:52
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::SurfaceInterpolationController::ContourPositionInformation::Contour
Surface::ConstPointer Contour
Definition: mitkSurfaceInterpolationController.h:39
mitk::LabelSetImage
LabelSetImage class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:43
mitk::LabelSetImage::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:75
mitkLabelSetImage.h