Classes | Defines | Functions

Adaptor Classes
[Process and Adaptor Classes]

This subcategory includes adaptor classes for the integration of algorithms from other toolkits, especially ITK. More...

Collaboration diagram for Adaptor Classes:

Classes

class  mitk::ImageToItk< TOutputImage >
class  mitk::ITKImageImport< TInputImage >
 Pipelined import of itk::Image. More...

Defines

#define AccessByItk(mitkImage, itkImageTypeFunction)
 Access an mitk-image by an itk-image.
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
 Access an mitk-image with known dimension by an itk-image.
#define AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension)
 Access an mitk-image with known type (pixel type and dimension) by an itk-image.
#define AccessFixedPixelTypeByItk(mitkImage, itkImageTypeFunction, pixeltype)
 Access an mitk-image with known pixeltype (but unknown dimension) by an itk-image and pass two additional parameters to the access-function.
#define AccessByItk_1(mitkImage, itkImageTypeFunction, param1)
 Access an mitk-image by an itk-image and pass one additional parameter to the access-function.
#define AccessFixedDimensionByItk_1(mitkImage, itkImageTypeFunction, dimension, param1)
 Access an mitk-image with known dimension by an itk-image and pass one additional parameter to the access-function.
#define AccessFixedTypeByItk_1(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1)
 Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass one additional parameters to the access-function.
#define AccessFixedPixelTypeByItk_1(mitkImage, itkImageTypeFunction, pixeltype, param1)
 Access an mitk-image with known pixeltype (but unknown dimension) by an itk-image and pass one additional parameters to the access-function.
#define AccessByItk_2(mitkImage, itkImageTypeFunction, param1, param2)
 Access an mitk-image by an itk-image and pass two additional parameters to the access-function.
#define AccessFixedDimensionByItk_2(mitkImage, itkImageTypeFunction, dimension, param1, param2)
 Access an mitk-image with known dimension by an itk-image and pass two additional parameters to the access-function.
#define AccessFixedTypeByItk_2(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2)
 Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass two additional parameters to the access-function.
#define AccessFixedPixelTypeByItk_2(mitkImage, itkImageTypeFunction, pixeltype, param1, param2)
 Access an mitk-image with known pixel type (but unknown dimension) by an itk-image and pass two additional parameters to the access-function.
#define AccessByItk_3(mitkImage, itkImageTypeFunction, param1, param2, param3)
 Access an mitk-image by an itk-image and pass three additional parameters to the access-function.
#define AccessFixedDimensionByItk_3(mitkImage, itkImageTypeFunction, dimension, param1, param2, param3)
 Access an mitk-image with known dimension by an itk-image and pass three additional parameters to the access-function.
#define AccessFixedTypeByItk_3(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2, param3)
 Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass three additional parameters to the access-function.
#define AccessFixedPixelTypeByItk_3(mitkImage, itkImageTypeFunction, pixeltype, param1, param2, param3)
 Access an mitk-image with known pixel type (but unknown dimension) by an itk-image and pass three additional parameters to the access-function.
#define AccessTwoImagesFixedDimensionByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension)
 Access two mitk-images with known dimension by itk-images.
#define InstantiateAccessFunction(itkImgFunc)
 Instantiate access function without additional parammeters for all datatypes and dimensions.
#define InstantiateAccessFunction_1(itkImgFunc, param1Type)
 Instantiate access function with one additional parammeter for all datatypes and dimensions.
#define InstantiateAccessFunction_2(itkImgFunc, param1Type, param2Type)
 Instantiate access function with two additional parammeters for all datatypes and dimensions.
#define InstantiateAccessFunctionForFixedDimension(itkImgFunc, dimension)
 Instantiate access function without additional parammeters for all datatypes, but fixed dimension.
#define InstantiateAccessFunctionForFixedDimension_1(itkImgFunc, dimension, param1Type)
 Instantiate access function with one additional parammeter for all datatypes, but fixed dimension.
#define InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, dimension, param1Type, param2Type)
 Instantiate access function with two additional parammeters for all datatypes, but fixed dimension.
#define InstantiateAccessFunctionForFixedPixelType(itkImgFunc, pixelType)
 Instantiate access function without additional parammeters for a fixed datatype, but all dimensions.
#define InstantiateAccessFunctionForFixedPixelType_1(itkImgFunc, pixelType, param1Type)
 Instantiate access function with one additional parammeter for a fixed datatype, but all dimensions.
#define InstantiateAccessFunctionForFixedPixelType_2(itkImgFunc, pixelType, param1Type, param2Type)
 Instantiate access function with two additional parammeters for a fixed datatype, but all dimensions.

Functions

