Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
mitk::KinectDevice Class Reference

Interface for all representations of Kinect devices. KinectDevice internally holds an instance of KinectController and starts a thread that continuously grabs images from the controller. A buffer structure buffers the last acquired images to provide the image data loss-less. More...

#include <mitkKinectDevice.h>

Inheritance diagram for mitk::KinectDevice:
Collaboration diagram for mitk::KinectDevice:

Public Member Functions

 mitkClassMacro (KinectDevice, ToFCameraDevice)
 
Pointer Clone () const
 
virtual bool OnConnectCamera ()
 opens a connection to the ToF camera More...
 
virtual bool DisconnectCamera ()
 closes the connection to the camera More...
 
virtual void StartCamera ()
 starts the continuous updating of the camera. A separate thread updates the source data, the main thread processes the source data and creates images and coordinates More...
 
virtual void StopCamera ()
 stops the continuous updating of the camera More...
 
virtual void UpdateCamera ()
 updates the camera for image acquisition More...
 
virtual bool IsCameraActive ()
 returns whether the camera is currently active or not More...
 
virtual void GetAmplitudes (float *amplitudeArray, int &imageSequence)
 gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images. These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value More...
 
virtual void GetIntensities (float *intensityArray, int &imageSequence)
 gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images. More...
 
virtual void GetDistances (float *distanceArray, int &imageSequence)
 gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images. More...
 
virtual void GetAllImages (float *distanceArray, float *amplitudeArray, float *intensityArray, char *sourceDataArray, int requiredImageSequence, int &capturedImageSequence, unsigned char *rgbDataArray=nullptr)
 gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images. More...
 
KinectController::Pointer GetController ()
 returns the corresponding camera controller More...
 
virtual void SetProperty (const char *propertyKey, BaseProperty *propertyValue)
 set a BaseProperty More...
 
int GetRGBCaptureWidth ()
 returns the width of the RGB image More...
 
int GetRGBCaptureHeight ()
 returns the height of the RGB image More...
 
- Public Member Functions inherited from mitk::ToFCameraDevice
 mitkClassMacroItkParent (ToFCameraDevice, itk::Object)
 
virtual bool ConnectCamera ()
 ConnectCamera Internally calls OnConnectCamera() of the respective device implementation. More...
 
virtual bool IsCameraConnected ()
 returns true if the camera is connected More...
 
virtual int GetCaptureWidth ()
 get the currently set capture width More...
 
virtual int GetCaptureHeight ()
 get the currently set capture height More...
 
virtual int GetSourceDataSize ()
 get the currently set source data size More...
 
virtual int GetBufferSize ()
 get the currently set buffer size More...
 
virtual int GetMaxBufferSize ()
 get the currently set max buffer size More...
 
void SetBoolProperty (const char *propertyKey, bool boolValue)
 set a bool property in the property list More...
 
void SetIntProperty (const char *propertyKey, int intValue)
 set an int property in the property list More...
 
void SetFloatProperty (const char *propertyKey, float floatValue)
 set a float property in the property list More...
 
void SetStringProperty (const char *propertyKey, const char *stringValue)
 set a string property in the property list More...
 
virtual BasePropertyGetProperty (const char *propertyKey)
 get a BaseProperty from the property list More...
 
bool GetBoolProperty (const char *propertyKey, bool &boolValue)
 get a bool from the property list More...
 
bool GetStringProperty (const char *propertyKey, std::string &string)
 get a string from the property list More...
 
bool GetIntProperty (const char *propertyKey, int &integer)
 get an int from the property list More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 KinectDevice ()
 
 ~KinectDevice ()
 
void GetNextPos ()
 moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer More...
 
- Protected Member Functions inherited from mitk::ToFCameraDevice
 ToFCameraDevice ()
 
 ~ToFCameraDevice () override
 
virtual void AllocatePixelArrays ()
 method for allocating memory for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray More...
 
virtual void CleanupPixelArrays ()
 method for cleanup memory allocated for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray More...
 

Static Protected Member Functions

static ITK_THREAD_RETURN_TYPE Acquire (void *pInfoStruct)
 Thread method continuously acquiring images from the ToF hardware. More...
 

Protected Attributes

KinectController::Pointer m_Controller
 corresponding CameraController More...
 
float ** m_DistanceDataBuffer
 buffer holding the last distance images More...
 
float ** m_AmplitudeDataBuffer
 buffer holding the last infra-red (IR) images More...
 
unsigned char ** m_RGBDataBuffer
 buffer holding the last RGB image More...
 
- Protected Attributes inherited from mitk::ToFCameraDevice
float * m_IntensityArray
 float array holding the intensity image More...
 
float * m_DistanceArray
 float array holding the distance image More...
 
float * m_AmplitudeArray
 float array holding the amplitude image More...
 
int m_BufferSize
 buffer size of the image buffer needed for loss-less acquisition of range data More...
 
