19 #include "itkMultiThreader.h"
20 #include <itksys/SystemTools.hxx>
121 this->m_FreePos = (this->m_FreePos+1) % this->
m_BufferSize;
131 itksys::SystemTools::Delay(10);
144 itksys::SystemTools::Delay(100);
150 itksys::SystemTools::Delay(10);
172 struct itk::MultiThreader::ThreadInfoStruct * pInfo = (
struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
175 return ITK_THREAD_RETURN_VALUE;
177 if (pInfo->UserData == NULL)
179 return ITK_THREAD_RETURN_VALUE;
182 if (toFCameraDevice!=NULL)
187 t1 = realTimeClock->GetCurrentStamp();
189 bool overflow =
false;
190 bool printStatus =
false;
203 toFCameraDevice->Modified();
224 t2 = realTimeClock->GetCurrentStamp() - t1;
226 t1 = realTimeClock->GetCurrentStamp();
231 return ITK_THREAD_RETURN_VALUE;
248 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
266 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
284 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
290 int requiredImageSequence,
int& capturedImageSequence,
unsigned char* rgbDataArray)
304 if ((requiredImageSequence < 0) || (requiredImageSequence > this->
m_ImageSequence))
317 capturedImageSequence = requiredImageSequence;
331 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
344 if (strcmp(propertyKey,
"ModulationFrequency") == 0)
346 int modulationFrequency = 0;
348 m_Controller->SetModulationFrequency(modulationFrequency);
350 else if (strcmp(propertyKey,
"IntegrationTime") == 0)
352 int integrationTime = 0;
virtual void GetIntensities(float *intensityArray, int &imageSequence)
gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible fo...
virtual bool IsCameraActive()
returns whether the camera is currently active or not
itk::SmartPointer< Self > Pointer
virtual void SetProperty(const char *propertyKey, BaseProperty *propertyValue)
set a BaseProperty
virtual void GetDistances(float *distanceArray, int &imageSequence)
gets the distance data from the ToF camera measuring the distance between the camera and the differen...
float * m_IntensityArray
float array holding the intensity image
virtual void StopCamera()
stops the continuous updating of the camera
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.
bool GetIntProperty(const char *propertyKey, int &integer)
get an int from the property list
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.
static ITK_THREAD_RETURN_TYPE Acquire(void *pInfoStruct)
Thread method continuously acquiring images from the ToF hardware.
virtual void SetProperty(const char *propertyKey, BaseProperty *propertyValue)
set a BaseProperty property in the property list
bool m_CameraActive
flag indicating if the camera is currently active or not. Caution: thread safe access only! ...
float ** m_AmplitudeDataBuffer
buffer holding the last amplitude images
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! ...
Interface for all representations of MESA ToF devices. ToFCameraMESADevice internally holds an instan...
int m_CaptureWidth
width of the range image (x dimension)
ToFCameraMESAController::Pointer GetController()
returns the corresponding camera controller
virtual bool OnConnectCamera()
opens a connection to the ToF camera
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.
float ** m_DistanceDataBuffer
buffer holding the last distance images
int m_CaptureHeight
height of the range image (y dimension)
virtual void StartCamera()
starts the continuous updating of the camera. A separate thread updates the source data...
virtual bool DisconnectCamera()
closes the connection to the camera
virtual void GetAllImages(float *distanceArray, float *amplitudeArray, float *intensityArray, char *sourceDataArray, int requiredImageSequence, int &capturedImageSequence, unsigned char *rgbDataArray=NULL)
gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsi...
float * m_AmplitudeArray
float array holding the amplitude image
static Pointer New(void)
instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.
float ** m_IntensityDataBuffer
buffer holding the last intensity images
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...
virtual void UpdateCamera()
updates the camera for image acquisition
int m_ImageSequence
counter for acquired images
ToFCameraMESAController::Pointer m_Controller
corresponding CameraController