template<typename ItkOutputImageType >
void MITK_CORE_EXPORT mitk::CastToItkImage (const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
 Cast an mitk::Image to an itk::Image with a specific type. You don't have to initialize the itk::Image<..>Pointer.
template<typename ItkOutputImageType >
Image::Pointer mitk::ImportItkImage (const itk::SmartPointer< ItkOutputImageType > &itkimage, const Geometry3D *geometry=NULL, bool update=true)
 Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImport. mitk::ITKImageImport does not cast pixel types etc., it just imports image data. If you get a compile error, try image.GetPointer().
template<typename ItkOutputImageType >
Image::Pointer mitk::ImportItkImage (const ItkOutputImageType *itkimage, const Geometry3D *geometry=NULL, bool update=true)
 Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImport mitk::ITKImageImport does not cast pixel types etc., it just imports image data. If you get a compile error, try image.GetPointer().
template<typename ItkOutputImageType >
Image::Pointer mitk::GrabItkImageMemory (itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=NULL, const Geometry3D *geometry=NULL, bool update=true)
 Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
template<typename ItkOutputImageType >
Image::Pointer mitk::GrabItkImageMemory (ItkOutputImageType *itkimage, mitk::Image *mitkImage=NULL, const Geometry3D *geometry=NULL, bool update=true)
 Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
template<typename ItkOutputImageType >
void mitk::CastToMitkImage (const itk::SmartPointer< ItkOutputImageType > &itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
 Cast an itk::Image (with a specific type) to an mitk::Image.
template<typename ItkOutputImageType >
void mitk::CastToMitkImage (const ItkOutputImageType *itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
 Cast an itk::Image (with a specific type) to an mitk::Image.

Detailed Description

This subcategory includes adaptor classes for the integration of algorithms from other toolkits, especially ITK.

The task of most of the classes in this category is to deal with the conversion between the (templated) itk::Image and the (not-templated) mitk::Image. Methods for conversion are provided for both directions:

Care has to be taken regarding the involved coordinate systems, see ITK image vs MITK coordinate systems.

For limitations on ITK-type conversion see the section Limitations.

VTK-based access to MITK images is straightforward: simply ask your mitk::Image vor a vtkImageData by calling Image:GetVtkImageData. Similarily, to get a vtkPolyData from the MITK class for storing surfaces, mitk::Surface, call Surface::GetVtkPolyData.

MITK to ITK adaptors

Pixel type and dimension of MITK images can be specified at run time whereas whereas ITK images are templated over the pixel type and the dimension, thus in ITK both need to be specified at compile time.

There two different situations, which are covered in the following sub-sections:

Converting MITK images to ITK images with known type

If you know the type (pixel type and dimension) of the MITK image you have two options:

Thus, mitk::CastToItkImage is the more powerful variant: here it is sufficient that you know what you want to have (the ITK data type), to which the MITK image will be casted, if needed.

Accessing an MITK image as an ITK image (type unkown)

If you do not know the pixel type/dimension of an MITK image in advance and the ITK image should have the same (unkown) type, e.g., to run a filter on the MITK image data, we cannot really convert to one ITK image. This is simply, because we cannot instantiate an itk::Image object with unkown pixel type/dimension.

Nevertheless, MITK provides a way to access an MITK image as if it was an ITK image of unkown type. To do so, first define an access method, which is templated as an ITK image is:

template<TPixel, VImageDimension>
MyAccessMethod(itk::Image<TPixel, VImageDimension>* itkImage)
{
...
}

If you don't understand this template syntax, we need to refer you to an C++ text book. Understanding template syntax is crucial to successfully using ITK.

To call this templated method with an (untemplated) mitk::Image, you can use the AccessByItk macro (or one of its variants) from mitkImageAccessByItk.h. This macro checks for the actual image type of the mitk::Image and does any neccessary conversions. This works for all typical pixel types and for dimension 2 and 3.

AccessByItk(mitkImage, MyAccessMethod)

An example is given in Step6Page.

The AccessBy... macros create quite a lot of code: the user defined access method has to be compiled for all typical pixel types times the two supported dimensions (2 and 3). Therefore, depending on the complexity of the access method, some compilers may run into problems with memory. One workaround is to use explicit instantiation and distribute it on multiple files. The macros InstantiateAccessFunction... are for this purpose. An example is again given in Step6Page. Another workaround is to reduce the created code by fixing either the type (AccessFixedTypeByItk) or dimension (AccessFixedDimensionByItk).

There are variants for additional parameters for AccessByItk... and InstantiateAccessFunction..., e.g., AccessFixedTypeByItk_2 allows to pass two additional parameters to the access-function.

ITK to MITK adaptors

Converting ITK images to MITK is easier than the other way round. Basically, you have three options:

ITK image vs MITK coordinate systems

Converting coordinates from the ITK physical coordinate system (which does not support rotated images) to the MITK world coordinate system should be performed via the Geometry3D of the Image, see mitk::Geometry3D::WorldToItkPhysicalPoint.

Limitations

The MITK to ITK adaptors for unspecified types have to do type multiplexing at compile time. This is done for a limited number of pixel types (char, short, int, long, double, float, and the unsigned variants of the integer data types) and for dimensions 2 and 3.

Especially, color image types are not multiplexed. This is because many algorithms do not support color images (e.g. with data type itk::RGBPixel) because they do not have a scalar data type. If your algorithm do support color and you want to multiplex over all scalar as well as the color data type, try the following:

  if (myMitkImageThatMaybeColor->GetPixelType()==typeid(itk::RGBPixel<unsigned char>))
  {
    AccessFixedPixelTypeByItk(myMitkImageThatMaybeColor, myAlgorithmFunction, itk::RGBPixel<unsigned char>);
  }
  else
  {
    AccessByItk(myMitkImageThatMaybeColor, myAlgorithmFunction);
  }

Define Documentation

#define AccessByItk (   mitkImage,
  itkImageTypeFunction 
)
Value:
{                                                                                      \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                        \
  const mitk::Image* constImage = mitkImage;                                           \
  const_cast<mitk::Image*>(constImage)->Update();                                      \
  assert((mitkImage)->GetDimension()>=2 && (mitkImage)->GetDimension()<=3);            \
  if((mitkImage)->GetDimension()==2)                                                   \
  {                                                                                    \
    _accessAllTypesByItk(mitkImage, itkImageTypeFunction, 2);                          \
  }                                                                                    \
  else                                                                                 \
  {                                                                                    \
    _accessAllTypesByItk(mitkImage, itkImageTypeFunction, 3)                           \
  }                                                                                    \
}

Access an mitk-image by an itk-image.

Define a templated function or method (itkImageTypeFunction) within which the mitk-image (mitkImage) is accessed:

   template < typename TPixel, unsigned int VImageDimension > 
   void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage, TPixel* dummy = NULL );

Instantiate the function using

   InstantiateAccessFunction(ExampleFunction);

Within the itk::Image passed to the function/method has the same data-pointer as the mitk-image. So you have full read- and write- access to the data vector of the mitk-image using the itk-image. Call by:

   inputMitkImage being of type mitk::Image*
   AccessByItk(inputMitkImage, ExampleFunction);
Note:
If your inputMitkImage is an mitk::Image::Pointer, use inputMitkImage.GetPointer()
If you need to pass an additional parameter to your access-function (itkImageTypeFunction), use AccessByItk.
If you know the dimension of your input mitk-image, it is better to use AccessFixedDimensionByItk (less code is generated).
See also:
AccessFixedDimensionByItk
AccessFixedTypeByItk
AccessFixedPixelTypeByItk
AccessByItk_1
AccessByItk_2

Definition at line 96 of file mitkImageAccessByItk.h.

Referenced by mitk::SeedsImage::ClearBuffer(), mitk::SeedsImage::ExecuteOperation(), mitk::SymmetricForcesDemonsRegistration::GenerateData(), mitk::MaskImageFilter::GenerateData(), mitk::HistogramMatching::GenerateData(), mitk::DemonsRegistration::GenerateData(), mitk::BSplineRegistration::GenerateData(), QmitkNormalizedMutualInformationHistogramMetricView::GetMetric(), QmitkNormalizedCorrelationMetricView::GetMetric(), QmitkMutualInformationMetricView::GetMetric(), QmitkMutualInformationHistogramMetricView::GetMetric(), QmitkMeanSquaresMetricView::GetMetric(), QmitkMeanSquaresHistogramMetricView::GetMetric(), QmitkMeanReciprocalSquareDifferenceMetricView::GetMetric(), QmitkMattesMutualInformationMetricView::GetMetric(), QmitkMatchCardinalityMetricView::GetMetric(), QmitkKullbackLeiblerCompareHistogramMetricView::GetMetric(), QmitkKappaStatisticMetricView::GetMetric(), QmitkGradientDifferenceMetricView::GetMetric(), QmitkCorrelationCoefficientHistogramMetricView::GetMetric(), QmitkVersorTransformView::GetTransform(), QmitkVersorRigid3DTransformView::GetTransform(), QmitkTranslationTransformView::GetTransform(), QmitkSimilarity3DTransformView::GetTransform(), QmitkSimilarity2DTransformView::GetTransform(), QmitkScaleTransformView::GetTransform(), QmitkScaleSkewVersor3DTransformView::GetTransform(), QmitkScaleLogarithmicTransformView::GetTransform(), QmitkRigid3DTransformView::GetTransform(), QmitkRigid2DTransformView::GetTransform(), QmitkQuaternionRigidTransformView::GetTransform(), QmitkFixedCenterOfRotationAffineTransformView::GetTransform(), QmitkEuler3DTransformView::GetTransform(), QmitkEuler2DTransformView::GetTransform(), QmitkCenteredSimilarity2DTransformView::GetTransform(), QmitkCenteredRigid2DTransformView::GetTransform(), QmitkCenteredEuler3DTransformView::GetTransform(), and QmitkAffineTransformView::GetTransform().

#define AccessByItk_1 (   mitkImage,
  itkImageTypeFunction,
  param1 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
    _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, 2, param1);                          \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
    _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, 3, param1)                           \
  }                                                                                              \
}

