19 #include "vtkSmartPointer.h" 20 #include "vtkColorTransferFunction.h" 21 #include "vtkFloatArray.h" 45 unsigned int dimensions[4];
59 currentMITKIntensityImage->Initialize(FloatType, 2, dimensions);
60 currentMITKIntensityImage->SetSlice((
float*) imgGrabAcc2.GetData(),0,0,0);
63 currentMITKAmplitudeImage->Initialize(FloatType, 2, dimensions);
64 currentMITKAmplitudeImage->SetSlice((
float*)imgGrabAcc1.GetData(),0,0,0);
67 currentMITKDistanceImage->Initialize(FloatType, 2, dimensions);
68 currentMITKDistanceImage->SetSlice((
float*)imgGrabAcc0.GetData(),0,0,0);
74 ImageReadAccessor currentAmplAcc(currentMITKAmplitudeImage, currentMITKAmplitudeImage->GetSliceData(0, 0, 0));
75 float* amplitudeFloatData = (
float*) currentAmplAcc.
GetData();
81 ImageReadAccessor currentIntenAcc(currentMITKIntensityImage, currentMITKIntensityImage->GetSliceData(0, 0, 0));
82 float* intensityFloatData = (
float*) currentIntenAcc.
GetData();
88 ImageReadAccessor currentDistAcc(currentMITKDistanceImage, currentMITKDistanceImage->GetSliceData(0, 0, 0));
89 float* distanceFloatData = (
float*) currentDistAcc.
GetData();
160 float* floatData = (
float*)imgAcc.
GetData();
161 vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
162 vtkSmartPointer<vtkFloatArray> floatArrayInt = vtkSmartPointer<vtkFloatArray>::New();
163 floatArrayInt->Initialize();
164 floatArrayInt->SetArray(floatData, numOfPixel, 0);
169 colorTransferFunction->RemoveAllPoints();
170 colorTransferFunction->AddRGBPoint(min, 0, 0, 0);
171 colorTransferFunction->AddRGBPoint(max, 1, 1, 1);
172 colorTransferFunction->SetColorSpaceToHSV();
173 colorTransferFunction->MapScalarsThroughTable(floatArrayInt, (
unsigned char*)openCVImage->imageData, VTK_LUMINANCE);
void SetImageDepth(unsigned int imageDepth)
set the depth of the image. Some functions of OpenCV do not support IPL_DEPTH_32F. Warning: changing from default results in a mapping of the pixel value through a lookup table IPL_DEPTH_1U 1 IPL_DEPTH_8U 8 IPL_DEPTH_16U 16 IPL_DEPTH_32F 32 (Default)
DataCollection - Class to facilitate loading/accessing structured data.
~ToFOpenCVImageGrabber() override
void SetToFImageGrabber(mitk::ToFImageGrabber::Pointer imageGrabber)
set the ImageGrabber used for fetching image data from the camera
IplImage * m_CurrentOpenCVDistanceImage
OpenCV image holding the current distance data.
unsigned int m_ImageDepth
image depth currently used by this image source. Warning: Changing from default (IPL_DEPTH_32F) resul...
mitk::ToFImageGrabber::Pointer GetToFImageGrabber()
get the ImageGrabber used for fetching image data from the camera
IplImage * m_CurrentOpenCVIntensityImage
OpenCV image holding the current intensity data.
void MapScalars(mitk::Image::Pointer mitkImage, IplImage *openCVImage)
map scalars through lookup table
mitk::ToFImageGrabber::Pointer m_ImageGrabber
ImageGrabber used for fetching ToF image data from the camera.
void SetImageType(unsigned int imageType)
set type of image you want to grab. 0: Distance image (Default) 1: Amplitude image 2: Intensity image...
cv::Mat GetImage() override
Get current ToF image. Specify image you want to grab with SetImageType()
ImageReadAccessor class to get locked read access for a particular image part.
unsigned int m_ImageType
type of image currently supplied by this image source
IplImage * m_CurrentOpenCVAmplitudeImage
OpenCV image holding the current amplitude data.
const void * GetData() const
Gives const access to the data.
Class for defining the data type of pixels.