int m_MaxBufferSize
 maximal buffer size needed for initialization of data arrays. Default value is 100. More...
 
int m_CurrentPos
 current position in the buffer which will be retrieved by the Get methods More...
 
int m_FreePos
 current position in the buffer which will be filled with data acquired from the hardware More...
 
int m_CaptureWidth
 width of the range image (x dimension) More...
 
int m_CaptureHeight
 height of the range image (y dimension) More...
 
int m_PixelNumber
 number of pixels in the range image (m_CaptureWidth*m_CaptureHeight) More...
 
int m_RGBImageWidth
 width of the RGB image (x dimension) More...
 
int m_RGBImageHeight
 height of the RGB image (y dimension) More...
 
int m_RGBPixelNumber
 number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight) More...
 
int m_SourceDataSize
 size of the PMD source data More...
 
itk::MultiThreader::Pointer m_MultiThreader
 itk::MultiThreader used for thread handling More...
 
itk::FastMutexLock::Pointer m_ImageMutex
 mutex for images provided by the range camera More...
 
itk::FastMutexLock::Pointer m_CameraActiveMutex
 mutex for the cameraActive flag More...
 
int m_ThreadID
 ID of the started thread. More...
 
bool m_CameraActive
 flag indicating if the camera is currently active or not. Caution: thread safe access only! More...
 
bool m_CameraConnected
 flag indicating if the camera is successfully connected or not. Caution: thread safe access only! More...
 
int m_ImageSequence
 counter for acquired images More...
 
PropertyList::Pointer m_PropertyList
 a list of the corresponding properties More...
 

Detailed Description

Interface for all representations of Kinect devices. KinectDevice internally holds an instance of KinectController and starts a thread that continuously grabs images from the controller. A buffer structure buffers the last acquired images to provide the image data loss-less.

Exceptions
mitkExceptionIn case of no connection, an exception is thrown!

Definition at line 38 of file mitkKinectDevice.h.

Constructor & Destructor Documentation

◆ KinectDevice()

mitk::KinectDevice::KinectDevice ( )
protected

Definition at line 22 of file mitkKinectDevice.cpp.

References m_Controller, and mitk::KinectController::New().

◆ ~KinectDevice()

mitk::KinectDevice::~KinectDevice ( )
protected

Definition at line 27 of file mitkKinectDevice.cpp.

Member Function Documentation

◆ Acquire()

ITK_THREAD_RETURN_TYPE mitk::KinectDevice::Acquire ( void *  pInfoStruct)
staticprotected

◆ Clone()

Pointer mitk::KinectDevice::Clone ( ) const

◆ DisconnectCamera()

◆ GetAllImages()

void mitk::KinectDevice::GetAllImages ( float *  distanceArray,
float *  amplitudeArray,
float *  intensityArray,
char *  sourceDataArray,
int  requiredImageSequence,
int &  capturedImageSequence,
unsigned char *  rgbDataArray = nullptr 
)
virtual

gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.

Parameters
distanceArraycontains the returned distance data as an array.
amplitudeArraycontains the returned amplitude data as an array.
capturedImageSequencethe actually captured image sequence number.

Implements mitk::ToFCameraDevice.

Definition at line 259 of file mitkKinectDevice.cpp.

References m_AmplitudeDataBuffer, mitk::ToFCameraDevice::m_BufferSize, mitk::ToFCameraDevice::m_CameraActive, m_Controller, mitk::ToFCameraDevice::m_CurrentPos, m_DistanceDataBuffer, mitk::ToFCameraDevice::m_ImageSequence, mitk::ToFCameraDevice::m_PixelNumber, m_RGBDataBuffer, mitk::ToFCameraDevice::m_RGBPixelNumber, MITK_INFO, and MITK_WARN.

◆ GetAmplitudes()

void mitk::KinectDevice::GetAmplitudes ( float *  amplitudeArray,
int &  imageSequence 
)
virtual

gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images. These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value

Parameters
imageSequencethe actually captured image sequence number
amplitudeArraycontains the returned amplitude data as an array.

Implements mitk::ToFCameraDevice.

Definition at line 226 of file mitkKinectDevice.cpp.

References mitk::ToFCameraDevice::m_CameraActive, mitk::ToFCameraDevice::m_ImageMutex, mitk::ToFCameraDevice::m_ImageSequence, and MITK_WARN.

◆ GetController()

KinectController::Pointer mitk::KinectDevice::GetController ( )

returns the corresponding camera controller

Definition at line 307 of file mitkKinectDevice.cpp.

References m_Controller.

◆ GetDistances()

void mitk::KinectDevice::GetDistances ( float *  distanceArray,
int &  imageSequence 
)
virtual

gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.

Parameters
distanceArraycontains the returned distances data as an array.
imageSequencethe actually captured image sequence number

Implements mitk::ToFCameraDevice.

