MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFCameraPMDO3Controller.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
13#include <pmdsdk2.h>
14#include "mitkToFConfig.h"
15#include "mitkToFPMDConfig.h"
16
17#include "vnl/vnl_matrix.h"
18
19// IP Adress of the Camera, change here if needed
20#define CAMERA_ADDR "192.168.0.69"
21#define SOURCE_PARAM "192.168.0.69"
22#define PROC_PARAM ""
23
24extern PMDHandle m_PMDHandle;
25
26extern PMDDataDescription m_DataDescription;
27
28namespace mitk
29{
31 {
32 m_IPAddress = CAMERA_ADDR;
33 m_SourcePlugin = MITK_TOF_PMDO3_SOURCE_PLUGIN;
35 m_ProcPlugin = MITK_TOF_PMDO3_PROCESSING_PLUGIN;
37 }
38
42
44 {
46 {
49
50 // get image properties from camera
51 this->UpdateCamera();
52 m_PMDRes = pmdGetSourceDataDescription(m_PMDHandle, &m_DataDescription);
54 m_CaptureWidth = m_DataDescription.img.numColumns;
59 m_NumberOfBytes = m_PixelNumber * sizeof(float);
61 m_SourceDataStructSize = m_DataDescription.size + sizeof(PMDDataDescription);
62 MITK_INFO << "Datasource size: " << m_SourceDataSize <<std::endl;
63 MITK_INFO << "Integration Time: " << this->GetIntegrationTime();
64 MITK_INFO << "Modulation Frequence: " << this->GetModulationFrequency();
65
66 return m_ConnectionCheck;
67 }
68 else return m_ConnectionCheck;
69 }
70
71 void ToFCameraPMDO3Controller::TransformCameraOutput(float* in, float* out, bool isDist)
72 {
73 vnl_matrix<float> inMat = vnl_matrix<float>(m_CaptureHeight,m_CaptureWidth);
74 inMat.copy_in(in);
75 vnl_matrix<float> outMat = vnl_matrix<float>(m_InternalCaptureHeight, m_InternalCaptureWidth);
76 vnl_matrix<float> temp = vnl_matrix<float>(m_InternalCaptureHeight, m_InternalCaptureWidth);
77 outMat = inMat.extract(m_InternalCaptureHeight, m_InternalCaptureWidth, 0,0);
78 outMat.fliplr();
79 if(isDist)
80 {
81 outMat*=1000;
82 }
83 outMat.copy_out(out);
84 inMat.clear();
85 outMat.clear();
86 temp.clear();
87 }
88}
virtual int GetIntegrationTime()
Returns the currently set integration time.
int m_PMDRes
holds the current result message provided by PMD
int m_SourceDataSize
size of the original PMD source data
char * m_SourceParam
holds source parameter(s)
int m_SourceDataStructSize
size of the PMD source data struct and the PMD source data
bool m_ConnectionCheck
flag showing whether the camera is connected (true) or not (false)
unsigned int m_CaptureHeight
holds the height of the image in pixel as it is originally acquired by the camera
char * m_ProcParam
holds processing parameter(s)
char * m_ProcPlugin
holds name of processing plugin to be loaded (e.g. camcubeproc.W64.pap for CamCube 3....
bool ErrorText(int error)
Method printing the current error message to the console and returning whether the previous command w...
int m_NumberOfBytes
holds the number of bytes contained in the image
int m_PixelNumber
holds the number of pixels contained in the image
unsigned int m_InternalCaptureHeight
holds the height of the image in pixel as is it requested by the user (cf. TransformCameraOutput()) D...
virtual int GetModulationFrequency()
Returns the currently set modulation frequency.
char * m_SourcePlugin
holds name of source plugin to be loaded (e.g. camcube3.W64.pap for CamCube 3.0 on Win64 platform)
unsigned int m_CaptureWidth
holds the width of the image in pixel as it is originally acquired by the camera
unsigned int m_InternalCaptureWidth
holds the width of the image in pixel as it is requested by the user (cf. TransformCameraOutput()) De...
virtual bool UpdateCamera()
calls update on the camera -> a new ToF-image is aquired
void TransformCameraOutput(float *in, float *out, bool isDist)
virtual bool OpenCameraConnection()
opens a connection to the PMD O3 ToF camera
PMDHandle m_PMDHandle
PMDDataDescription m_DataDescription
PMDHandle m_PMDHandle
PMDDataDescription m_DataDescription
IGT Exceptions.