Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPlanarFigureMaskGenerator.h
Go to the documentation of this file.
1 #ifndef MITKPLANARFIGUREMASKGENERATOR
2 #define MITKPLANARFIGUREMASKGENERATOR
3 
5 #include <mitkImage.h>
6 #include <mitkPlanarFigure.h>
7 #include <itkImage.h>
8 #include <mitkMaskGenerator.h>
9 #include <vtkSmartPointer.h>
10 #include <itkVTKImageExport.h>
11 #include <itkVTKImageImport.h>
12 #include <vtkImageImport.h>
13 #include <vtkImageExport.h>
14 
15 namespace mitk
16 {
22  {
23  public:
29 
31  itkNewMacro(Self)
32 
33 
35 
40  mitk::Image::Pointer GetMask();
41 
42  void SetPlanarFigure(mitk::PlanarFigure::Pointer planarFigure);
43 
44  mitk::Image::Pointer GetReferenceImage();
45 
50  void SetTimeStep(unsigned int timeStep);
51 
52 
53  protected:
54  PlanarFigureMaskGenerator():Superclass(){
55  m_InternalMaskUpdateTime = 0;
56  m_InternalMask = mitk::Image::New();
57  m_ReferenceImage = nullptr;
58  }
59 
60 
61  private:
62  void CalculateMask();
63 
64  template < typename TPixel, unsigned int VImageDimension >
65  void InternalCalculateMaskFromPlanarFigure(
66  const itk::Image< TPixel, VImageDimension > *image, unsigned int axis );
67 
68  mitk::Image::Pointer extract2DImageSlice(unsigned int axis, unsigned int slice);
69 
70  bool GetPrincipalAxis(const BaseGeometry *geometry, Vector3D vector,
71  unsigned int &axis );
72 
74  template <typename ITK_Exporter, typename VTK_Importer>
75  void ConnectPipelines(ITK_Exporter exporter, vtkSmartPointer<VTK_Importer> importer)
76  {
77  importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
78 
79  importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
80  importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
81  importer->SetSpacingCallback(exporter->GetSpacingCallback());
82  importer->SetOriginCallback(exporter->GetOriginCallback());
83  importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
84 
85  importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
86 
87  importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
88  importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
89  importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
90  importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
91  importer->SetCallbackUserData(exporter->GetCallbackUserData());
92  }
93 
95  template <typename VTK_Exporter, typename ITK_Importer>
96  void ConnectPipelines(vtkSmartPointer<VTK_Exporter> exporter, ITK_Importer importer)
97  {
98  importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
99 
100  importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
101  importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
102  importer->SetSpacingCallback(exporter->GetSpacingCallback());
103  importer->SetOriginCallback(exporter->GetOriginCallback());
104  importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
105 
106  importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
107 
108  importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
109  importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
110  importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
111  importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
112  importer->SetCallbackUserData(exporter->GetCallbackUserData());
113  }
114 
115  bool IsUpdateRequired() const;
116 
117  mitk::PlanarFigure::Pointer m_PlanarFigure;
118  itk::Image<unsigned short, 2>::Pointer m_InternalITKImageMask2D;
119  mitk::Image::Pointer m_InternalTimeSliceImage;
120  mitk::Image::Pointer m_ReferenceImage;
121  unsigned int m_PlanarFigureAxis;
122  unsigned long m_InternalMaskUpdateTime;
123  };
124 }
125 
126 #endif // MITKPLANARFIGUREMASKGENERATOR
127 
itk::SmartPointer< Self > Pointer
Base Class for all Mask Generators. Mask generators are classes that provide functionality for the cr...
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< const Self > ConstPointer
#define MITKIMAGESTATISTICS_EXPORT
Image class for storing images.
Definition: mitkImage.h:76
static Pointer New()
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons...
Derived from MaskGenerator. This class is used to convert a mitk::PlanarFigure into a binary image ma...
BaseGeometry Describes the geometry of a data object.