Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkToFCameraPMDPlayerController.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
17 #include <mitkToFConfig.h>
18 #include <mitkToFPMDConfig.h>
19 #include <pmdsdk2.h>
20 
21 //Plugin defines for Camcube 2.0
22 #define PROC_PARAM ""
23 
24 extern PMDHandle m_PMDHandle;
25 
26 extern PMDDataDescription m_DataDescription;
27 
28 namespace mitk
29 {
31  {
35 
36  this->m_NumOfFrames = 0;
37  }
38 
40  {
41  }
42 
44  {
45  bool ok = false;
46 
47  if( m_PMDFileName == "" )
48  {
49  return ok;
50  }
51 
52  this->m_PMDRes = pmdOpen(&m_PMDHandle , this->m_SourcePlugin , this->m_PMDFileName.c_str(), this->m_ProcPlugin, this->m_ProcParam );
53  ok = ErrorText(this->m_PMDRes);
54 
55  if (ok)
56  {
57  this->m_PMDRes = pmdUpdate(m_PMDHandle);
58  ok = ErrorText(this->m_PMDRes);
59 
60  this->m_PMDRes = pmdGetSourceDataDescription(m_PMDHandle, &m_DataDescription);
61  ok = ErrorText(m_PMDRes);
62 
63  if (ok)
64  {
65  this->m_CaptureWidth = m_DataDescription.img.numColumns;
66  this->m_CaptureHeight = m_DataDescription.img.numRows;
67  this->m_PixelNumber = this->m_CaptureWidth * this->m_CaptureHeight;
68  this->m_NumberOfBytes = this->m_PixelNumber * sizeof(float);
70  this->m_SourceDataStructSize = m_DataDescription.size + sizeof(PMDDataDescription);
71 
72  MITK_INFO << "Open PMD file: " << m_InputFileName.c_str();
73  MITK_INFO << "Datasource size: " << this->m_SourceDataSize <<std::endl;
74  MITK_INFO << "Integration Time: " << this->GetIntegrationTime();
75  MITK_INFO << "Modulation Frequence: " << this->GetModulationFrequency();
76  MITK_INFO << "NumOfFrames: " << this->m_NumOfFrames;
77  }
78  }
79 
80  return ok;
81  }
82 
83  int ToFCameraPMDPlayerController::SetIntegrationTime(unsigned int integrationTime)
84  {
85  return m_DataDescription.img.integrationTime[0];;
86  }
87 
88  int ToFCameraPMDPlayerController::SetModulationFrequency(unsigned int modulationFrequency)
89  {
90  return m_DataDescription.img.modulationFrequency[0];;
91  }
92 
93 }
int SetIntegrationTime(unsigned int integrationTime)
convenience method setting the integration time in the PMDDataDescription
#define MITK_INFO
Definition: mitkLogMacros.h:22
char * m_ProcParam
holds processing parameter(s)
int m_PixelNumber
holds the number of pixels contained in the image
DataCollection - Class to facilitate loading/accessing structured data.
#define MITK_TOF_PMDCAMCUBE_PROCESSING_PLUGIN
int m_NumberOfBytes
holds the number of bytes contained in the image
#define MITK_TOF_PMDFILE_SOURCE_PLUGIN
virtual int GetIntegrationTime()
Returns the currently set integration time.
int SetModulationFrequency(unsigned int modulationFrequency)
convenience method setting the modulation frequency in the PMDDataDescription
unsigned int m_CaptureHeight
holds the height of the image in pixel as it is originally acquired by the camera ...
bool OpenCameraConnection()
opens a connection to the ToF camera
virtual int GetModulationFrequency()
Returns the currently set modulation frequency.
bool ErrorText(int error)
Method printing the current error message to the console and returning whether the previous command w...
char * m_ProcPlugin
holds name of processing plugin to be loaded (e.g. camcubeproc.W64.pap for CamCube 3...
PMDDataDescription m_DataDescription
std::string m_PMDFileName
File name of the pmd data stream.
unsigned int m_CaptureWidth
holds the width of the image in pixel as it is originally acquired by the camera
std::string m_InputFileName
input file name used by PMD player classes
int m_PMDRes
holds the current result message provided by PMD
int m_SourceDataStructSize
size of the PMD source data struct and the PMD source data
PMDHandle m_PMDHandle
int m_SourceDataSize
size of the original PMD source data
char * m_SourcePlugin
holds name of source plugin to be loaded (e.g. camcube3.W64.pap for CamCube 3.0 on Win64 platform) ...