Definition at line 245 of file mitkKinectDevice.cpp.

References mitk::ToFCameraDevice::m_CameraActive, mitk::ToFCameraDevice::m_ImageMutex, mitk::ToFCameraDevice::m_ImageSequence, and MITK_WARN.

◆ GetIntensities()

void mitk::KinectDevice::GetIntensities ( float *  intensityArray,
int &  imageSequence 
)
virtual

gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.

Parameters
intensityArraycontains the returned intensities data as an array.
imageSequencethe actually captured image sequence number

Implements mitk::ToFCameraDevice.

Definition at line 241 of file mitkKinectDevice.cpp.

◆ GetNextPos()

void mitk::KinectDevice::GetNextPos ( )
protected

moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer

◆ GetRGBCaptureHeight()

int mitk::KinectDevice::GetRGBCaptureHeight ( )
virtual

returns the height of the RGB image

Reimplemented from mitk::ToFCameraDevice.

Definition at line 335 of file mitkKinectDevice.cpp.

References mitk::ToFCameraDevice::GetCaptureHeight().

◆ GetRGBCaptureWidth()

int mitk::KinectDevice::GetRGBCaptureWidth ( )
virtual

returns the width of the RGB image

Reimplemented from mitk::ToFCameraDevice.

Definition at line 330 of file mitkKinectDevice.cpp.

References mitk::ToFCameraDevice::GetCaptureWidth().

◆ IsCameraActive()

bool mitk::KinectDevice::IsCameraActive ( )
virtual

returns whether the camera is currently active or not

Reimplemented from mitk::ToFCameraDevice.

Definition at line 148 of file mitkKinectDevice.cpp.

References mitk::ToFCameraDevice::m_CameraActive, and mitk::ToFCameraDevice::m_CameraActiveMutex.

Referenced by Acquire().

◆ mitkClassMacro()

mitk::KinectDevice::mitkClassMacro ( KinectDevice  ,
ToFCameraDevice   
)

◆ New()

static Pointer mitk::KinectDevice::New ( )
static

◆ OnConnectCamera()

◆ SetProperty()

void mitk::KinectDevice::SetProperty ( const char *  propertyKey,
BaseProperty propertyValue 
)
virtual

◆ StartCamera()

void mitk::KinectDevice::StartCamera ( )
virtual

starts the continuous updating of the camera. A separate thread updates the source data, the main thread processes the source data and creates images and coordinates

Exceptions
mitkExceptionIn case of no connection, an exception is thrown!

Implements mitk::ToFCameraDevice.

Definition at line 108 of file mitkKinectDevice.cpp.

References Acquire(), m_AmplitudeDataBuffer, mitk::ToFCameraDevice::m_BufferSize, mitk::ToFCameraDevice::m_CameraActive, mitk::ToFCameraDevice::m_CameraActiveMutex, mitk::ToFCameraDevice::m_CameraConnected, m_Controller, mitk::ToFCameraDevice::m_CurrentPos, m_DistanceDataBuffer, mitk::ToFCameraDevice::m_FreePos, mitk::ToFCameraDevice::m_ImageMutex, mitk::ToFCameraDevice::m_ImageSequence, mitk::ToFCameraDevice::m_MultiThreader, m_RGBDataBuffer, mitk::ToFCameraDevice::m_ThreadID, and MITK_INFO.

◆ StopCamera()

void mitk::KinectDevice::StopCamera ( )
virtual

◆ UpdateCamera()

void mitk::KinectDevice::UpdateCamera ( )
virtual

updates the camera for image acquisition

Exceptions
mitkExceptionIn case of no connection, an exception is thrown!

Implements mitk::ToFCameraDevice.

Definition at line 156 of file mitkKinectDevice.cpp.

References m_Controller.

Referenced by Acquire().

Member Data Documentation

◆ m_AmplitudeDataBuffer

float** mitk::KinectDevice::m_AmplitudeDataBuffer
protected

buffer holding the last infra-red (IR) images

Definition at line 138 of file mitkKinectDevice.h.

Referenced by Acquire(), DisconnectCamera(), GetAllImages(), OnConnectCamera(), and StartCamera().

◆ m_Controller

KinectController::Pointer mitk::KinectDevice::m_Controller
protected

◆ m_DistanceDataBuffer

float** mitk::KinectDevice::m_DistanceDataBuffer
protected

buffer holding the last distance images

Definition at line 137 of file mitkKinectDevice.h.

Referenced by Acquire(), DisconnectCamera(), GetAllImages(), OnConnectCamera(), and StartCamera().

◆ m_RGBDataBuffer

unsigned char** mitk::KinectDevice::m_RGBDataBuffer
protected

buffer holding the last RGB image

Definition at line 139 of file mitkKinectDevice.h.

Referenced by Acquire(), DisconnectCamera(), GetAllImages(), OnConnectCamera(), and StartCamera().


The documentation for this class was generated from the following files: