Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkExtractSliceFilter.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 mitkExtractSliceFilter_h_Included
18 #define mitkExtractSliceFilter_h_Included
19 
20 #include "MitkCoreExports.h"
21 #include "mitkImageToImageFilter.h"
22 
23 #include <vtkAbstractTransform.h>
24 #include <vtkImageData.h>
25 #include <vtkImageReslice.h>
26 #include <vtkMatrix4x4.h>
27 #include <vtkPoints.h>
28 #include <vtkSmartPointer.h>
29 #include <vtkTransform.h>
30 
31 namespace mitk
32 {
68  {
69  public:
71  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
72 
73  mitkNewMacro1Param(Self, vtkImageReslice *);
74 
76  void SetWorldGeometry(const PlaneGeometry *geometry)
77  {
78  this->m_WorldGeometry = geometry;
79  this->Modified();
80  }
81 
83  void SetTimeStep(unsigned int timestep) { m_TimeStep = timestep; }
84  unsigned int GetTimeStep() { return m_TimeStep; }
85 
87  void SetComponent(unsigned int component) { m_Component = component; }
88 
92  void SetResliceTransformByGeometry(const BaseGeometry *transform) { this->m_ResliceTransform = transform; }
94  void SetInPlaneResampleExtentByGeometry(bool inPlaneResampleExtentByGeometry)
95  {
96  this->m_InPlaneResampleExtentByGeometry = inPlaneResampleExtentByGeometry;
97  }
98 
100  void SetOutputDimensionality(unsigned int dimension) { this->m_OutputDimension = dimension; }
104  void SetOutputSpacingZDirection(double zSpacing) { this->m_ZSpacing = zSpacing; }
108  void SetOutputExtentZDirection(int zMin, int zMax)
109  {
110  this->m_ZMin = zMin;
111  this->m_ZMax = zMax;
112  }
113 
120  bool GetClippedPlaneBounds(double bounds[6]);
121 
123  bool GetClippedPlaneBounds(const BaseGeometry *boundingGeometry,
124  const PlaneGeometry *planeGeometry,
125  double *bounds);
126 
128  mitk::ScalarType *GetOutputSpacing();
129 
135  vtkImageData *GetVtkOutput()
136  {
137  m_VtkOutputRequested = true;
138  return m_Reslicer->GetOutput();
139  }
140 
147  void SetVtkOutputRequest(bool isRequested) { m_VtkOutputRequested = isRequested; }
151  vtkMatrix4x4 *GetResliceAxes() { return this->m_Reslicer->GetResliceAxes(); }
152  void SetBackgroundLevel(double backgroundLevel) { m_BackgroundLevel = backgroundLevel; }
154  {
155  RESLICE_NEAREST = 0,
156  RESLICE_LINEAR = 1,
157  RESLICE_CUBIC = 3
158  };
159 
161  {
162  this->m_InterpolationMode = interpolation;
163  }
164 
165  protected:
166  ExtractSliceFilter(vtkImageReslice *reslicer = nullptr);
167  virtual ~ExtractSliceFilter();
168 
169  virtual void GenerateData() override;
170  virtual void GenerateOutputInformation() override;
171  virtual void GenerateInputRequestedRegion() override;
172 
174  vtkSmartPointer<vtkImageReslice> m_Reslicer;
175 
176  unsigned int m_TimeStep;
177 
178  unsigned int m_OutputDimension;
179 
180  double m_ZSpacing;
181 
182  int m_ZMin;
183 
184  int m_ZMax;
185 
187 
189 
190  bool m_InPlaneResampleExtentByGeometry; // Resampling grid corresponds to: false->image true->worldgeometry
191 
193 
195 
197 
198  unsigned int m_Component;
199  };
200 }
201 
202 #endif // mitkExtractSliceFilter_h_Included
void SetTimeStep(unsigned int timestep)
Set the time step in the 4D volume.
ResliceInterpolation m_InterpolationMode
vtkMatrix4x4 * GetResliceAxes()
Get the reslices axis matrix. Note: the axis are recalculated when calling SetResliceTransformByGeome...
#define MITKCORE_EXPORT
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:76
void SetOutputExtentZDirection(int zMin, int zMax)
Set the extent in pixel for direction z manualy. Required if the output dimension is > 2...
void SetVtkOutputRequest(bool isRequested)
double ScalarType
vtkImageData * GetVtkOutput()
Get Output as vtkImageData. Note: SetVtkOutputRequest(true) has to be called at least once before Get...
void SetOutputDimensionality(unsigned int dimension)
Sets the output dimension of the slice.
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
void SetOutputSpacingZDirection(double zSpacing)
Set the spacing in z direction manually. Required if the outputDimension is > 2.
void SetBackgroundLevel(double backgroundLevel)
void SetResliceTransformByGeometry(const BaseGeometry *transform)
Set a transform for the reslice axes. This transform is needed if the image volume itself is transfor...
const PlaneGeometry * m_WorldGeometry
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
BaseGeometry::ConstPointer m_ResliceTransform
Superclass of all classes having one or more Images as input and generating Images as output...
mitk::ScalarType * m_OutPutSpacing
void SetComponent(unsigned int component)
Set the component of an image to be extracted.
Describes a two-dimensional, rectangular plane.
ExtractSliceFilter extracts a 2D abitrary oriented slice from a 3D volume.
vtkSmartPointer< vtkImageReslice > m_Reslicer
void SetInPlaneResampleExtentByGeometry(bool inPlaneResampleExtentByGeometry)
Resampling grid corresponds to: false->image true->worldgeometry.
BaseGeometry Describes the geometry of a data object.
void SetInterpolationMode(ExtractSliceFilter::ResliceInterpolation interpolation)