Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::ExtractSliceFilter Class Reference

ExtractSliceFilter extracts a 2D arbitrary oriented slice from a 3D volume. More...

#include <mitkExtractSliceFilter.h>

Inheritance diagram for mitk::ExtractSliceFilter:
Collaboration diagram for mitk::ExtractSliceFilter:

Public Types

enum  ResliceInterpolation { RESLICE_NEAREST, RESLICE_LINEAR, RESLICE_CUBIC }
 
typedef ExtractSliceFilter Self
 
typedef ImageToImageFilter Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
- Public Types inherited from mitk::ImageToImageFilter
typedef ImageToImageFilter Self
 
typedef ImageSource Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef Superclass::OutputImageRegionType OutputImageRegionType
 
typedef mitk::Image InputImageType
 
typedef InputImageType::Pointer InputImagePointer
 
typedef InputImageType::ConstPointer InputImageConstPointer
 
typedef SlicedData::RegionType InputImageRegionType
 
- Public Types inherited from mitk::ImageSource
typedef ImageSource Self
 
typedef BaseDataSource Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef mitk::Image OutputImageType
 Some convenient typedefs. More...
 
typedef OutputImageType OutputType
 
typedef OutputImageType::Pointer OutputImagePointer
 
typedef SlicedData::RegionType OutputImageRegionType
 
- Public Types inherited from mitk::BaseDataSource
typedef BaseDataSource Self
 
typedef itk::ProcessObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef BaseData OutputType
 
typedef itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
Pointer Clone () const
 
void SetWorldGeometry (const PlaneGeometry *geometry)
 Set the axis where to reslice at. More...
 
void SetTimeStep (unsigned int timestep)
 Set the time step in the 4D volume. More...
 
unsigned int GetTimeStep ()
 
void SetComponent (unsigned int component)
 Set the component of an image to be extracted. More...
 
void SetResliceTransformByGeometry (const BaseGeometry *transform)
 Set a transform for the reslice axes. This transform is needed if the image volume itself is transformed. (Effects the reslice axis) More...
 
void SetInPlaneResampleExtentByGeometry (bool inPlaneResampleExtentByGeometry)
 Resampling grid corresponds to: false->image true->worldgeometry. More...
 
void SetOutputDimensionality (unsigned int dimension)
 Sets the output dimension of the slice. More...
 
void SetOutputSpacingZDirection (double zSpacing)
 Set the spacing in z direction manually. Required if the outputDimension is > 2. More...
 
void SetOutputExtentZDirection (int zMin, int zMax)
 Set the extent in pixel for direction z manually. Required if the output dimension is > 2. More...
 
bool GetClippedPlaneBounds (double bounds[6])
 Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax] The method uses the input of the filter to calculate the bounds. It is recommended to use GetClippedPlaneBounds(const BaseGeometry*, const PlaneGeometry*, double*) if you are not sure about the input. More...
 
bool GetClippedPlaneBounds (const BaseGeometry *boundingGeometry, const PlaneGeometry *planeGeometry, double *bounds)
 Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax]. More...
 
mitk::ScalarTypeGetOutputSpacing ()
 Get the spacing of the slice. returns mitk::ScalarType[2]. More...
 
vtkImageData * GetVtkOutput ()
 Get Output as vtkImageData. Note: SetVtkOutputRequest(true) has to be called at least once before GetVtkOutput(). Otherwise the output is empty for the first update step. More...
 
void SetVtkOutputRequest (bool isRequested)
 
vtkMatrix4x4 * GetResliceAxes ()
 Get the reslices axis matrix. Note: the axis are recalculated when calling SetResliceTransformByGeometry. More...
 
void SetBackgroundLevel (double backgroundLevel)
 
void SetInterpolationMode (ExtractSliceFilter::ResliceInterpolation interpolation)
 
- Public Member Functions inherited from mitk::ImageToImageFilter
Pointer Clone () const
 
