MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkOpenCVToMitkImageFilter.h
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#ifndef mitkOpenCVToMitkImageFilter_h
14
#define mitkOpenCVToMitkImageFilter_h
15
16
// mitk includes
17
#include <MitkOpenCVVideoSupportExports.h>
18
#include <mitkCommon.h>
19
#include <mitkImageSource.h>
20
21
// itk includes
22
#include <itkMacro.h>
23
#include <itkImage.h>
24
25
// OpenCV includes
26
#include <opencv2/core.hpp>
27
#include <opencv2/core/core_c.h>
28
29
#include <mutex>
30
31
namespace
mitk
32
{
33
37
class
MITKOPENCVVIDEOSUPPORT_EXPORT
OpenCVToMitkImageFilter
:
public
ImageSource
38
{
39
public
:
40
typedef
itk::RGBPixel< unsigned char >
UCRGBPixelType
;
41
typedef
itk::RGBPixel< unsigned short >
USRGBPixelType
;
42
typedef
itk::RGBPixel< float >
FloatRGBPixelType
;
43
typedef
itk::RGBPixel< double >
DoubleRGBPixelType
;
44
48
template
<
typename
TPixel,
unsigned
int
VImageDimension>
49
static
Image::Pointer ConvertCVMatToMitkImage(
const
cv::Mat input);
50
51
mitkClassMacro
(
OpenCVToMitkImageFilter
, ImageSource);
52
itkFactorylessNewMacro
(Self);
53
itkCloneMacro
(Self);
54
58
void
SetOpenCVImage(
const
IplImage* image);
59
//itkGetMacro(OpenCVImage, const IplImage*);
60
64
void
SetOpenCVMat(
const
cv::Mat& image);
65
itkGetMacro
(OpenCVMat, cv::Mat);
66
67
OutputImageType* GetOutput(
void
);
68
69
//##Documentation
70
//## @brief Convenient method to insert an openCV image as a slice at a
71
//## certain time step into a 3D or 4D mitk::Image.
72
//##
73
//## @param openCVImage - the image that is inserted into the mitk Image
74
//## @param mitkImage - pointer to the mitkImage, which is changed by this method!
75
//## @param timeStep - the time step, at which the openCVImage is inserted
76
//##
77
//## @attention The parameter mitkImage will be changed!
78
void
InsertOpenCVImageAsMitkTimeSlice(
const
cv::Mat openCVImage, Image::Pointer mitkImage,
int
timeStep);
79
80
protected
:
81
82
OpenCVToMitkImageFilter
();
// purposely hidden
83
~OpenCVToMitkImageFilter
()
override
;
84
85
void
GenerateData()
override
;
86
87
protected
:
88
Image::Pointer
m_Image
;
89
cv::Mat
m_OpenCVMat
;
90
91
std::mutex
m_ImageMutex
;
92
std::mutex
m_OpenCVMatMutex
;
93
};
94
95
}
// namespace mitk
96
97
#endif
mitk::OpenCVToMitkImageFilter
Filter for creating MITK RGB Images from an OpenCV image.
Definition
mitkOpenCVToMitkImageFilter.h:38
mitk::OpenCVToMitkImageFilter::itkFactorylessNewMacro
itkFactorylessNewMacro(Self)
mitk::OpenCVToMitkImageFilter::UCRGBPixelType
itk::RGBPixel< unsigned char > UCRGBPixelType
Definition
mitkOpenCVToMitkImageFilter.h:40
mitk::OpenCVToMitkImageFilter::m_OpenCVMatMutex
std::mutex m_OpenCVMatMutex
Definition
mitkOpenCVToMitkImageFilter.h:92
mitk::OpenCVToMitkImageFilter::itkCloneMacro
itkCloneMacro(Self)
mitk::OpenCVToMitkImageFilter::USRGBPixelType
itk::RGBPixel< unsigned short > USRGBPixelType
Definition
mitkOpenCVToMitkImageFilter.h:41
mitk::OpenCVToMitkImageFilter::m_Image
Image::Pointer m_Image
Definition
mitkOpenCVToMitkImageFilter.h:88
mitk::OpenCVToMitkImageFilter::FloatRGBPixelType
itk::RGBPixel< float > FloatRGBPixelType
Definition
mitkOpenCVToMitkImageFilter.h:42
mitk::OpenCVToMitkImageFilter::DoubleRGBPixelType
itk::RGBPixel< double > DoubleRGBPixelType
Definition
mitkOpenCVToMitkImageFilter.h:43
mitk::OpenCVToMitkImageFilter::itkGetMacro
itkGetMacro(OpenCVMat, cv::Mat)
mitk::OpenCVToMitkImageFilter::m_OpenCVMat
cv::Mat m_OpenCVMat
Definition
mitkOpenCVToMitkImageFilter.h:89
mitk::OpenCVToMitkImageFilter::mitkClassMacro
mitkClassMacro(OpenCVToMitkImageFilter, ImageSource)
mitk::OpenCVToMitkImageFilter::m_ImageMutex
std::mutex m_ImageMutex
Definition
mitkOpenCVToMitkImageFilter.h:91
mitk
IGT Exceptions.
Definition
mitkAlgorithm.h:16
Modules
OpenCVVideoSupport
mitkOpenCVToMitkImageFilter.h
Generated by
1.12.0