Medical Imaging Interaction Toolkit  2018.4.99-6a3ea89d
Medical Imaging Interaction Toolkit
mitkToFCameraDevice.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 #ifndef __mitkToFCameraDevice_h
13 #define __mitkToFCameraDevice_h
14 
15 #include <MitkToFHardwareExports.h>
16 #include "mitkCommon.h"
17 #include "mitkStringProperty.h"
18 #include "mitkProperties.h"
19 #include "mitkPropertyList.h"
20 
21 #include "itkObject.h"
22 #include "itkObjectFactory.h"
23 #include "itkMultiThreader.h"
24 #include "itkFastMutexLock.h"
25 
26 // Microservices
27 #include <mitkServiceInterface.h>
28 
29 namespace mitk
30 {
36  class MITKTOFHARDWARE_EXPORT ToFCameraDevice : public itk::Object
37  {
38  public:
39 
46  virtual bool OnConnectCamera() = 0;
47 
53  virtual bool ConnectCamera();
57  virtual bool DisconnectCamera() = 0;
62  virtual void StartCamera() = 0;
66  virtual void StopCamera();
70  virtual bool IsCameraActive();
74  virtual bool IsCameraConnected();
78  virtual void UpdateCamera() = 0;
85  virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence) = 0;
91  virtual void GetIntensities(float* intensityArray, int& imageSequence) = 0;
97  virtual void GetDistances(float* distanceArray, int& imageSequence) = 0;
107  virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
108  int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr) = 0;
113  itkGetMacro(CaptureWidth, int);
118  itkGetMacro(CaptureHeight, int);
123  itkGetMacro(SourceDataSize, int);
128  itkGetMacro(BufferSize, int);
133  itkGetMacro(MaxBufferSize, int);
134 
138  void SetBoolProperty( const char* propertyKey, bool boolValue );
139 
143  void SetIntProperty( const char* propertyKey, int intValue );
144 
148  void SetFloatProperty( const char* propertyKey, float floatValue );
149 
153  void SetStringProperty( const char* propertyKey, const char* stringValue );
154 
158  virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
159 
163  virtual BaseProperty* GetProperty( const char *propertyKey );
164 
168  bool GetBoolProperty(const char *propertyKey, bool& boolValue);
169 
173  bool GetStringProperty(const char *propertyKey, std::string& string);
174 
178  bool GetIntProperty(const char *propertyKey, int& integer);
179 
180  virtual int GetRGBCaptureWidth();
181 
182  virtual int GetRGBCaptureHeight();
183 
184  protected:
185 
186  ToFCameraDevice();
187 
188  ~ToFCameraDevice() override;
189 
193  virtual void AllocatePixelArrays();
197  virtual void CleanupPixelArrays();
198 
205  int m_FreePos;
213  itk::MultiThreader::Pointer m_MultiThreader;
214  itk::FastMutexLock::Pointer m_ImageMutex;
215  itk::FastMutexLock::Pointer m_CameraActiveMutex;
220 
222 
223  };
224 } //END mitk namespace
229 MITK_DECLARE_SERVICE_INTERFACE(mitk::ToFCameraDevice, "org.mitk.services.ToFCameraDevice")
230 #endif
#define MITK_DECLARE_SERVICE_INTERFACE(IFace, IId)
signed integer value
Definition: jsoncpp.h:348
#define MITKTOFHARDWARE_EXPORT
Virtual interface and base class for all Time-of-Flight devices.
int m_SourceDataSize
size of the PMD source data
int m_RGBPixelNumber
number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight)
float * m_IntensityArray
float array holding the intensity image
int m_PixelNumber
number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
DataCollection - Class to facilitate loading/accessing structured data.
PropertyList::Pointer m_PropertyList
a list of the corresponding properties
float * m_DistanceArray
float array holding the distance image
int m_ThreadID
ID of the started thread.
itk::FastMutexLock::Pointer m_CameraActiveMutex
mutex for the cameraActive flag
itk::MultiThreader::Pointer m_MultiThreader
itk::MultiThreader used for thread handling
int m_FreePos
current position in the buffer which will be filled with data acquired from the hardware ...
Abstract base class for properties.
int m_RGBImageHeight
height of the RGB image (y dimension)
bool m_CameraActive
flag indicating if the camera is currently active or not. Caution: thread safe access only! ...
int m_CurrentPos
current position in the buffer which will be retrieved by the Get methods
bool m_CameraConnected
flag indicating if the camera is successfully connected or not. Caution: thread safe access only! ...
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
int m_CaptureWidth
width of the range image (x dimension)
itk::FastMutexLock::Pointer m_ImageMutex
mutex for images provided by the range camera
int m_BufferSize
buffer size of the image buffer needed for loss-less acquisition of range data
int m_MaxBufferSize
maximal buffer size needed for initialization of data arrays. Default value is 100.
int m_CaptureHeight
height of the range image (y dimension)
UTF-8 string value.
Definition: jsoncpp.h:351
float * m_AmplitudeArray
float array holding the amplitude image
int m_RGBImageWidth
width of the RGB image (x dimension)
int m_ImageSequence
counter for acquired images