Access an mitk-image by an itk-image and pass one additional parameter to the access-function.

For usage, see AccessByItk. The only difference to AccessByItk is that an additional parameter (param1) is passed.

Note:
If you know the dimension of your input mitk-image, it is better to use AccessFixedDimensionByItk_1 (less code is generated).
See also:
AccessByItk
AccessFixedDimensionByItk_1
AccessFixedTypeByItk_1
AccessFixedPixelTypeByItk_1
Examples:
Step6.cpp.

Definition at line 231 of file mitkImageAccessByItk.h.

Referenced by QmitkImageCropper::CropImage(), Step6::StartRegionGrowing(), and mitk::ImageWriter::WriteByITK().

#define AccessByItk_2 (   mitkImage,
  itkImageTypeFunction,
  param1,
  param2 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
    _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, 2, param1, param2);                  \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
    _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, 3, param1, param2)                   \
  }                                                                                              \
}

Access an mitk-image by an itk-image and pass two additional parameters to the access-function.

For usage, see AccessByItk. The only difference to AccessByItk is that two additional parameters (param1, param2) are passed.

Note:
If you know the dimension of your input mitk-image, it is better to use AccessFixedDimensionByItk_2 (less code is generated).
See also:
AccessByItk
AccessFixedDimensionByItk_2
AccessFixedTypeByItk_2
AccessFixedPixelTypeByItk_2

Definition at line 373 of file mitkImageAccessByItk.h.

Referenced by mitk::HistogramGenerator::ComputeHistogram(), mitk::Image::ComputeImageStatistics(), QmitkRegionGrowingView::DoImageProcessing(), mitk::PlaneCutFilter::GenerateData(), and mitk::GeometryClipImageFilter::GenerateData().

#define AccessByItk_3 (   mitkImage,
  itkImageTypeFunction,
  param1,
  param2,
  param3 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
  _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, 2, param1, param2, param3);            \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
  _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, 3, param1, param2, param3)             \
  }                                                                                              \
}

Access an mitk-image by an itk-image and pass three additional parameters to the access-function.

For usage, see AccessByItk. The only difference to AccessByItk is that two additional parameters (param1, param2) are passed.

Note:
If you know the dimension of your input mitk-image, it is better to use AccessFixedDimensionByItk_3 (less code is generated).
See also:
AccessByItk
AccessFixedDimensionByItk_3
AccessFixedPixelTypeByItk_3

Definition at line 556 of file mitkImageAccessByItk.h.

#define AccessFixedDimensionByItk (   mitkImage,
  itkImageTypeFunction,
  dimension 
)
Value:
{                                                                                      \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                        \
  const mitk::Image* constImage = mitkImage;                                           \
  const_cast<mitk::Image*>(constImage)->Update();                                      \
  assert((mitkImage)->GetDimension()==dimension);                                      \
  _accessAllTypesByItk(mitkImage, itkImageTypeFunction, dimension)                     \
}

Access an mitk-image with known dimension by an itk-image.

For usage, see AccessByItk.

Parameters:
dimensiondimension of the mitk-image.

If the image has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk.

See also:
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk
AccessFixedPixelTypeByItk

Definition at line 126 of file mitkImageAccessByItk.h.

