Medical Imaging Interaction Toolkit  2024.12.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 
108  void SetMinSpacing(double minSpacing);
109 
115  void SetMaxSpacing(double maxSpacing);
116 
121  void SetDistanceImageVolume(unsigned int distImageVolume);
122 
127  mitk::LabelSetImage* GetCurrentSegmentation();
128 
129  void SetDataStorage(DataStorage::Pointer ds);
130 
135  void SetCurrentInterpolationSession(LabelSetImage* currentSegmentationImage);
136 
141  void RemoveInterpolationSession(const LabelSetImage* segmentationImage);
142 
146  void RemoveAllInterpolationSessions();
147 
155  CPIVector* GetContours(LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
156 
157  std::vector<LabelSetImage::LabelValueType> GetAffectedLabels(const LabelSetImage* seg, TimeStepType timeStep, const PlaneGeometry* plane) const;
158 
164  void CompleteReinitialization(const std::vector<ContourPositionInformation>& newCPIs);
165 
174  void RemoveContours(const LabelSetImage* segmentationImage, mitk::Label::PixelType label, TimeStepType timeStep);
175 
183  void RemoveContours(const LabelSetImage* segmentationImage, mitk::Label::PixelType label);
184 
185  unsigned int GetNumberOfInterpolationSessions();
186 
192  mitk::DataNode* GetSegmentationImageNode() const;
193 
194  protected:
196 
197  ~SurfaceInterpolationController() override;
198 
199  template <typename TPixel, unsigned int VImageDimension>
200  void GetImageBase(itk::Image<TPixel, VImageDimension> *input, itk::ImageBase<3>::Pointer &result);
201 
202  private:
203 
210  void OnSegmentationDeleted(const itk::Object *caller, const itk::EventObject &event);
211 
217  void OnRemoveLabel(const itk::Object* caller, const itk::EventObject& event);
218 
227  void AddPlaneGeometryNodeToDataStorage(const ContourPositionInformation& contourInfo) const;
228 
229  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode) const;
230  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode, LabelSetImage::LabelValueType labelValue) const;
231  DataStorage::SetOfObjects::ConstPointer GetPlaneGeometryNodeFromDataStorage(const DataNode* segNode, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep) const;
232 
236  void AddActiveLabelContoursForInterpolation(ReduceContourSetFilter* reduceFilter, const LabelSetImage* segmentationImage, LabelSetImage::LabelValueType labelValue, TimeStepType timeStep);
237 
242  void ClearInterpolationSession();
243 
244  void RemoveObserversInternal(const mitk::LabelSetImage* segmentationImage);
245 
252  void AddToCPIMap(ContourPositionInformation& contourInfo, bool reinitializationAction = false);
253 
254  unsigned int m_DistanceImageVolume;
255  mitk::DataStorage::Pointer m_DataStorage;
256 
257  WeakPointer<LabelSetImage> m_SelectedSegmentation;
258  };
259 }
260 
261 #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