Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::ImageToOpenCVImageFilter Class Reference

A pseudo-Filter for creating OpenCV images from MITK images with the option of copying data or referencing it. More...

#include <mitkImageToOpenCVImageFilter.h>

Inheritance diagram for mitk::ImageToOpenCVImageFilter:
Collaboration diagram for mitk::ImageToOpenCVImageFilter:

Public Types

typedef itk::RGBPixel< unsigned char > UCRGBPixelType
 
typedef itk::RGBPixel< unsigned short > USRGBPixelType
 
typedef itk::RGBPixel< float > FloatRGBPixelType
 
typedef itk::RGBPixel< double > DoubleRGBPixelType
 

Public Member Functions

 mitkClassMacroItkParent (ImageToOpenCVImageFilter, itk::Object)
 
Pointer Clone () const
 
void SetImage (mitk::Image *_Image)
 set the input MITK image More...
 
virtual mitk::ImageGetImage ()
 get the input MITK image More...
 
bool CheckImage (mitk::Image *image)
 get the input MITK image More...
 
IplImage * GetOpenCVImage ()
 
cv::Mat GetOpenCVMat ()
 
void SetInputFromTimeSlice (Image::Pointer mitkImage, int timeStep, int slice)
 Convenient method to set a certain slice of a 3D or 4D mitk::Image as input to convert it to an openCV image. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

template<typename TPixel , unsigned int VImageDimension>
void ItkImageProcessing (itk::Image< TPixel, VImageDimension > *image)
 
 ImageToOpenCVImageFilter ()
 
 ~ImageToOpenCVImageFilter ()
 

Protected Attributes

mitk::WeakPointer< mitk::Imagem_Image
 
IplImage * m_OpenCVImage
 

Detailed Description

A pseudo-Filter for creating OpenCV images from MITK images with the option of copying data or referencing it.

Definition at line 34 of file mitkImageToOpenCVImageFilter.h.

Member Typedef Documentation

typedef itk::RGBPixel< double > mitk::ImageToOpenCVImageFilter::DoubleRGBPixelType

Definition at line 40 of file mitkImageToOpenCVImageFilter.h.

typedef itk::RGBPixel< float > mitk::ImageToOpenCVImageFilter::FloatRGBPixelType

Definition at line 39 of file mitkImageToOpenCVImageFilter.h.

typedef itk::RGBPixel< unsigned char > mitk::ImageToOpenCVImageFilter::UCRGBPixelType

Definition at line 37 of file mitkImageToOpenCVImageFilter.h.

typedef itk::RGBPixel< unsigned short > mitk::ImageToOpenCVImageFilter::USRGBPixelType

Definition at line 38 of file mitkImageToOpenCVImageFilter.h.

Constructor & Destructor Documentation

mitk::ImageToOpenCVImageFilter::ImageToOpenCVImageFilter ( )
protected

Definition at line 25 of file mitkImageToOpenCVImageFilter.cpp.

References mitk::ImageSliceSelector::New().

mitk::ImageToOpenCVImageFilter::~ImageToOpenCVImageFilter ( )
protected

Definition at line 31 of file mitkImageToOpenCVImageFilter.cpp.

References m_OpenCVImage.

Member Function Documentation

bool mitk::ImageToOpenCVImageFilter::CheckImage ( mitk::Image image)

get the input MITK image

Definition at line 43 of file mitkImageToOpenCVImageFilter.cpp.

References mitk::Image::GetDimension(), and MITK_WARN.

Referenced by GetOpenCVImage().

Pointer mitk::ImageToOpenCVImageFilter::Clone ( ) const
virtual mitk::Image* mitk::ImageToOpenCVImageFilter::GetImage ( )
virtual

get the input MITK image

IplImage * mitk::ImageToOpenCVImageFilter::GetOpenCVImage ( )

RUNS the conversion and returns the produced OpenCVImage. !!!ATTENTION!!! Do not forget to release this image again with cvReleaseImage().

Returns
the produced OpenCVImage or 0 if an error occured!

Definition at line 58 of file mitkImageToOpenCVImageFilter.cpp.

References AccessFixedTypeByItk, CheckImage(), ItkImageProcessing(), m_Image, m_OpenCVImage, and MITK_ACCESSBYITK_PIXEL_TYPES_SEQ.

Referenced by GetOpenCVMat().

cv::Mat mitk::ImageToOpenCVImageFilter::GetOpenCVMat ( )

RUNS the conversion and returns the produced image as cv::Mat.

Returns
the produced OpenCVImage or an empty image if an error occured

Definition at line 81 of file mitkImageToOpenCVImageFilter.cpp.

References GetOpenCVImage().

template<typename TPixel , unsigned int VImageDimension>
void mitk::ImageToOpenCVImageFilter::ItkImageProcessing ( itk::Image< TPixel, VImageDimension > *  image)
protected

the actual templated conversion method

Definition at line 97 of file mitkImageToOpenCVImageFilter.cpp.

References m_OpenCVImage.

Referenced by GetOpenCVImage().

mitk::ImageToOpenCVImageFilter::mitkClassMacroItkParent ( ImageToOpenCVImageFilter  ,
itk::Object   
)
static Pointer mitk::ImageToOpenCVImageFilter::New ( )
static
void mitk::ImageToOpenCVImageFilter::SetImage ( mitk::Image _Image)

set the input MITK image

Definition at line 37 of file mitkImageToOpenCVImageFilter.cpp.

References m_Image.

Referenced by SetInputFromTimeSlice().

void mitk::ImageToOpenCVImageFilter::SetInputFromTimeSlice ( Image::Pointer  mitkImage,
int  timeStep,
int  slice 
)

Convenient method to set a certain slice of a 3D or 4D mitk::Image as input to convert it to an openCV image.

This methods sets the input. Call GetOpenCVMat() or GetOpenCVImage() to get the image.

Parameters
mitkImage- the image that should be converted to an openCVImage
timeStep- the time step, which is converted to openCV
slice- the slice which is converted to openCV

Definition at line 102 of file mitkImageToOpenCVImageFilter.cpp.

References SetImage().

Member Data Documentation

mitk::WeakPointer<mitk::Image> mitk::ImageToOpenCVImageFilter::m_Image
protected

Saves if the filter should copy the data or just reference it

Definition at line 96 of file mitkImageToOpenCVImageFilter.h.

Referenced by GetOpenCVImage(), and SetImage().

IplImage* mitk::ImageToOpenCVImageFilter::m_OpenCVImage
protected

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