Referenced by CompareImageSliceTestHelper::CompareSlice(), mitk::VolumeCalculator::ComputeVolume(), mitk::DiffImageApplier::ExecuteOperation(), mitk::OverwriteSliceImageFilter::GenerateData(), and mitk::ExtractImageFilter::GenerateData().

#define AccessFixedDimensionByItk_1 (   mitkImage,
  itkImageTypeFunction,
  dimension,
  param1 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()==dimension);                                                  \
  _accessAllTypesByItk_1(mitkImage, itkImageTypeFunction, dimension, param1)                     \
}

Access an mitk-image with known dimension by an itk-image and pass one additional parameter to the access-function.

For usage, see AccessByItk_1 and AccessByItk.

Parameters:
dimensiondimension of the mitk-image.

If the image has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk_1.

See also:
AccessByItk_2
AccessByItk
AccessFixedDimensionByItk_1
AccessFixedTypeByItk_1
AccessFixedPixelTypeByItk_1

Definition at line 263 of file mitkImageAccessByItk.h.

Referenced by mitk::CorrectorAlgorithm::CalculateDifferenceImage(), mitk::AutoCropImageFilter::GenerateData(), mitk::LabeledImageToSurfaceFilter::GetAvailableLabels(), mitk::SegmentationInterpolationController::SetChangedSlice(), and mitk::SegmentationInterpolationController::SetChangedVolume().

#define AccessFixedDimensionByItk_2 (   mitkImage,
  itkImageTypeFunction,
  dimension,
  param1,
  param2 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()==dimension);                                                  \
  _accessAllTypesByItk_2(mitkImage, itkImageTypeFunction, dimension, param1, param2)             \
}

Access an mitk-image with known dimension by an itk-image and pass two additional parameters to the access-function.

For usage, see AccessByItk_2 and AccessByItk.

Parameters:
dimensiondimension of the mitk-image.

If the image has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk_2.

See also:
AccessByItk_2
AccessByItk
AccessFixedDimensionByItk_2
AccessFixedTypeByItk_2
AccessFixedPixelTypeByItk_2

Definition at line 405 of file mitkImageAccessByItk.h.

Referenced by mitk::BoundingObjectCutAndCast< TPixel >::ComputeData(), mitk::BinaryThresholdULTool::CreateNewSegmentationFromThreshold(), mitk::BinaryThresholdTool::CreateNewSegmentationFromThreshold(), QmitkThresholdComponent::CreateThresholdSegmentation(), mitk::ContourUtils::FillContourInSlice(), mitk::BoundingObjectCutter::GenerateData(), mitkPicFileIOTest(), mitk::CalculateGrayValueStatisticsTool::ProcessOneWorkingData(), and mitk::SegmentationInterpolationController::SetSegmentationVolume().

#define AccessFixedDimensionByItk_3 (   mitkImage,
  itkImageTypeFunction,
  dimension,
  param1,
  param2,
  param3 
)
Value:
{                                                                                                        \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()==dimension);                                                  \
  _accessAllTypesByItk_3(mitkImage, itkImageTypeFunction, dimension, param1, param2, param3)     \
}

Access an mitk-image with known dimension by an itk-image and pass three additional parameters to the access-function.

For usage, see AccessByItk_3 and AccessByItk.

Parameters:
dimensiondimension of the mitk-image.

If the image has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk_3.

See also:
AccessByItk_3
AccessByItk
AccessFixedDimensionByItk_3
AccessFixedTypeByItk_3
AccessFixedPixelTypeByItk_3

Definition at line 588 of file mitkImageAccessByItk.h.

#define AccessFixedPixelTypeByItk (   mitkImage,
  itkImageTypeFunction,
  pixeltype 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert((mitkImage)->GetDimension()>=2 && (mitkImage)->GetDimension()<=3);                      \
  if((mitkImage)->GetDimension()==2)                                                             \
  {                                                                                              \
    _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, 2) else                             \
    _accessByItkWarning                                                                          \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
    _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, 3) else                             \
    _accessByItkWarning                                                                          \
  }                                                                                              \
}

Access an mitk-image with known pixeltype (but unknown dimension) by an itk-image and pass two additional parameters to the access-function.

For usage, see AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.

If the image has a different pixel type, an exception is thrown (by assert). If you do not know the pixel type for sure, use AccessByItk.

See also:
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk
AccessFixedPixelTypeByItk

Definition at line 173 of file mitkImageAccessByItk.h.

#define AccessFixedPixelTypeByItk_1 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  param1 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
    _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, 2, param1) else                   \
    _accessByItkWarning                                                                          \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
    _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, 3, param1) else                   \
    _accessByItkWarning                                                                          \
  }                                                                                              \
}

Access an mitk-image with known pixeltype (but unknown dimension) by an itk-image and pass one additional parameters to the access-function.

For usage, see AccessByItk_1 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.

If the image has a different pixel type, an exception is thrown (by assert). If you do not know the pixel type for sure, use AccessByItk_2.

See also:
AccessByItk_1
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk_1
AccessFixedPixelTypeByItk_1

Definition at line 315 of file mitkImageAccessByItk.h.

#define AccessFixedPixelTypeByItk_2 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  param1,
  param2 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
    _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, 2, param1, param2) else           \
    _accessByItkWarning                                                                          \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
    _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, 3, param1, param2) else           \
    _accessByItkWarning                                                                          \
  }                                                                                              \
}

Access an mitk-image with known pixel type (but unknown dimension) by an itk-image and pass two additional parameters to the access-function.

For usage, see AccessByItk_2 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.

If the image has a different pixel type, an exception is thrown (by assert). If you do not know the pixel type for sure, use AccessByItk_2.

See also:
AccessByItk_2
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk_2
AccessFixedPixelTypeByItk_2

Definition at line 457 of file mitkImageAccessByItk.h.

Referenced by mitk::RGBToRGBACastImageFilter::GenerateData().

