Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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...
 
mitk::ImageGetImage ()
 get the input MITK image More...
 
bool CheckImage (mitk::Image *image)
 get the input MITK image More...
 
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 () override
 

Protected Attributes

mitk::WeakPointer< mitk::Imagem_Image
 
cv::Mat 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 31 of file mitkImageToOpenCVImageFilter.h.

Member Typedef Documentation

◆ DoubleRGBPixelType

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

Definition at line 37 of file mitkImageToOpenCVImageFilter.h.

◆ FloatRGBPixelType

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

Definition at line 36 of file mitkImageToOpenCVImageFilter.h.

◆ UCRGBPixelType

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

Definition at line 34 of file mitkImageToOpenCVImageFilter.h.

◆ USRGBPixelType

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

Definition at line 35 of file mitkImageToOpenCVImageFilter.h.

Constructor & Destructor Documentation

◆ ImageToOpenCVImageFilter()

mitk::ImageToOpenCVImageFilter::ImageToOpenCVImageFilter ( )
protected

Definition at line 21 of file mitkImageToOpenCVImageFilter.cpp.

References mitk::ImageSliceSelector::New().

◆ ~ImageToOpenCVImageFilter()

mitk::ImageToOpenCVImageFilter::~ImageToOpenCVImageFilter ( )
overrideprotected

Definition at line 26 of file mitkImageToOpenCVImageFilter.cpp.

Member Function Documentation

◆ CheckImage()

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

get the input MITK image

Definition at line 42 of file mitkImageToOpenCVImageFilter.cpp.

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

Referenced by GetOpenCVMat().

◆ Clone()

Pointer mitk::ImageToOpenCVImageFilter::Clone ( ) const

◆ GetImage()

Image * mitk::ImageToOpenCVImageFilter::GetImage ( void  )

get the input MITK image

Definition at line 36 of file mitkImageToOpenCVImageFilter.cpp.

References mitk::WeakPointer< T >::Lock(), and m_Image.

◆ 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 57 of file mitkImageToOpenCVImageFilter.cpp.

References AccessFixedTypeByItk, CheckImage(), image, ItkImageProcessing(), mitk::WeakPointer< T >::Lock(), m_Image, m_OpenCVImage, and MITK_ACCESSBYITK_PIXEL_TYPES_SEQ.

◆ ItkImageProcessing()

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

the actual templated conversion method

Definition at line 80 of file mitkImageToOpenCVImageFilter.cpp.

References m_OpenCVImage.

Referenced by GetOpenCVMat().

◆ mitkClassMacroItkParent()

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

◆ New()

static Pointer mitk::ImageToOpenCVImageFilter::New ( )
static

◆ SetImage()

void mitk::ImageToOpenCVImageFilter::SetImage ( mitk::Image _Image)

set the input MITK image

Definition at line 31 of file mitkImageToOpenCVImageFilter.cpp.

References m_Image.

Referenced by SetInputFromTimeSlice().

◆ 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() 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 85 of file mitkImageToOpenCVImageFilter.cpp.

References SetImage().

Member Data Documentation

◆ m_Image

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

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

Definition at line 86 of file mitkImageToOpenCVImageFilter.h.

Referenced by GetImage(), GetOpenCVMat(), and SetImage().

◆ m_OpenCVImage

cv::Mat mitk::ImageToOpenCVImageFilter::m_OpenCVImage
protected

Definition at line 87 of file mitkImageToOpenCVImageFilter.h.

Referenced by GetOpenCVMat(), and ItkImageProcessing().


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