virtual void SetInput (const InputImageType *image)
 
virtual void SetInput (unsigned int, const InputImageType *image)
 
InputImageTypeGetInput (void)
 
InputImageTypeGetInput (unsigned int idx)
 
const InputImageTypeGetInput (void) const
 
const InputImageTypeGetInput (unsigned int idx) const
 
- Public Member Functions inherited from mitk::ImageSource
Pointer Clone () const
 
OutputTypeGetOutput ()
 Get the output data of this image source object. More...
 
const OutputTypeGetOutput () const
 
OutputTypeGetOutput (DataObjectPointerArraySizeType idx)
 
const OutputTypeGetOutput (DataObjectPointerArraySizeType idx) const
 
itk::DataObject::Pointer MakeOutput (DataObjectPointerArraySizeType idx) override
 Make a DataObject of the correct type to used as the specified output. More...
 
itk::DataObject::Pointer MakeOutput (const DataObjectIdentifierType &name) override
 
virtual vtkImageData * GetVtkImageData ()
 
virtual const vtkImageData * GetVtkImageData () const
 
- Public Member Functions inherited from mitk::BaseDataSource
OutputTypeGetOutput ()
 
const OutputTypeGetOutput () const
 
OutputTypeGetOutput (DataObjectPointerArraySizeType idx)
 
const OutputTypeGetOutput (DataObjectPointerArraySizeType idx) const
 
virtual void GraftOutput (OutputType *output)
 Graft the specified BaseData onto this BaseDataSource's output. More...
 
virtual void GraftOutput (const DataObjectIdentifierType &key, OutputType *output)
 
virtual void GraftNthOutput (unsigned int idx, OutputType *output)
 Graft the specified base data object onto this BaseDataSource's idx'th output. More...
 
bool Updating () const
 Access itk::ProcessObject::m_Updating. More...
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 
static Pointer New (vtkImageReslice *_arg)
 
- Static Public Member Functions inherited from mitk::ImageToImageFilter
static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 
- Static Public Member Functions inherited from mitk::ImageSource
static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 Method for creation through the object factory. More...
 
- Static Public Member Functions inherited from mitk::BaseDataSource
static const char * GetStaticNameOfClass ()
 

Protected Member Functions

 ExtractSliceFilter (vtkImageReslice *reslicer=nullptr)
 
 ~ExtractSliceFilter () override
 
void GenerateData () override
 
void GenerateOutputInformation () override
 
void GenerateInputRequestedRegion () override
 
- Protected Member Functions inherited from mitk::ImageToImageFilter
 ImageToImageFilter ()
 
 ~ImageToImageFilter () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
void GenerateInputRequestedRegion () override
 
- Protected Member Functions inherited from mitk::ImageSource
 ImageSource ()
 
 ~ImageSource () override
 
void GenerateData () override
 A version of GenerateData() specific for image processing filters. More...
 
virtual void ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId)
 If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an implementation of ThreadedGenerateData(). More...
 
void PrepareOutputs () override
 This method is intentionally left blank. More...
 
virtual void AllocateOutputs ()
 The GenerateData method normally allocates the buffers for all of the outputs of a filter. More...
 
virtual void BeforeThreadedGenerateData ()
 If an imaging filter needs to perform processing after the buffer has been allocated but before threads are spawned, the filter can can provide an implementation for BeforeThreadedGenerateData(). More...
 
virtual void AfterThreadedGenerateData ()
 If an imaging filter needs to perform processing after all processing threads have completed, the filter can can provide an implementation for AfterThreadedGenerateData(). More...
 
virtual unsigned int SplitRequestedRegion (unsigned int i, unsigned int num, OutputImageRegionType &splitRegion)
 Split the output's RequestedRegion into "num" pieces, returning region "i" as "splitRegion". More...
 
- Protected Member Functions inherited from mitk::BaseDataSource
 BaseDataSource ()
 
 ~BaseDataSource () override
 

Protected Attributes

PlaneGeometry::ConstPointer m_WorldGeometry
 
vtkSmartPointer< vtkImageReslice > m_Reslicer
 
unsigned int m_TimeStep
 
unsigned int m_OutputDimension
 
double m_ZSpacing
 
int m_ZMin
 
int m_ZMax
 
ResliceInterpolation m_InterpolationMode
 
bool m_InPlaneResampleExtentByGeometry
 
mitk::ScalarTypem_OutPutSpacing
 
bool m_VtkOutputRequested
 
double m_BackgroundLevel
 
unsigned int m_Component
 

Additional Inherited Members

- Static Protected Member Functions inherited from mitk::ImageSource
static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback (void *arg)
 Static function used as a "callback" by the MultiThreader. More...
 
- Static Protected Member Functions inherited from mitk::BaseDataSource
static Pointer New ()
 

Detailed Description

ExtractSliceFilter extracts a 2D arbitrary oriented slice from a 3D volume.

The filter can reslice in all orthogonal planes such as sagittal, coronal and axial, and is also able to reslice an arbitrary oriented oblique plane. Curved planes are specified via an AbstractTransformGeometry as the input worldgeometry.

Additionally the filter extracts the specified component of a multi-component input image. This is done only if the caller requests an mitk::Image output ('m_VtkOutputRequested' set to false). The default component to be extracted is '0'.

The convenient workflow is:

  1. Set an image as input.
  2. Set the worldPlaneGeometry. This defines a grid where the slice is being extracted
  3. And then start the pipeline.

There are a few more properties that can be set to modify the behavior of the slicing. The properties are:

  • interpolation mode either Nearestneighbor, Linear or Cubic.
  • a transform this is a convenient way to adapt the reslice axis for the case that the image is transformed e.g. rotated.
  • time step the time step in a times volume.
  • the component to extract from a multi-component input image
  • vtkoutputrequested, to define whether an mitk::image should be initialized
  • resample by geometry whether the resampling grid corresponds to the specs of the worldgeometry or is directly derived from the input image

By default the properties are set to:

  • interpolation mode Nearestneighbor.
  • a transform nullptr (No transform is set).
  • time step 0.
  • component 0.
  • resample by geometry false (Corresponds to input image).

Definition at line 63 of file mitkExtractSliceFilter.h.

Member Typedef Documentation

◆ ConstPointer

◆ Pointer

◆ Self

◆ Superclass

Member Enumeration Documentation

◆ ResliceInterpolation

Enumerator
RESLICE_NEAREST 
RESLICE_LINEAR 
RESLICE_CUBIC 

Definition at line 153 of file mitkExtractSliceFilter.h.

Constructor & Destructor Documentation

◆ ExtractSliceFilter()

mitk::ExtractSliceFilter::ExtractSliceFilter ( vtkImageReslice *  reslicer = nullptr)
protected

◆ ~ExtractSliceFilter()

mitk::ExtractSliceFilter::~ExtractSliceFilter ( )
overrideprotected

Member Function Documentation

◆ Clone()

Pointer mitk::ExtractSliceFilter::Clone ( ) const

◆ GenerateData()

void mitk::ExtractSliceFilter::GenerateData ( )
overrideprotected

◆ GenerateInputRequestedRegion()

void mitk::ExtractSliceFilter::GenerateInputRequestedRegion ( )
overrideprotected

◆ GenerateOutputInformation()

void mitk::ExtractSliceFilter::GenerateOutputInformation ( )
overrideprotected

◆ GetClassHierarchy()

virtual std::vector<std::string> mitk::ExtractSliceFilter::GetClassHierarchy ( ) const
inlineoverridevirtual

Reimplemented from mitk::ImageToImageFilter.

Definition at line 66 of file mitkExtractSliceFilter.h.

◆ GetClassName()

virtual const char* mitk::ExtractSliceFilter::GetClassName ( ) const
virtual

Reimplemented from mitk::ImageToImageFilter.

◆ GetClippedPlaneBounds() [1/2]

bool mitk::ExtractSliceFilter::GetClippedPlaneBounds ( const BaseGeometry boundingGeometry,
const PlaneGeometry planeGeometry,
double *  bounds 
)

Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax].

◆ GetClippedPlaneBounds() [2/2]

bool mitk::ExtractSliceFilter::GetClippedPlaneBounds ( double  bounds[6])

Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax] The method uses the input of the filter to calculate the bounds. It is recommended to use GetClippedPlaneBounds(const BaseGeometry*, const PlaneGeometry*, double*) if you are not sure about the input.

◆ GetOutputSpacing()

mitk::ScalarType* mitk::ExtractSliceFilter::GetOutputSpacing ( )

Get the spacing of the slice. returns mitk::ScalarType[2].

◆ GetResliceAxes()

vtkMatrix4x4* mitk::ExtractSliceFilter::GetResliceAxes ( )
inline

Get the reslices axis matrix. Note: the axis are recalculated when calling SetResliceTransformByGeometry.

Definition at line 151 of file mitkExtractSliceFilter.h.

◆ GetStaticNameOfClass()

static const char* mitk::ExtractSliceFilter::GetStaticNameOfClass ( )
inlinestatic

Definition at line 66 of file mitkExtractSliceFilter.h.

◆ GetTimeStep()

unsigned int mitk::ExtractSliceFilter::GetTimeStep ( )
inline

Definition at line 84 of file mitkExtractSliceFilter.h.

◆ GetVtkOutput()

vtkImageData* mitk::ExtractSliceFilter::GetVtkOutput ( )
inline

Get Output as vtkImageData. Note: SetVtkOutputRequest(true) has to be called at least once before GetVtkOutput(). Otherwise the output is empty for the first update step.

Definition at line 135 of file mitkExtractSliceFilter.h.

◆ New() [1/2]

static Pointer mitk::ExtractSliceFilter::New ( )
static

◆ New() [2/2]

static Pointer mitk::ExtractSliceFilter::New ( vtkImageReslice *  _arg)
inlinestatic

Definition at line 70 of file mitkExtractSliceFilter.h.

◆ SetBackgroundLevel()

void mitk::ExtractSliceFilter::SetBackgroundLevel ( double  backgroundLevel)
inline

Definition at line 152 of file mitkExtractSliceFilter.h.

◆ SetComponent()

void mitk::ExtractSliceFilter::SetComponent ( unsigned int  component)
inline

Set the component of an image to be extracted.

Definition at line 87 of file mitkExtractSliceFilter.h.

◆ SetInPlaneResampleExtentByGeometry()

void mitk::ExtractSliceFilter::SetInPlaneResampleExtentByGeometry ( bool  inPlaneResampleExtentByGeometry)
inline

Resampling grid corresponds to: false->image true->worldgeometry.

Definition at line 94 of file mitkExtractSliceFilter.h.

◆ SetInterpolationMode()

void mitk::ExtractSliceFilter::SetInterpolationMode ( ExtractSliceFilter::ResliceInterpolation  interpolation)
inline

Definition at line 160 of file mitkExtractSliceFilter.h.

◆ SetOutputDimensionality()

void mitk::ExtractSliceFilter::SetOutputDimensionality ( unsigned int  dimension)
inline

Sets the output dimension of the slice.

Definition at line 100 of file mitkExtractSliceFilter.h.

◆ SetOutputExtentZDirection()

void mitk::ExtractSliceFilter::SetOutputExtentZDirection ( int  zMin,
int  zMax 
)
inline

Set the extent in pixel for direction z manually. Required if the output dimension is > 2.

Definition at line 108 of file mitkExtractSliceFilter.h.

◆ SetOutputSpacingZDirection()

void mitk::ExtractSliceFilter::SetOutputSpacingZDirection ( double  zSpacing)
inline

Set the spacing in z direction manually. Required if the outputDimension is > 2.

Definition at line 104 of file mitkExtractSliceFilter.h.

◆ SetResliceTransformByGeometry()

void mitk::ExtractSliceFilter::SetResliceTransformByGeometry ( const BaseGeometry transform)
inline

Set a transform for the reslice axes. This transform is needed if the image volume itself is transformed. (Effects the reslice axis)

Definition at line 92 of file mitkExtractSliceFilter.h.

◆ SetTimeStep()

void mitk::ExtractSliceFilter::SetTimeStep ( unsigned int  timestep)
inline

Set the time step in the 4D volume.

Definition at line 83 of file mitkExtractSliceFilter.h.

◆ SetVtkOutputRequest()

void mitk::ExtractSliceFilter::SetVtkOutputRequest ( bool  isRequested)
inline

Set VtkOutPutRequest to suppress the conversion of the image. It is suggested to use this with GetVtkOutput(). Note: SetVtkOutputRequest(true) has to be called at least once before GetVtkOutput(). Otherwise the output is empty for the first update step.

Definition at line 147 of file mitkExtractSliceFilter.h.

◆ SetWorldGeometry()

void mitk::ExtractSliceFilter::SetWorldGeometry ( const PlaneGeometry geometry)
inline

Set the axis where to reslice at.

Definition at line 73 of file mitkExtractSliceFilter.h.

Member Data Documentation

◆ m_BackgroundLevel

double mitk::ExtractSliceFilter::m_BackgroundLevel
protected

Definition at line 194 of file mitkExtractSliceFilter.h.

◆ m_Component

unsigned int mitk::ExtractSliceFilter::m_Component
protected

Definition at line 196 of file mitkExtractSliceFilter.h.

◆ m_InPlaneResampleExtentByGeometry

bool mitk::ExtractSliceFilter::m_InPlaneResampleExtentByGeometry
protected

Definition at line 188 of file mitkExtractSliceFilter.h.

◆ m_InterpolationMode

ResliceInterpolation mitk::ExtractSliceFilter::m_InterpolationMode
protected

Definition at line 186 of file mitkExtractSliceFilter.h.

◆ m_OutputDimension

unsigned int mitk::ExtractSliceFilter::m_OutputDimension
protected

Definition at line 178 of file mitkExtractSliceFilter.h.

◆ m_OutPutSpacing

mitk::ScalarType* mitk::ExtractSliceFilter::m_OutPutSpacing
protected

Definition at line 190 of file mitkExtractSliceFilter.h.

◆ m_Reslicer

vtkSmartPointer<vtkImageReslice> mitk::ExtractSliceFilter::m_Reslicer
protected

Definition at line 174 of file mitkExtractSliceFilter.h.

◆ m_TimeStep

unsigned int mitk::ExtractSliceFilter::m_TimeStep
protected

Definition at line 176 of file mitkExtractSliceFilter.h.

◆ m_VtkOutputRequested

bool mitk::ExtractSliceFilter::m_VtkOutputRequested
protected

Definition at line 192 of file mitkExtractSliceFilter.h.

◆ m_WorldGeometry

PlaneGeometry::ConstPointer mitk::ExtractSliceFilter::m_WorldGeometry
protected

Definition at line 173 of file mitkExtractSliceFilter.h.

◆ m_ZMax

int mitk::ExtractSliceFilter::m_ZMax
protected

Definition at line 184 of file mitkExtractSliceFilter.h.

◆ m_ZMin

int mitk::ExtractSliceFilter::m_ZMin
protected

Definition at line 182 of file mitkExtractSliceFilter.h.

◆ m_ZSpacing

double mitk::ExtractSliceFilter::m_ZSpacing
protected

Definition at line 180 of file mitkExtractSliceFilter.h.


The documentation for this class was generated from the following file: