Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::SliceBasedInterpolationController Class Reference

Generates interpolations of 2D slices. More...

#include <mitkSliceBasedInterpolationController.h>

Inheritance diagram for mitk::SliceBasedInterpolationController:
Collaboration diagram for mitk::SliceBasedInterpolationController:

Classes

class  SetChangedSliceOptions
 Protected class of mitk::SliceBasedInterpolationController. Don't use (you shouldn't be able to do so)! More...
 

Public Member Functions

 mitkClassMacroItkParent (SliceBasedInterpolationController, itk::Object)
 
Pointer Clone () const
 
void SetWorkingImage (LabelSetImage *image)
 Initialize with a whole volume. More...
 
void SetReferenceImage (Image *image)
 Set a reference image (original patient image) - optional. More...
 
void SetChangedSlice (const Image *image, unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep)
 Update after changing a single slice in the working image. More...
 
Image::Pointer Interpolate (unsigned int sliceDimension, unsigned int sliceIndex, const mitk::PlaneGeometry *currentPlane, unsigned int timeStep)
 Update after changing the whole working image. More...
 
void ResetLabelCount ()
 Initializes the internal container with the number of voxels per label. More...
 

Static Public Member Functions

static Pointer New ()
 
static SliceBasedInterpolationControllerInterpolatorForImage (const Image *)
 Find interpolator for a given image. More...
 

Protected Types

typedef std::vector< unsigned int > LabelCounterVectorType
 
typedef std::vector< LabelCounterVectorTypeLabelCounterSliceVectorType
 
typedef std::vector< std::vector< LabelCounterSliceVectorType > > LabelCounterSliceTimeVectorType
 
typedef std::map< const Image *, SliceBasedInterpolationController * > InterpolatorMapType
 

Protected Member Functions

 SliceBasedInterpolationController ()
 
 ~SliceBasedInterpolationController () override
 
template<typename PixelType >
void ScanSliceITKProcessing (const itk::Image< PixelType, 2 > *, const SetChangedSliceOptions &options)
 internal scan of a single slice More...
 
template<typename TPixel , unsigned int VImageDimension>
void ScanImageITKProcessing (itk::Image< TPixel, VImageDimension > *, unsigned int timeStep)
 internal scan of the whole image More...
 

Protected Attributes

LabelCounterSliceTimeVectorType m_LabelCountInSlice
 
LabelSetImage::Pointer m_WorkingImage
 
Image::Pointer m_ReferenceImage
 

Static Protected Attributes

static InterpolatorMapType s_InterpolatorForImage
 

Detailed Description

Generates interpolations of 2D slices.

See also
QmitkSlicesInterpolator
QmitkInteractiveSegmentation

This class keeps track of the contents of a 3D segmentation image.

Attention
mitk::SliceBasedInterpolationController assumes that the image contains pixel values of 0 and 1.

After you set the segmentation image using SetSegmentationVolume(), the whole image is scanned for pixels other than 0. SliceBasedInterpolationController registers as an observer to the segmentation image, and repeats the scan whenvever the image is modified.

You can prevent this (time consuming) scan if you do the changes slice-wise and send difference images to SliceBasedInterpolationController. For this purpose SetChangedSlice() should be used. mitk::OverwriteImageFilter already does this every time it changes a slice of an image. There is a static method InterpolatorForImage(), which can be used to find out if there already is an interpolator instance for a specified image. OverwriteImageFilter uses this to get to know its interpolator.

SliceBasedInterpolationController needs to maintain some information about the image slices (in every dimension). This information is stored internally in m_SegmentationCountInSlice, which is basically three std::vectors (one for each dimension). Each item describes one image dimension, each vector item holds the count of pixels in "its" slice. This is perhaps better to understand from the following picture (where red items just mean to symbolize "there is some segmentation" - in reality there is an integer count).

slice_based_segmentation_interpolator.png

$Author$

Definition at line 66 of file mitkSliceBasedInterpolationController.h.

Member Typedef Documentation

◆ InterpolatorMapType

◆ LabelCounterSliceTimeVectorType

◆ LabelCounterSliceVectorType

◆ LabelCounterVectorType

typedef std::vector<unsigned int> mitk::SliceBasedInterpolationController::LabelCounterVectorType
protected

Definition at line 168 of file mitkSliceBasedInterpolationController.h.

Constructor & Destructor Documentation

◆ SliceBasedInterpolationController()

mitk::SliceBasedInterpolationController::SliceBasedInterpolationController ( )
protected

Definition at line 44 of file mitkSliceBasedInterpolationController.cpp.

◆ ~SliceBasedInterpolationController()

mitk::SliceBasedInterpolationController::~SliceBasedInterpolationController ( )
overrideprotected

Definition at line 49 of file mitkSliceBasedInterpolationController.cpp.

References s_InterpolatorForImage.

Member Function Documentation

◆ Clone()

Pointer mitk::SliceBasedInterpolationController::Clone ( ) const

◆ Interpolate()

mitk::Image::Pointer mitk::SliceBasedInterpolationController::Interpolate ( unsigned int  sliceDimension,
unsigned int  sliceIndex,
const mitk::PlaneGeometry currentPlane,
unsigned int  timeStep 
)

Update after changing the whole working image.

Parameters
imageis a 3D image with the difference image of the slice determined by sliceDimension and sliceIndex. The difference is (pixel value in the new slice minus pixel value in the old slice).
timeStepWhich time step is changed Generates an interpolated image for the given slice.
sliceDimensionNumber of the dimension which is constant for all pixels of the meant slice.
sliceIndexWhich slice to take, in the direction specified by sliceDimension. Count starts from 0.
timeStepWhich time step to use

Definition at line 290 of file mitkSliceBasedInterpolationController.cpp.

References mitk::PlaneGeometry::Clone(), mitk::BaseGeometry::GetOrigin(), m_LabelCountInSlice, m_WorkingImage, MITK_ERROR, mitk::ShapeBasedInterpolationAlgorithm::New(), and mitk::ExtractSliceFilter::New().

◆ InterpolatorForImage()

mitk::SliceBasedInterpolationController * mitk::SliceBasedInterpolationController::InterpolatorForImage ( const Image image)
static

Find interpolator for a given image.

Returns
nullptr if there is no interpolator yet.

This method is useful if several "clients" modify the same image and want to access the interpolations. Then they can share the same object.

Definition at line 30 of file mitkSliceBasedInterpolationController.cpp.

References s_InterpolatorForImage.

◆ mitkClassMacroItkParent()

mitk::SliceBasedInterpolationController::mitkClassMacroItkParent ( SliceBasedInterpolationController  ,
itk::Object   
)

◆ New()

static Pointer mitk::SliceBasedInterpolationController::New ( )
static

◆ ResetLabelCount()

void mitk::SliceBasedInterpolationController::ResetLabelCount ( )

Initializes the internal container with the number of voxels per label.

Definition at line 63 of file mitkSliceBasedInterpolationController.cpp.

References m_LabelCountInSlice, and m_WorkingImage.

Referenced by SetWorkingImage().

◆ ScanImageITKProcessing()

template<typename TPixel , unsigned int VImageDimension>
void mitk::SliceBasedInterpolationController::ScanImageITKProcessing ( itk::Image< TPixel, VImageDimension > *  input,
unsigned int  timeStep 
)
protected

internal scan of the whole image

Definition at line 241 of file mitkSliceBasedInterpolationController.cpp.

References m_LabelCountInSlice, and m_WorkingImage.

Referenced by SetWorkingImage().

◆ ScanSliceITKProcessing()

◆ SetChangedSlice()

void mitk::SliceBasedInterpolationController::SetChangedSlice ( const Image image,
unsigned int  sliceDimension,
unsigned int  sliceIndex,
unsigned int  timeStep 
)

Update after changing a single slice in the working image.

Parameters
imageis a 2D image with the difference image of the slice determined by sliceDimension and sliceIndex. The difference is (pixel value in the new slice minus pixel value in the old slice).
sliceDimensionNumber of the dimension which is constant for all pixels of the meant slice.
sliceIndexWhich slice to take, in the direction specified by sliceDimension. Count starts from 0.
timeStepWhich time step is changed

Definition at line 150 of file mitkSliceBasedInterpolationController.cpp.

References AccessFixedDimensionByItk_1, mitk::Image::GetDimension(), m_LabelCountInSlice, m_WorkingImage, and ScanSliceITKProcessing().

◆ SetReferenceImage()

void mitk::SliceBasedInterpolationController::SetReferenceImage ( Image image)

Set a reference image (original patient image) - optional.

If this image is set (must exactly match the dimensions of the segmentation), the interpolation algorithm may consider image content to improve the interpolated (estimated) segmentation.

Definition at line 121 of file mitkSliceBasedInterpolationController.cpp.

References m_ReferenceImage, m_WorkingImage, and MITK_WARN.

◆ SetWorkingImage()

void mitk::SliceBasedInterpolationController::SetWorkingImage ( LabelSetImage image)

Initialize with a whole volume.

Will scan the volume for segmentation pixels (values other than 0) and fill some internal data structures. You don't have to call this method every time something changes, but only when several slices at once change.

When you change a single slice, call SetChangedSlice() instead.

Definition at line 86 of file mitkSliceBasedInterpolationController.cpp.

References AccessFixedDimensionByItk_1, m_WorkingImage, ResetLabelCount(), s_InterpolatorForImage, and ScanImageITKProcessing().

Member Data Documentation

◆ m_LabelCountInSlice

LabelCounterSliceTimeVectorType mitk::SliceBasedInterpolationController::m_LabelCountInSlice
protected

An array that of flags. One for each dimension of the image. A flag is set, when a slice in a certain dimension has at least one pixel that is not 0 (which would mean that it has to be considered by the interpolation algorithm). E.g. flags for axial slices are stored in m_SegmentationCountInSlice[0][index]. Enhanced with time steps it is now m_SegmentationCountInSlice[timeStep][0][index]

Definition at line 191 of file mitkSliceBasedInterpolationController.h.

Referenced by Interpolate(), ResetLabelCount(), ScanImageITKProcessing(), ScanSliceITKProcessing(), and SetChangedSlice().

◆ m_ReferenceImage

Image::Pointer mitk::SliceBasedInterpolationController::m_ReferenceImage
protected

Definition at line 196 of file mitkSliceBasedInterpolationController.h.

Referenced by SetReferenceImage().

◆ m_WorkingImage

LabelSetImage::Pointer mitk::SliceBasedInterpolationController::m_WorkingImage
protected

◆ s_InterpolatorForImage

mitk::SliceBasedInterpolationController::InterpolatorMapType mitk::SliceBasedInterpolationController::s_InterpolatorForImage
staticprotected

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