#define AccessFixedPixelTypeByItk_3 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  param1,
  param2,
  param3 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()>=2 && mitkImage->GetDimension()<=3);                          \
  if(mitkImage->GetDimension()==2)                                                               \
  {                                                                                              \
  _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, 2, param1, param2, param3) else     \
  _accessByItkWarning                                                                            \
  }                                                                                              \
  else                                                                                           \
  {                                                                                              \
  _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, 3, param1, param2, param3) else     \
  _accessByItkWarning                                                                            \
  }                                                                                              \
}

Access an mitk-image with known pixel type (but unknown dimension) by an itk-image and pass three additional parameters to the access-function.

For usage, see AccessByItk_3 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.

If the image has a different pixel type, an exception is thrown (by assert). If you do not know the pixel type for sure, use AccessByItk_3.

See also:
AccessByItk_3
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk_3
AccessFixedPixelTypeByItk_3

Definition at line 639 of file mitkImageAccessByItk.h.

#define AccessFixedTypeByItk (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  dimension 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
   const mitk::Image* constImage = mitkImage;                                                    \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert((mitkImage)->GetDimension()==dimension);                                                \
  _accessByItk(mitkImage, itkImageTypeFunction, pixeltype, dimension) else                       \
  _accessByItkWarning                                                                            \
}

Access an mitk-image with known type (pixel type and dimension) by an itk-image.

For usage, see AccessByItk.

Parameters:
dimensiondimension of the mitk-image. If the image has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk.
See also:
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk
AccessFixedPixelTypeByItk

Definition at line 148 of file mitkImageAccessByItk.h.

#define AccessFixedTypeByItk_1 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  dimension,
  param1 
)
Value:
{                                                                                                \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                  \
  const mitk::Image* constImage = mitkImage;                                                     \
  const_cast<mitk::Image*>(constImage)->Update();                                                \
  assert(mitkImage->GetDimension()==dimension);                                                  \
  _accessByItk_1(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1) else             \
  _accessByItkWarning                                                                            \
}

Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass one additional parameters to the access-function.

For usage, see AccessByItk_1 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.
dimensiondimension of the mitk-image.

If the image has a different pixel type or dimension, an exception is thrown (by assert). If you do not know the pixel type and dimension for sure, use AccessByItk_1.

See also:
AccessByItk_1
AccessByItk
AccessFixedDimensionByItk_1
AccessFixedTypeByItk_1
AccessFixedPixelTypeByItk_1

Definition at line 289 of file mitkImageAccessByItk.h.

Referenced by mitk::CastToItkImage< itkImageDTID2 >(), mitk::CastToItkImage< itkImageDTID3 >(), mitk::CastToItkImage< itkImageDTIF2 >(), mitk::CastToItkImage< itkImageDTIF3 >(), mitk::CastToItkImage< itkImageRGBUC2 >(), mitk::CastToItkImage< itkImageRGBUC3 >(), and mitk::ImageToOpenCVImageFilter::GetOpenCVImage().

#define AccessFixedTypeByItk_2 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  dimension,
  param1,
  param2 
)
Value:
{                                                                                                      \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                        \
  const mitk::Image* constImage = mitkImage;                                                           \
  const_cast<mitk::Image*>(constImage)->Update();                                                      \
  assert(mitkImage->GetDimension()==dimension);                                                        \
  _accessByItk_2(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2) else           \
  _accessByItkWarning                                                                                  \
}

Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass two additional parameters to the access-function.

For usage, see AccessByItk_2 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.
dimensiondimension of the mitk-image.

If the image has a different pixel type or dimension, an exception is thrown (by assert). If you do not know the pixel type and dimension for sure, use AccessByItk_2.

See also:
AccessByItk_2
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk_2
AccessFixedPixelTypeByItk_2

Definition at line 431 of file mitkImageAccessByItk.h.

#define AccessFixedTypeByItk_3 (   mitkImage,
  itkImageTypeFunction,
  pixeltype,
  dimension,
  param1,
  param2,
  param3 
)
Value:
{                                                                                                      \
  const mitk::PixelType& pixelType = mitkImage->GetPixelType();                                        \
  const mitk::Image* constImage = mitkImage;                                                           \
  const_cast<mitk::Image*>(constImage)->Update();                                                      \
  assert(mitkImage->GetDimension()==dimension);                                                        \
  _accessByItk_3(mitkImage, itkImageTypeFunction, pixeltype, dimension, param1, param2, param3) else   \
  _accessByItkWarning                                                                                  \
}

Access an mitk-image with known type (pixel type and dimension) by an itk-image and pass three additional parameters to the access-function.

For usage, see AccessByItk_3 and AccessByItk.

Parameters:
pixeltypepixel type of the mitk-image.
dimensiondimension of the mitk-image.

If the image has a different pixel type or dimension, an exception is thrown (by assert). If you do not know the pixel type and dimension for sure, use AccessByItk_3.

See also:
AccessByItk_3
AccessByItk
AccessFixedDimensionByItk
AccessFixedPixelTypeByItk_3

Definition at line 613 of file mitkImageAccessByItk.h.

#define AccessTwoImagesFixedDimensionByItk (   mitkImage1,
  mitkImage2,
  itkImageTypeFunction,
  dimension 
)
Value:
{                                                                                                    \
  const mitk::PixelType& pixelType1 = mitkImage1->GetPixelType();                                    \
  const mitk::PixelType& pixelType2 = mitkImage2->GetPixelType();                                    \
  const mitk::Image* constImage1 = mitkImage1;                                                       \
  const mitk::Image* constImage2 = mitkImage2;                                                       \
  const_cast<mitk::Image*>(constImage1)->Update();                                                   \
  const_cast<mitk::Image*>(constImage2)->Update();                                                   \
  assert((mitkImage1)->GetDimension()==dimension);                                                   \
  assert((mitkImage2)->GetDimension()==dimension);                                                   \
  _accessTwoImagesAllTypesByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension)             \
}

Access two mitk-images with known dimension by itk-images.

For usage, see AccessByItk.

Parameters:
dimensiondimension of the mitk-image.

If one of the images has a different dimension, an exception is thrown (by assert). If you do not know the dimension for sure, use AccessByItk.

See also:
AccessByItk
AccessFixedDimensionByItk
AccessFixedTypeByItk
AccessFixedPixelTypeByItk

Definition at line 673 of file mitkImageAccessByItk.h.

#define InstantiateAccessFunction (   itkImgFunc )
Value:

Instantiate access function without additional parammeters for all datatypes and dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file. The CMake macro MITK_MULTIPLEX_PICTYPE can help you with that. See mitk/CMake/CoreHelpers.cmake for documentation.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunction_1
InstantiateAccessFunction_2

Definition at line 49 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunction_1 (   itkImgFunc,
  param1Type 
)
Value:

Instantiate access function with one additional parammeter for all datatypes and dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunction
InstantiateAccessFunction_2

Definition at line 67 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunction_2 (   itkImgFunc,
  param1Type,
  param2Type 
)
Value:
InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, 2, param1Type, param2Type)  \
  InstantiateAccessFunctionForFixedDimension_2(itkImgFunc, 3, param1Type, param2Type)

Instantiate access function with two additional parammeters for all datatypes and dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

See also:
InstantiateAccessFunction
InstantiateAccessFunction_1

Definition at line 81 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedDimension (   itkImgFunc,
  dimension 
)
Value:
template void itkImgFunc<double,  dimension>(itk::Image<double, dimension>*);                   \
template void itkImgFunc<float,  dimension>(itk::Image<float, dimension>*);                     \
template void itkImgFunc<int,  dimension>(itk::Image<int, dimension>*);                         \
template void itkImgFunc<unsigned int,  dimension>(itk::Image<unsigned int, dimension>*);       \
template void itkImgFunc<short,  dimension>(itk::Image<short, dimension>*);                     \
template void itkImgFunc<unsigned short,  dimension>(itk::Image<unsigned short, dimension>*);   \
template void itkImgFunc<char,  dimension>(itk::Image<char, dimension>*);                       \
template void itkImgFunc<unsigned char,  dimension>(itk::Image<unsigned char, dimension>*);

Instantiate access function without additional parammeters for all datatypes, but fixed dimension.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedDimension_1
InstantiateAccessFunctionForFixedDimension_2

Definition at line 99 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedDimension_1 (   itkImgFunc,
  dimension,
  param1Type 
)
Value:
template void itkImgFunc<double,  dimension>(itk::Image<double, dimension>*, param1Type);                 \
template void itkImgFunc<float,  dimension>(itk::Image<float, dimension>*, param1Type);                   \
template void itkImgFunc<int,  dimension>(itk::Image<int, dimension>*, param1Type);                       \
template void itkImgFunc<unsigned int,  dimension>(itk::Image<unsigned int, dimension>*, param1Type);     \
template void itkImgFunc<short,  dimension>(itk::Image<short, dimension>*, param1Type);                   \
template void itkImgFunc<unsigned short,  dimension>(itk::Image<unsigned short, dimension>*, param1Type); \
template void itkImgFunc<char,  dimension>(itk::Image<char, dimension>*, param1Type);                     \
template void itkImgFunc<unsigned char,  dimension>(itk::Image<unsigned char, dimension>*, param1Type);

Instantiate access function with one additional parammeter for all datatypes, but fixed dimension.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedDimension
InstantiateAccessFunctionForFixedDimension_2
Examples:
Step6RegionGrowing1.cpp, and Step6RegionGrowing2.cpp.

Definition at line 123 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedDimension_2 (   itkImgFunc,
  dimension,
  param1Type,
  param2Type 
)
Value:
template void itkImgFunc<double,  dimension>(itk::Image<double, dimension>*, param1Type, param2Type);                 \
template void itkImgFunc<float,  dimension>(itk::Image<float, dimension>*, param1Type, param2Type);                   \
template void itkImgFunc<int,  dimension>(itk::Image<int, dimension>*, param1Type, param2Type);                       \
template void itkImgFunc<unsigned int,  dimension>(itk::Image<unsigned int, dimension>*, param1Type, param2Type);     \
template void itkImgFunc<short,  dimension>(itk::Image<short, dimension>*, param1Type, param2Type);                   \
template void itkImgFunc<unsigned short,  dimension>(itk::Image<unsigned short, dimension>*, param1Type, param2Type); \
template void itkImgFunc<char,  dimension>(itk::Image<char, dimension>*, param1Type, param2Type);                     \
template void itkImgFunc<unsigned char,  dimension>(itk::Image<unsigned char, dimension>*, param1Type, param2Type);

Instantiate access function with two additional parammeters for all datatypes, but fixed dimension.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedDimension
InstantiateAccessFunctionForFixedDimension_1

Definition at line 147 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedPixelType (   itkImgFunc,
  pixelType 
)
Value:
template void itkImgFunc<pixelType,  2>(itk::Image<pixelType, 2>*);                                \
template void itkImgFunc<pixelType,  3>(itk::Image<pixelType, 3>*);

Instantiate access function without additional parammeters for a fixed datatype, but all dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedPixelType_1
InstantiateAccessFunctionForFixedPixelType_2

Definition at line 171 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedPixelType_1 (   itkImgFunc,
  pixelType,
  param1Type 
)
Value:
template void itkImgFunc<pixelType,  2>(itk::Image<pixelType, 2>*, param1Type);                    \
template void itkImgFunc<pixelType,  3>(itk::Image<pixelType, 3>*, param1Type);

Instantiate access function with one additional parammeter for a fixed datatype, but all dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedPixelType
InstantiateAccessFunctionForFixedPixelType_2

Definition at line 189 of file mitkInstantiateAccessFunctions.h.

#define InstantiateAccessFunctionForFixedPixelType_2 (   itkImgFunc,
  pixelType,
  param1Type,
  param2Type 
)
Value:
template void itkImgFunc<pixelType,  2>(itk::Image<pixelType, 2>*, param1Type, param2Type);        \
template void itkImgFunc<pixelType,  3>(itk::Image<pixelType, 3>*, param1Type, param2Type);

Instantiate access function with two additional parammeters for a fixed datatype, but all dimensions.

Use this macro once after the definition of your access function. Some compilers have memory problems without the explicit instantiation. You may need to move the access function to a separate file.

Note:
If you experience compiler errors, try to include mitkAltInstantiateAccessFunctions.h and add "Alt" (for alternate) before the call (e.g. AltInstantiateAccessFunction(...)).
See also:
InstantiateAccessFunctionForFixedPixelType
InstantiateAccessFunctionForFixedPixelType_1

Definition at line 207 of file mitkInstantiateAccessFunctions.h.


Function Documentation

template<typename ItkOutputImageType >
void MITK_CORE_EXPORT mitk::CastToItkImage ( const mitk::Image mitkImage,
itk::SmartPointer< ItkOutputImageType > &  itkOutputImage 
)

Cast an mitk::Image to an itk::Image with a specific type. You don't have to initialize the itk::Image<..>Pointer.

Referenced by QmitkDeformableRegistrationView::ApplyDeformationField(), mitk::OpeningTool::ApplyFilter(), mitk::ErodeTool::ApplyFilter(), mitk::DilateTool::ApplyFilter(), mitk::ClosingTool::ApplyFilter(), CommonFunctionality::AutoLevelWindow(), QmitkPointBasedRegistrationView::calculateLandmarkWarping(), mitk::CalculateGrayValueStatisticsTool::CalculateMinMax(), mitk::AutoCropImageFilter::ComputeNewImageBounds(), mitk::PadImageFilter::GenerateData(), mitk::NrrdTensorImageWriter::GenerateData(), mitk::NrrdQBallImageWriter::GenerateData(), mitk::ItkImageToImageFilterAdapter< TPixel >::GenerateData(), mitk::CorrectorAlgorithm::GenerateData(), mitk::BoundingObjectToSegmentationFilter::GenerateData(), mitk::SymmetricForcesDemonsRegistration::GenerateData2(), mitk::PyramidalRegistrationMethod::GenerateData2(), mitk::ImageRegistrationMethod::GenerateData2(), mitk::HistogramMatching::GenerateData2(), mitk::DemonsRegistration::GenerateData2(), QmitkSegmentationPostProcessing::IncreaseCroppedImageSize(), QmitkAutocropAction::IncreaseCroppedImageSize(), mitk::ShapeBasedInterpolationAlgorithm::Interpolate(), mitk::CorrectorAlgorithm::ItkCalculateDifferenceImage(), mitk::ContourUtils::ItkCopyFilledContourToSlice(), mitk::CalculateGrayValueStatisticsTool::ITKHistogramming(), ItkImageProcessing(), mitk::OverwriteSliceImageFilter::ItkImageProcessing(), mitk::BinaryThresholdULTool::ITKThresholding(), mitk::BinaryThresholdTool::ITKThresholding(), main(), mitkImageTest(), mitkImageToItkTest(), mitk::SetRegionTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressed(), mitk::MorphologicTool::OnRoiDataChanged(), mitk::BinaryThresholdULTool::OnRoiDataChanged(), mitk::BinaryThresholdTool::OnRoiDataChanged(), QmitkDataManagerView::OtsuFilter(), QmitkTbssView::OutputUnconnectedPointValues(), QmitkTbssView::OutputValues(), mitk::VolumeVisualizationImagePreprocessor::Process(), QmitkBasicImageProcessing::StartButton2Clicked(), QmitkBasicImageProcessing::StartButtonClicked(), mitk::PaintbrushTool::UpdateContour(), and mitk::BinaryThresholdULTool::UpdatePreview().

template<typename ItkOutputImageType >
void mitk::CastToMitkImage ( const ItkOutputImageType *  itkimage,
itk::SmartPointer< mitk::Image > &  mitkoutputimage 
)

Cast an itk::Image (with a specific type) to an mitk::Image.

CastToMitkImage does not cast pixel types etc., just image data Needs "mitkImage.h" header included. If you get a compile error, try image.GetPointer();

See also:
mitkITKImageImport

Definition at line 645 of file mitkImage.h.

References mitk::Image::New().

{
  if(mitkoutputimage.IsNull())
  {
    mitkoutputimage = mitk::Image::New();
  }
  mitkoutputimage->InitializeByItk(itkimage);
  mitkoutputimage->SetChannel(itkimage->GetBufferPointer());
}
template<typename ItkOutputImageType >
void mitk::CastToMitkImage ( const itk::SmartPointer< ItkOutputImageType > &  itkimage,
itk::SmartPointer< mitk::Image > &  mitkoutputimage 
)

Cast an itk::Image (with a specific type) to an mitk::Image.

CastToMitkImage does not cast pixel types etc., just image data Needs "mitkImage.h" header included. If you get a compile error, try image.GetPointer();

See also:
mitkITKImageImport
Examples:
Step6RegionGrowing.txx.

Definition at line 626 of file mitkImage.h.

References mitk::Image::New().

Referenced by QmitkDeformableRegistrationView::ApplyDeformationField(), mitk::OpeningTool::ApplyFilter(), mitk::ErodeTool::ApplyFilter(), mitk::DilateTool::ApplyFilter(), mitk::ClosingTool::ApplyFilter(), QmitkPointBasedRegistrationView::calculateLandmarkWarping(), mitk::PadImageFilter::GenerateData(), mitk::ItkImageToImageFilterAdapter< TPixel >::GenerateData(), mitk::CorrectorAlgorithm::GenerateData(), mitk::BoundingObjectToSegmentationFilter::GenerateData(), mitk::SymmetricForcesDemonsRegistration::GenerateData2(), mitk::HistogramMatching::GenerateData2(), mitk::DemonsRegistration::GenerateData2(), QmitkSegmentationPostProcessing::IncreaseCroppedImageSize(), QmitkAutocropAction::IncreaseCroppedImageSize(), mitk::ShapeBasedInterpolationAlgorithm::Interpolate(), mitk::AutoCropImageFilter::ITKCrop3DImage(), main(), mitk::SetRegionTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressed(), mitk::MorphologicTool::OnRoiDataChanged(), mitk::BinaryThresholdULTool::OnRoiDataChanged(), mitk::BinaryThresholdTool::OnRoiDataChanged(), mitk::VolumeVisualizationImagePreprocessor::Process(), RegionGrowing(), testBackCasting(), mitk::RawImageFileReader::TypedGenerateData(), mitk::PaintbrushTool::UpdateContour(), and mitk::BinaryThresholdULTool::UpdatePreview().

{
  if(mitkoutputimage.IsNull())
  {
    mitkoutputimage = mitk::Image::New();
  }
  mitkoutputimage->InitializeByItk(itkimage.GetPointer());
  mitkoutputimage->SetChannel(itkimage->GetBufferPointer());
}
template<typename ItkOutputImageType >
mitk::Image::Pointer mitk::GrabItkImageMemory ( ItkOutputImageType *  itkimage,
mitk::Image mitkImage = NULL,
const Geometry3D *  geometry = NULL,
bool  update = true 
)

Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.

Parameters:
update,:if true, fill mitk::Image, which will execute the up-stream pipeline connected to the input itk::Image. Otherwise you need to make sure that Update() is called on the mitk::Image before its data is being used, e.g., by connecting it to an mitk-pipeline and call Update of a downstream filter at some time.
See also:
ImportItkImage

Definition at line 153 of file mitkITKImageImport.txx.

References mitk::Geometry3D::Clone(), and mitk::Image::New().

{
  if(update)
    itkimage->Update();

  mitk::Image::Pointer resultImage;
  if(mitkImage != NULL)
  {
    resultImage = mitkImage;
  }
  else
  {
    resultImage = mitk::Image::New();
  }
  resultImage->InitializeByItk( itkimage );
  resultImage->SetImportVolume( itkimage->GetBufferPointer(), 0, 0,
    Image::ManageMemory );
  itkimage->GetPixelContainer()->ContainerManageMemoryOff();

  if(geometry != NULL)
    resultImage->SetGeometry(static_cast<mitk::Geometry3D*>(geometry->Clone().GetPointer()));

  return resultImage;
}
template<typename ItkOutputImageType >
mitk::Image::Pointer mitk::GrabItkImageMemory ( itk::SmartPointer< ItkOutputImageType > &  itkimage,
mitk::Image mitkImage = NULL,
const Geometry3D *  geometry = NULL,
bool  update = true 
)

Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.

Parameters:
update,:if true, fill mitk::Image, which will execute the up-stream pipeline connected to the input itk::Image. Otherwise you need to make sure that Update() is called on the mitk::Image before its data is being used, e.g., by connecting it to an mitk-pipeline and call Update of a downstream filter at some time.
See also:
ImportItkImage

Definition at line 147 of file mitkITKImageImport.txx.

Referenced by mitk::ExtractImageFilter::ItkImageProcessing().

{
  return GrabItkImageMemory( itkimage.GetPointer(), mitkImage, geometry, update );
}
template<typename ItkOutputImageType >
mitk::Image::Pointer mitk::ImportItkImage ( const ItkOutputImageType *  itkimage,
const Geometry3D *  geometry = NULL,
bool  update = true 
)

Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImport mitk::ITKImageImport does not cast pixel types etc., it just imports image data. If you get a compile error, try image.GetPointer().

Parameters:
update,:if true, fill mitk::Image, which will execute the up-stream pipeline connected to the input itk::Image. Otherwise you need to make sure that Update() is called on the mitk::Image before its data is being used, e.g., by connecting it to an mitk-pipeline and call Update of a downstream filter at some time.
See also:
itk::Image::CastToMitkImage
GrabItkImageMemory

Definition at line 136 of file mitkITKImageImport.txx.

References mitk::ImageSource::GetOutput(), mitk::ITKImageImport< TInputImage >::New(), mitk::ITKImageImport< TInputImage >::SetGeometry(), and mitk::ITKImageImport< TInputImage >::SetInput().

{
  typename mitk::ITKImageImport<ItkOutputImageType>::Pointer importer = mitk::ITKImageImport<ItkOutputImageType>::New();
  importer->SetInput(itkimage);
  importer->SetGeometry(geometry);
  if(update)
    importer->Update();
  return importer->GetOutput();
}
template<typename ItkOutputImageType >
mitk::Image::Pointer mitk::ImportItkImage ( const itk::SmartPointer< ItkOutputImageType > &  itkimage,
const Geometry3D *  geometry = NULL,
bool  update = true 
)

Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImport. mitk::ITKImageImport does not cast pixel types etc., it just imports image data. If you get a compile error, try image.GetPointer().

Parameters:
update,:if true, fill mitk::Image, which will execute the up-stream pipeline connected to the input itk::Image. Otherwise you need to make sure that Update() is called on the mitk::Image before its data is being used, e.g., by connecting it to an mitk-pipeline and call Update of a downstream filter at some time.
See also:
itk::Image::CastToMitkImage

Definition at line 125 of file mitkITKImageImport.txx.

References mitk::ImageSource::GetOutput(), mitk::ITKImageImport< TInputImage >::New(), mitk::ITKImageImport< TInputImage >::SetGeometry(), and mitk::ITKImageImport< TInputImage >::SetInput().

Referenced by QmitkImageCropper::AddSurrounding(), QmitkDemonsRegistrationView::CalculateTransformation(), mitk::OpenCVToMitkImageFilter::ConvertIplToMitkImage(), QmitkRegionGrowingView::ItkImageProcessing(), mitkImageToOpenCVImageFilterTest(), QmitkDataManagerView::OtsuFilter(), mitk::NonBlockingAlgorithm::SetItkImageAsMITKImagePointerParameter(), QmitkBasicImageProcessing::StartButton2Clicked(), QmitkBasicImageProcessing::StartButtonClicked(), and testBackCasting().

{
  typename mitk::ITKImageImport<ItkOutputImageType>::Pointer importer = mitk::ITKImageImport<ItkOutputImageType>::New();
  importer->SetInput(itkimage);
  importer->SetGeometry(geometry);
  if(update)
    importer->Update();
  return importer->GetOutput();
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines