Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::ToFImageRecorder Class Reference

Recorder class for ToF images. More...

#include <mitkToFImageRecorder.h>

Inheritance diagram for mitk::ToFImageRecorder:
Collaboration diagram for mitk::ToFImageRecorder:

Public Types

enum  RecordMode { PerFrames, Infinite }
 

Public Member Functions

 ToFImageRecorder ()
 
 ~ToFImageRecorder ()
 
 mitkClassMacroItkParent (ToFImageRecorder, itk::Object)
 
Pointer Clone () const
 
virtual std::string GetDistanceImageFileName ()
 
virtual std::string GetAmplitudeImageFileName ()
 
virtual std::string GetIntensityImageFileName ()
 
virtual std::string GetRGBImageFileName ()
 
virtual int GetToFCaptureWidth ()
 
virtual int GetToFCaptureHeight ()
 
virtual int GetRGBCaptureWidth ()
 
virtual int GetRGBCaptureHeight ()
 
virtual bool GetDistanceImageSelected ()
 
virtual bool GetAmplitudeImageSelected ()
 
virtual bool GetIntensityImageSelected ()
 
virtual bool GetRGBImageSelected ()
 
virtual int GetNumOfFrames ()
 
virtual std::string GetFileFormat ()
 
virtual void SetDistanceImageFileName (std::string _arg)
 
virtual void SetAmplitudeImageFileName (std::string _arg)
 
virtual void SetIntensityImageFileName (std::string _arg)
 
virtual void SetRGBImageFileName (std::string _arg)
 
virtual void SetDistanceImageSelected (bool _arg)
 
virtual void SetAmplitudeImageSelected (bool _arg)
 
virtual void SetIntensityImageSelected (bool _arg)
 
virtual void SetRGBImageSelected (bool _arg)
 
virtual void SetNumOfFrames (int _arg)
 
virtual void SetFileFormat (std::string _arg)
 
ToFImageRecorder::RecordMode GetRecordMode ()
 Returns the currently set RecordMode. More...
 
void SetRecordMode (ToFImageRecorder::RecordMode recordMode)
 Set the RecordMode. More...
 
void SetCameraDevice (ToFCameraDevice *aToFCameraDevice)
 Set the device used for acquiring ToF images. More...
 
ToFCameraDeviceGetCameraDevice ()
 Get the device used for acquiring ToF images. More...
 
ToFImageWriter::ToFImageType GetToFImageType ()
 Get the type of image to be recorded. More...
 
void SetToFImageType (ToFImageWriter::ToFImageType toFImageType)
 Set the type of image to be recorded. More...
 
void StartRecording ()
 Starts the recording by spawning a Thread which streams the data to a file. Aborting of the record process is controlled by the m_Abort flag. More...
 
void StopRecording ()
 Stops the recording by setting the m_Abort flag to false. More...
 
void WaitForThreadBeingTerminated ()
 Wait until thread is terinated. More...
 

Static Public Member Functions

static Pointer New ()
 

Static Protected Member Functions

static ITK_THREAD_RETURN_TYPE RecordData (void *pInfoStruct)
 Thread method acquiring data via the ToFCameraDevice and recording it to file via the ToFImageWriter. More...
 

Protected Attributes

ToFCameraDevice::Pointer m_ToFCameraDevice
 ToFCameraDevice used for acquiring the images. More...
 
int m_ToFCaptureWidth
 width (x-dimension) of the images to record. More...
 
int m_ToFCaptureHeight
 height (y-dimension) of the images to record. More...
 
int m_ToFPixelNumber
 number of pixels (widht*height) of the images to record More...
 
int m_RGBCaptureWidth
 width (x-dimension) of the images to record. More...
 
int m_RGBCaptureHeight
 height (y-dimension) of the images to record. More...
 
int m_RGBPixelNumber
 number of pixels (widht*height) of the images to record More...
 
int m_SourceDataSize
 size of the source data provided by the device More...
 
int m_ImageSequence
 number of images currently acquired More...
 
float * m_IntensityArray
 array holding the intensity data More...
 
float * m_DistanceArray
 array holding the distance data More...
 
float * m_AmplitudeArray
 array holding the amplitude data More...
 
unsigned char * m_RGBArray
 array holding the RGB data if available (e.g. for Kinect) More...
 
char * m_SourceDataArray
 array holding the source data More...
 
ToFImageWriter::Pointer m_ToFImageWriter
 image writer writing the acquired images to a file More...
 
std::string m_DistanceImageFileName
 file name for saving the distance image More...
 
std::string m_AmplitudeImageFileName
 file name for saving the amplitude image More...
 
std::string m_IntensityImageFileName
 file name for saving the intensity image More...
 
std::string m_RGBImageFileName
 file name for saving the rgb image More...
 
int m_NumOfFrames
 number of frames to be recorded by this recorder More...
 
ToFImageWriter::ToFImageType m_ToFImageType
 type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1) More...
 
ToFImageRecorder::RecordMode m_RecordMode
 mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite) More...
 
std::string m_FileFormat
 file format for saving images. If .csv is chosen, ToFImageCsvWriter is used More...
 
bool m_DistanceImageSelected
 flag indicating if distance image should be recorded More...
 
bool m_AmplitudeImageSelected
 flag indicating if amplitude image should be recorded More...
 
bool m_IntensityImageSelected
 flag indicating if intensity image should be recorded More...
 
bool m_RGBImageSelected
 flag indicating if rgb image should be recorded More...
 
itk::MultiThreader::Pointer m_MultiThreader
 member for thread-handling (ITK-based) More...
 
int m_ThreadID
 ID of the thread recording the data. More...
 
itk::FastMutexLock::Pointer m_AbortMutex
 mutex for thread-safe data access of abort flag More...
 
bool m_Abort
 flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combination with m_AbortMutex More...
 

Detailed Description

Recorder class for ToF images.

This class represents a recorder for ToF data. A ToFCameraDevice is used to acquire the data. The acquired images are then added to a ToFImageWriter that performs the actual writing.

Recording can be performed either frame-based or continuously.

Warning
It is currently not guaranteed that all acquired images are recorded, since the recording is done in a newly spawned thread. However, in practise only very few images are lost. See bug #12997 for more details.

Definition at line 46 of file mitkToFImageRecorder.h.

Member Enumeration Documentation

Enumerator
PerFrames 
Infinite 

Definition at line 85 of file mitkToFImageRecorder.h.

Constructor & Destructor Documentation

mitk::ToFImageRecorder::~ToFImageRecorder ( )

Member Function Documentation

Pointer mitk::ToFImageRecorder::Clone ( ) const
virtual std::string mitk::ToFImageRecorder::GetAmplitudeImageFileName ( )
virtual
virtual bool mitk::ToFImageRecorder::GetAmplitudeImageSelected ( )
virtual
ToFCameraDevice * mitk::ToFImageRecorder::GetCameraDevice ( )

Get the device used for acquiring ToF images.

Returns
ToF camera device used.

Definition at line 243 of file mitkToFImageRecorder.cpp.

References m_ToFCameraDevice.

Referenced by RecordData().

virtual std::string mitk::ToFImageRecorder::GetDistanceImageFileName ( )
virtual
virtual bool mitk::ToFImageRecorder::GetDistanceImageSelected ( )
virtual
virtual std::string mitk::ToFImageRecorder::GetFileFormat ( )
virtual
virtual std::string mitk::ToFImageRecorder::GetIntensityImageFileName ( )
virtual
virtual bool mitk::ToFImageRecorder::GetIntensityImageSelected ( )
virtual
virtual int mitk::ToFImageRecorder::GetNumOfFrames ( )
virtual
ToFImageRecorder::RecordMode mitk::ToFImageRecorder::GetRecordMode ( )

Returns the currently set RecordMode.

Returns
record mode: PerFrames ("Record specified number of frames"), Infinite ("Record until abort is required")

Definition at line 258 of file mitkToFImageRecorder.cpp.

References m_RecordMode.

virtual int mitk::ToFImageRecorder::GetRGBCaptureHeight ( )
virtual
virtual int mitk::ToFImageRecorder::GetRGBCaptureWidth ( )
virtual
virtual std::string mitk::ToFImageRecorder::GetRGBImageFileName ( )
virtual
virtual bool mitk::ToFImageRecorder::GetRGBImageSelected ( )
virtual
virtual int mitk::ToFImageRecorder::GetToFCaptureHeight ( )
virtual
virtual int mitk::ToFImageRecorder::GetToFCaptureWidth ( )
virtual
ToFImageWriter::ToFImageType mitk::ToFImageRecorder::GetToFImageType ( )

Get the type of image to be recorded.

Returns
ToF image type: ToFImageType3D (0) or ToFImageType2DPlusT (1)

Definition at line 248 of file mitkToFImageRecorder.cpp.

References m_ToFImageType.

mitk::ToFImageRecorder::mitkClassMacroItkParent ( ToFImageRecorder  ,
itk::Object   
)
static Pointer mitk::ToFImageRecorder::New ( )
static
ITK_THREAD_RETURN_TYPE mitk::ToFImageRecorder::RecordData ( void *  pInfoStruct)
staticprotected
virtual void mitk::ToFImageRecorder::SetAmplitudeImageFileName ( std::string  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetAmplitudeImageSelected ( bool  _arg)
virtual
void mitk::ToFImageRecorder::SetCameraDevice ( ToFCameraDevice aToFCameraDevice)

Set the device used for acquiring ToF images.

Parameters
aToFCameraDeviceToF camera device used.

Definition at line 238 of file mitkToFImageRecorder.cpp.

References m_ToFCameraDevice.

virtual void mitk::ToFImageRecorder::SetDistanceImageFileName ( std::string  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetDistanceImageSelected ( bool  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetFileFormat ( std::string  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetIntensityImageFileName ( std::string  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetIntensityImageSelected ( bool  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetNumOfFrames ( int  _arg)
virtual
void mitk::ToFImageRecorder::SetRecordMode ( ToFImageRecorder::RecordMode  recordMode)

Set the RecordMode.

Parameters
recordModePerFrames ("Record specified number of frames"), Infinite ("Record until abort is required")

Definition at line 263 of file mitkToFImageRecorder.cpp.

References m_RecordMode.

virtual void mitk::ToFImageRecorder::SetRGBImageFileName ( std::string  _arg)
virtual
virtual void mitk::ToFImageRecorder::SetRGBImageSelected ( bool  _arg)
virtual
void mitk::ToFImageRecorder::SetToFImageType ( ToFImageWriter::ToFImageType  toFImageType)

Set the type of image to be recorded.

Parameters
toFImageTypetype of the ToF image: ToFImageType3D (0) or ToFImageType2DPlusT (1)

Definition at line 253 of file mitkToFImageRecorder.cpp.

References m_ToFImageType.

void mitk::ToFImageRecorder::StopRecording ( )

Stops the recording by setting the m_Abort flag to false.

Definition at line 70 of file mitkToFImageRecorder.cpp.

References m_Abort, and m_AbortMutex.

void mitk::ToFImageRecorder::WaitForThreadBeingTerminated ( )

Wait until thread is terinated.

Definition at line 153 of file mitkToFImageRecorder.cpp.

References m_MultiThreader, and m_ThreadID.

Member Data Documentation

bool mitk::ToFImageRecorder::m_Abort
protected

flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combination with m_AbortMutex

Definition at line 174 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), StopRecording(), and ToFImageRecorder().

itk::FastMutexLock::Pointer mitk::ToFImageRecorder::m_AbortMutex
protected

mutex for thread-safe data access of abort flag

Definition at line 173 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), StopRecording(), and ToFImageRecorder().

float* mitk::ToFImageRecorder::m_AmplitudeArray
protected

array holding the amplitude data

Definition at line 148 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), ToFImageRecorder(), and ~ToFImageRecorder().

std::string mitk::ToFImageRecorder::m_AmplitudeImageFileName
protected

file name for saving the amplitude image

Definition at line 156 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

bool mitk::ToFImageRecorder::m_AmplitudeImageSelected
protected

flag indicating if amplitude image should be recorded

Definition at line 166 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

float* mitk::ToFImageRecorder::m_DistanceArray
protected

array holding the distance data

Definition at line 147 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), ToFImageRecorder(), and ~ToFImageRecorder().

std::string mitk::ToFImageRecorder::m_DistanceImageFileName
protected

file name for saving the distance image

Definition at line 155 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

bool mitk::ToFImageRecorder::m_DistanceImageSelected
protected

flag indicating if distance image should be recorded

Definition at line 165 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

std::string mitk::ToFImageRecorder::m_FileFormat
protected

file format for saving images. If .csv is chosen, ToFImageCsvWriter is used

Definition at line 163 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_ImageSequence
protected

number of images currently acquired

Definition at line 145 of file mitkToFImageRecorder.h.

Referenced by RecordData(), and ToFImageRecorder().

float* mitk::ToFImageRecorder::m_IntensityArray
protected

array holding the intensity data

Definition at line 146 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), ToFImageRecorder(), and ~ToFImageRecorder().

std::string mitk::ToFImageRecorder::m_IntensityImageFileName
protected

file name for saving the intensity image

Definition at line 157 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

bool mitk::ToFImageRecorder::m_IntensityImageSelected
protected

flag indicating if intensity image should be recorded

Definition at line 167 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

itk::MultiThreader::Pointer mitk::ToFImageRecorder::m_MultiThreader
protected

member for thread-handling (ITK-based)

Definition at line 171 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), ToFImageRecorder(), and WaitForThreadBeingTerminated().

int mitk::ToFImageRecorder::m_NumOfFrames
protected

number of frames to be recorded by this recorder

Definition at line 160 of file mitkToFImageRecorder.h.

Referenced by RecordData(), and ToFImageRecorder().

ToFImageRecorder::RecordMode mitk::ToFImageRecorder::m_RecordMode
protected

mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite)

Definition at line 162 of file mitkToFImageRecorder.h.

Referenced by GetRecordMode(), RecordData(), SetRecordMode(), and ToFImageRecorder().

unsigned char* mitk::ToFImageRecorder::m_RGBArray
protected

array holding the RGB data if available (e.g. for Kinect)

Definition at line 149 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), ToFImageRecorder(), and ~ToFImageRecorder().

int mitk::ToFImageRecorder::m_RGBCaptureHeight
protected

height (y-dimension) of the images to record.

Definition at line 142 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_RGBCaptureWidth
protected

width (x-dimension) of the images to record.

Definition at line 141 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

std::string mitk::ToFImageRecorder::m_RGBImageFileName
protected

file name for saving the rgb image

Definition at line 158 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

bool mitk::ToFImageRecorder::m_RGBImageSelected
protected

flag indicating if rgb image should be recorded

Definition at line 168 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_RGBPixelNumber
protected

number of pixels (widht*height) of the images to record

Definition at line 143 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

char* mitk::ToFImageRecorder::m_SourceDataArray
protected

array holding the source data

Definition at line 150 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), ToFImageRecorder(), and ~ToFImageRecorder().

int mitk::ToFImageRecorder::m_SourceDataSize
protected

size of the source data provided by the device

Definition at line 144 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_ThreadID
protected

ID of the thread recording the data.

Definition at line 172 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), ToFImageRecorder(), and WaitForThreadBeingTerminated().

ToFCameraDevice::Pointer mitk::ToFImageRecorder::m_ToFCameraDevice
protected

ToFCameraDevice used for acquiring the images.

Definition at line 137 of file mitkToFImageRecorder.h.

Referenced by GetCameraDevice(), SetCameraDevice(), StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_ToFCaptureHeight
protected

height (y-dimension) of the images to record.

Definition at line 139 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_ToFCaptureWidth
protected

width (x-dimension) of the images to record.

Definition at line 138 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().

ToFImageWriter::ToFImageType mitk::ToFImageRecorder::m_ToFImageType
protected

type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)

Definition at line 161 of file mitkToFImageRecorder.h.

Referenced by GetToFImageType(), SetToFImageType(), StartRecording(), and ToFImageRecorder().

ToFImageWriter::Pointer mitk::ToFImageRecorder::m_ToFImageWriter
protected

image writer writing the acquired images to a file

Definition at line 153 of file mitkToFImageRecorder.h.

Referenced by RecordData(), StartRecording(), and ToFImageRecorder().

int mitk::ToFImageRecorder::m_ToFPixelNumber
protected

number of pixels (widht*height) of the images to record

Definition at line 140 of file mitkToFImageRecorder.h.

Referenced by StartRecording(), and ToFImageRecorder().


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