MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFCameraPMDPlayerController.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 <mitkToFConfig.h>
14#include <mitkToFPMDConfig.h>
15#include <pmdsdk2.h>
16
17//Plugin defines for Camcube 2.0
18#define PROC_PARAM ""
19
20extern PMDHandle m_PMDHandle;
21
22extern PMDDataDescription m_DataDescription;
23
24namespace mitk
25{
27 {
28 m_SourcePlugin = MITK_TOF_PMDFILE_SOURCE_PLUGIN;
29 m_ProcPlugin = MITK_TOF_PMDCAMCUBE_PROCESSING_PLUGIN;
31
32 this->m_NumOfFrames = 0;
33 }
34
38
40 {
41 bool ok = false;
42
43 if( m_PMDFileName == "" )
44 {
45 return ok;
46 }
47
48 this->m_PMDRes = pmdOpen(&m_PMDHandle , this->m_SourcePlugin , this->m_PMDFileName.c_str(), this->m_ProcPlugin, this->m_ProcParam );
49 ok = ErrorText(this->m_PMDRes);
50
51 if (ok)
52 {
53 this->m_PMDRes = pmdUpdate(m_PMDHandle);
54 ok = ErrorText(this->m_PMDRes);
55
56 this->m_PMDRes = pmdGetSourceDataDescription(m_PMDHandle, &m_DataDescription);
57 ok = ErrorText(m_PMDRes);
58
59 if (ok)
60 {
61 this->m_CaptureWidth = m_DataDescription.img.numColumns;
62 this->m_CaptureHeight = m_DataDescription.img.numRows;
63 this->m_PixelNumber = this->m_CaptureWidth * this->m_CaptureHeight;
64 this->m_NumberOfBytes = this->m_PixelNumber * sizeof(float);
66 this->m_SourceDataStructSize = m_DataDescription.size + sizeof(PMDDataDescription);
67
68 MITK_INFO << "Open PMD file: " << m_InputFileName.c_str();
69 MITK_INFO << "Datasource size: " << this->m_SourceDataSize <<std::endl;
70 MITK_INFO << "Integration Time: " << this->GetIntegrationTime();
71 MITK_INFO << "Modulation Frequence: " << this->GetModulationFrequency();
72 MITK_INFO << "NumOfFrames: " << this->m_NumOfFrames;
73 }
74 }
75
76 return ok;
77 }
78
79 int ToFCameraPMDPlayerController::SetIntegrationTime(unsigned int integrationTime)
80 {
81 return m_DataDescription.img.integrationTime[0];;
82 }
83
84 int ToFCameraPMDPlayerController::SetModulationFrequency(unsigned int modulationFrequency)
85 {
86 return m_DataDescription.img.modulationFrequency[0];;
87 }
88
89}
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
int m_SourceDataStructSize
size of the PMD source data struct and the PMD source data
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...
std::string m_InputFileName
input file name used by PMD player classes
int m_NumberOfBytes
holds the number of bytes contained in the image
int m_PixelNumber
holds the number of pixels contained in the image
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
int SetIntegrationTime(unsigned int integrationTime)
convenience method setting the integration time in the PMDDataDescription
std::string m_PMDFileName
File name of the pmd data stream.
bool OpenCameraConnection()
opens a connection to the ToF camera
int SetModulationFrequency(unsigned int modulationFrequency)
convenience method setting the modulation frequency in the PMDDataDescription
PMDHandle m_PMDHandle
PMDDataDescription m_DataDescription
PMDHandle m_PMDHandle
PMDDataDescription m_DataDescription
IGT Exceptions.