Medical Imaging Interaction Toolkit  2021.02.99-89548602
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;
108  virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
109  int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr) = 0;
114  itkGetMacro(CaptureWidth, int);
119  itkGetMacro(CaptureHeight, int);
124  itkGetMacro(SourceDataSize, int);
129  itkGetMacro(BufferSize, int);
134  itkGetMacro(MaxBufferSize, int);
135 
139  void SetBoolProperty( const char* propertyKey, bool boolValue );
140 
144  void SetIntProperty( const char* propertyKey, int intValue );
145 
149  void SetFloatProperty( const char* propertyKey, float floatValue );
150 
154  void SetStringProperty( const char* propertyKey, const char* stringValue );
155 
159  virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
160 
164  virtual BaseProperty* GetProperty( const char *propertyKey );
165 
169  bool GetBoolProperty(const char *propertyKey, bool& boolValue);
170 
174  bool GetStringProperty(const char *propertyKey, std::string& string);
175 
179  bool GetIntProperty(const char *propertyKey, int& integer);
180 
181  virtual int GetRGBCaptureWidth();
182 
183  virtual int GetRGBCaptureHeight();
184 
185  protected:
186 
187  ToFCameraDevice();
188 
189  ~ToFCameraDevice() override;
190 
194  virtual void AllocatePixelArrays();
198  virtual void CleanupPixelArrays();
199 
206  int m_FreePos;
214  itk::MultiThreader::Pointer m_MultiThreader;
215  itk::FastMutexLock::Pointer m_ImageMutex;
216  itk::FastMutexLock::Pointer m_CameraActiveMutex;
221 
223 
224  };
225 } //END mitk namespace
230 MITK_DECLARE_SERVICE_INTERFACE(mitk::ToFCameraDevice, "org.mitk.services.ToFCameraDevice")
231 #endif
#define MITK_DECLARE_SERVICE_INTERFACE(IFace, IId)
#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)
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