Medical Imaging Interaction Toolkit  2022.10.99-efe2ad43
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 
24 #include <mutex>
25 #include <thread>
26 
27 // Microservices
28 #include <mitkServiceInterface.h>
29 
30 namespace mitk
31 {
37  class MITKTOFHARDWARE_EXPORT ToFCameraDevice : public itk::Object
38  {
39  public:
40 
47  virtual bool OnConnectCamera() = 0;
48 
54  virtual bool ConnectCamera();
58  virtual bool DisconnectCamera() = 0;
63  virtual void StartCamera() = 0;
67  virtual void StopCamera();
71  virtual bool IsCameraActive();
75  virtual bool IsCameraConnected();
79  virtual void UpdateCamera() = 0;
86  virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence) = 0;
92  virtual void GetIntensities(float* intensityArray, int& imageSequence) = 0;
98  virtual void GetDistances(float* distanceArray, int& imageSequence) = 0;
109  virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
110  int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr) = 0;
115  itkGetMacro(CaptureWidth, int);
120  itkGetMacro(CaptureHeight, int);
125  itkGetMacro(SourceDataSize, int);
130  itkGetMacro(BufferSize, int);
135  itkGetMacro(MaxBufferSize, int);
136 
140  void SetBoolProperty( const char* propertyKey, bool boolValue );
141 
145  void SetIntProperty( const char* propertyKey, int intValue );
146 
150  void SetFloatProperty( const char* propertyKey, float floatValue );
151 
155  void SetStringProperty( const char* propertyKey, const char* stringValue );
156 
160  virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
161 
165  virtual BaseProperty* GetProperty( const char *propertyKey );
166 
170  bool GetBoolProperty(const char *propertyKey, bool& boolValue);
171 
175  bool GetStringProperty(const char *propertyKey, std::string& string);
176 
180  bool GetIntProperty(const char *propertyKey, int& integer);
181 
182  virtual int GetRGBCaptureWidth();
183 
184  virtual int GetRGBCaptureHeight();
185 
186  protected:
187 
188  ToFCameraDevice();
189 
190  ~ToFCameraDevice() override;
191 
195  virtual void AllocatePixelArrays();
199  virtual void CleanupPixelArrays();
200 
207  int m_FreePos;
215  std::mutex m_ImageMutex;
216  std::mutex m_CameraActiveMutex;
217  std::thread m_Thread;
221 
223 
224  };
225 } //END mitk namespace
230 MITK_DECLARE_SERVICE_INTERFACE(mitk::ToFCameraDevice, "org.mitk.services.ToFCameraDevice")
231 #endif
mitk::ToFCameraDevice::m_CurrentPos
int m_CurrentPos
current position in the buffer which will be retrieved by the Get methods
Definition: mitkToFCameraDevice.h:206
mitk::ToFCameraDevice::m_SourceDataSize
int m_SourceDataSize
size of the PMD source data
Definition: mitkToFCameraDevice.h:214
MITKTOFHARDWARE_EXPORT
#define MITKTOFHARDWARE_EXPORT
Definition: MitkToFHardwareExports.h:15
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:35
mitkServiceInterface.h
mitk::ToFCameraDevice::m_CameraConnected
bool m_CameraConnected
flag indicating if the camera is successfully connected or not. Caution: thread safe access only!
Definition: mitkToFCameraDevice.h:219
itk::SmartPointer< Self >
mitk::ToFCameraDevice::m_PropertyList
PropertyList::Pointer m_PropertyList
a list of the corresponding properties
Definition: mitkToFCameraDevice.h:222
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::ToFCameraDevice::m_AmplitudeArray
float * m_AmplitudeArray
float array holding the amplitude image
Definition: mitkToFCameraDevice.h:203
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::ToFCameraDevice::m_Thread
std::thread m_Thread
Definition: mitkToFCameraDevice.h:217
mitk::ToFCameraDevice::m_RGBImageHeight
int m_RGBImageHeight
height of the RGB image (y dimension)
Definition: mitkToFCameraDevice.h:212
mitk::ToFCameraDevice::m_BufferSize
int m_BufferSize
buffer size of the image buffer needed for loss-less acquisition of range data
Definition: mitkToFCameraDevice.h:204
mitk::ToFCameraDevice::m_FreePos
int m_FreePos
current position in the buffer which will be filled with data acquired from the hardware
Definition: mitkToFCameraDevice.h:207
mitkStringProperty.h
mitk::ToFCameraDevice::m_CameraActive
bool m_CameraActive
flag indicating if the camera is currently active or not. Caution: thread safe access only!
Definition: mitkToFCameraDevice.h:218
mitk::ToFCameraDevice::m_ImageSequence
int m_ImageSequence
counter for acquired images
Definition: mitkToFCameraDevice.h:220
mitk::ToFCameraDevice::m_RGBPixelNumber
int m_RGBPixelNumber
number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight)
Definition: mitkToFCameraDevice.h:213
mitkPropertyList.h
mitkCommon.h
mitk::ToFCameraDevice::m_PixelNumber
int m_PixelNumber
number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
Definition: mitkToFCameraDevice.h:210
mitk::ToFCameraDevice::m_IntensityArray
float * m_IntensityArray
float array holding the intensity image
Definition: mitkToFCameraDevice.h:201
mitk::ToFCameraDevice::m_RGBImageWidth
int m_RGBImageWidth
width of the RGB image (x dimension)
Definition: mitkToFCameraDevice.h:211
mitk::ToFCameraDevice::m_DistanceArray
float * m_DistanceArray
float array holding the distance image
Definition: mitkToFCameraDevice.h:202
mitk::ToFCameraDevice::m_MaxBufferSize
int m_MaxBufferSize
maximal buffer size needed for initialization of data arrays. Default value is 100.
Definition: mitkToFCameraDevice.h:205
mitk::ToFCameraDevice::m_ImageMutex
std::mutex m_ImageMutex
mutex for images provided by the range camera
Definition: mitkToFCameraDevice.h:215
mitk::ToFCameraDevice
Virtual interface and base class for all Time-of-Flight devices.
Definition: mitkToFCameraDevice.h:37
MITK_DECLARE_SERVICE_INTERFACE
#define MITK_DECLARE_SERVICE_INTERFACE(IFace, IId)
Definition: mitkServiceInterface.h:26
mitkProperties.h
mitk::ToFCameraDevice::m_CameraActiveMutex
std::mutex m_CameraActiveMutex
mutex for the cameraActive flag
Definition: mitkToFCameraDevice.h:216
MitkToFHardwareExports.h
mitk::ToFCameraDevice::m_CaptureWidth
int m_CaptureWidth
width of the range image (x dimension)
Definition: mitkToFCameraDevice.h:208
mitk::ToFCameraDevice::m_CaptureHeight
int m_CaptureHeight
height of the range image (y dimension)
Definition: mitkToFCameraDevice.h:209