Medical Imaging Interaction Toolkit  2023.04.00
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 () override
 
 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 ()
 

Protected Member Functions

void RecordData ()
 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...
 
std::thread m_Thread
 
std::mutex 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 44 of file mitkToFImageRecorder.h.

Member Enumeration Documentation

◆ RecordMode

Enumerator
PerFrames 
Infinite 

Definition at line 84 of file mitkToFImageRecorder.h.

Constructor & Destructor Documentation

◆ ToFImageRecorder()

mitk::ToFImageRecorder::ToFImageRecorder ( )

◆ ~ToFImageRecorder()

mitk::ToFImageRecorder::~ToFImageRecorder ( )
override

Member Function Documentation

◆ Clone()

Pointer mitk::ToFImageRecorder::Clone ( ) const

◆ GetAmplitudeImageFileName()

virtual std::string mitk::ToFImageRecorder::GetAmplitudeImageFileName ( )
virtual

◆ GetAmplitudeImageSelected()

virtual bool mitk::ToFImageRecorder::GetAmplitudeImageSelected ( )
virtual

◆ GetCameraDevice()

ToFCameraDevice* mitk::ToFImageRecorder::GetCameraDevice ( )

Get the device used for acquiring ToF images.

Returns
ToF camera device used.

◆ GetDistanceImageFileName()

virtual std::string mitk::ToFImageRecorder::GetDistanceImageFileName ( )
virtual

◆ GetDistanceImageSelected()

virtual bool mitk::ToFImageRecorder::GetDistanceImageSelected ( )
virtual

◆ GetFileFormat()

virtual std::string mitk::ToFImageRecorder::GetFileFormat ( )
virtual

◆ GetIntensityImageFileName()

virtual std::string mitk::ToFImageRecorder::GetIntensityImageFileName ( )
virtual

◆ GetIntensityImageSelected()

virtual bool mitk::ToFImageRecorder::GetIntensityImageSelected ( )
virtual

◆ GetNumOfFrames()

virtual int mitk::ToFImageRecorder::GetNumOfFrames ( )
virtual

◆ GetRecordMode()

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")

◆ GetRGBCaptureHeight()

virtual int mitk::ToFImageRecorder::GetRGBCaptureHeight ( )
virtual

◆ GetRGBCaptureWidth()

virtual int mitk::ToFImageRecorder::GetRGBCaptureWidth ( )
virtual

◆ GetRGBImageFileName()

virtual std::string mitk::ToFImageRecorder::GetRGBImageFileName ( )
virtual

◆ GetRGBImageSelected()

virtual bool mitk::ToFImageRecorder::GetRGBImageSelected ( )
virtual

◆ GetToFCaptureHeight()

virtual int mitk::ToFImageRecorder::GetToFCaptureHeight ( )
virtual

◆ GetToFCaptureWidth()

virtual int mitk::ToFImageRecorder::GetToFCaptureWidth ( )
virtual

◆ GetToFImageType()

ToFImageWriter::ToFImageType mitk::ToFImageRecorder::GetToFImageType ( )

Get the type of image to be recorded.

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

◆ mitkClassMacroItkParent()

mitk::ToFImageRecorder::mitkClassMacroItkParent ( ToFImageRecorder  ,
itk::Object   
)

◆ New()

static Pointer mitk::ToFImageRecorder::New ( )
static

◆ RecordData()

void mitk::ToFImageRecorder::RecordData ( )
protected

Thread method acquiring data via the ToFCameraDevice and recording it to file via the ToFImageWriter.

◆ SetAmplitudeImageFileName()

virtual void mitk::ToFImageRecorder::SetAmplitudeImageFileName ( std::string  _arg)
virtual

◆ SetAmplitudeImageSelected()

virtual void mitk::ToFImageRecorder::SetAmplitudeImageSelected ( bool  _arg)
virtual

◆ SetCameraDevice()

void mitk::ToFImageRecorder::SetCameraDevice ( ToFCameraDevice aToFCameraDevice)

Set the device used for acquiring ToF images.

Parameters
aToFCameraDeviceToF camera device used.

◆ SetDistanceImageFileName()

virtual void mitk::ToFImageRecorder::SetDistanceImageFileName ( std::string  _arg)
virtual

◆ SetDistanceImageSelected()

virtual void mitk::ToFImageRecorder::SetDistanceImageSelected ( bool  _arg)
virtual

◆ SetFileFormat()

virtual void mitk::ToFImageRecorder::SetFileFormat ( std::string  _arg)
virtual

◆ SetIntensityImageFileName()

virtual void mitk::ToFImageRecorder::SetIntensityImageFileName ( std::string  _arg)
virtual

◆ SetIntensityImageSelected()

virtual void mitk::ToFImageRecorder::SetIntensityImageSelected ( bool  _arg)
virtual

◆ SetNumOfFrames()

virtual void mitk::ToFImageRecorder::SetNumOfFrames ( int  _arg)
virtual

◆ SetRecordMode()

void mitk::ToFImageRecorder::SetRecordMode ( ToFImageRecorder::RecordMode  recordMode)

Set the RecordMode.

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

◆ SetRGBImageFileName()

virtual void mitk::ToFImageRecorder::SetRGBImageFileName ( std::string  _arg)
virtual

◆ SetRGBImageSelected()

virtual void mitk::ToFImageRecorder::SetRGBImageSelected ( bool  _arg)
virtual

◆ SetToFImageType()

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)

◆ StartRecording()

void mitk::ToFImageRecorder::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.

◆ StopRecording()

void mitk::ToFImageRecorder::StopRecording ( )

Stops the recording by setting the m_Abort flag to false.

◆ WaitForThreadBeingTerminated()

void mitk::ToFImageRecorder::WaitForThreadBeingTerminated ( )

Wait until thread is terinated.

Member Data Documentation

◆ m_Abort

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 172 of file mitkToFImageRecorder.h.

◆ m_AbortMutex

std::mutex mitk::ToFImageRecorder::m_AbortMutex
protected

mutex for thread-safe data access of abort flag

Definition at line 171 of file mitkToFImageRecorder.h.

◆ m_AmplitudeArray

float* mitk::ToFImageRecorder::m_AmplitudeArray
protected

array holding the amplitude data

Definition at line 147 of file mitkToFImageRecorder.h.

◆ m_AmplitudeImageFileName

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

file name for saving the amplitude image

Definition at line 155 of file mitkToFImageRecorder.h.

◆ m_AmplitudeImageSelected

bool mitk::ToFImageRecorder::m_AmplitudeImageSelected
protected

flag indicating if amplitude image should be recorded

Definition at line 165 of file mitkToFImageRecorder.h.

◆ m_DistanceArray

float* mitk::ToFImageRecorder::m_DistanceArray
protected

array holding the distance data

Definition at line 146 of file mitkToFImageRecorder.h.

◆ m_DistanceImageFileName

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

file name for saving the distance image

Definition at line 154 of file mitkToFImageRecorder.h.

◆ m_DistanceImageSelected

bool mitk::ToFImageRecorder::m_DistanceImageSelected
protected

flag indicating if distance image should be recorded

Definition at line 164 of file mitkToFImageRecorder.h.

◆ m_FileFormat

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

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

Definition at line 162 of file mitkToFImageRecorder.h.

◆ m_ImageSequence

int mitk::ToFImageRecorder::m_ImageSequence
protected

number of images currently acquired

Definition at line 144 of file mitkToFImageRecorder.h.

◆ m_IntensityArray

float* mitk::ToFImageRecorder::m_IntensityArray
protected

array holding the intensity data

Definition at line 145 of file mitkToFImageRecorder.h.

◆ m_IntensityImageFileName

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

file name for saving the intensity image

Definition at line 156 of file mitkToFImageRecorder.h.

◆ m_IntensityImageSelected

bool mitk::ToFImageRecorder::m_IntensityImageSelected
protected

flag indicating if intensity image should be recorded

Definition at line 166 of file mitkToFImageRecorder.h.

◆ m_NumOfFrames

int mitk::ToFImageRecorder::m_NumOfFrames
protected

number of frames to be recorded by this recorder

Definition at line 159 of file mitkToFImageRecorder.h.

◆ m_RecordMode

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

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

Definition at line 161 of file mitkToFImageRecorder.h.

◆ m_RGBArray

unsigned char* mitk::ToFImageRecorder::m_RGBArray
protected

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

Definition at line 148 of file mitkToFImageRecorder.h.

◆ m_RGBCaptureHeight

int mitk::ToFImageRecorder::m_RGBCaptureHeight
protected

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

Definition at line 141 of file mitkToFImageRecorder.h.

◆ m_RGBCaptureWidth

int mitk::ToFImageRecorder::m_RGBCaptureWidth
protected

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

Definition at line 140 of file mitkToFImageRecorder.h.

◆ m_RGBImageFileName

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

file name for saving the rgb image

Definition at line 157 of file mitkToFImageRecorder.h.

◆ m_RGBImageSelected

bool mitk::ToFImageRecorder::m_RGBImageSelected
protected

flag indicating if rgb image should be recorded

Definition at line 167 of file mitkToFImageRecorder.h.

◆ m_RGBPixelNumber

int mitk::ToFImageRecorder::m_RGBPixelNumber
protected

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

Definition at line 142 of file mitkToFImageRecorder.h.

◆ m_SourceDataArray

char* mitk::ToFImageRecorder::m_SourceDataArray
protected

array holding the source data

Definition at line 149 of file mitkToFImageRecorder.h.

◆ m_SourceDataSize

int mitk::ToFImageRecorder::m_SourceDataSize
protected

size of the source data provided by the device

Definition at line 143 of file mitkToFImageRecorder.h.

◆ m_Thread

std::thread mitk::ToFImageRecorder::m_Thread
protected

Definition at line 170 of file mitkToFImageRecorder.h.

◆ m_ToFCameraDevice

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

ToFCameraDevice used for acquiring the images.

Definition at line 136 of file mitkToFImageRecorder.h.

◆ m_ToFCaptureHeight

int mitk::ToFImageRecorder::m_ToFCaptureHeight
protected

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

Definition at line 138 of file mitkToFImageRecorder.h.

◆ m_ToFCaptureWidth

int mitk::ToFImageRecorder::m_ToFCaptureWidth
protected

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

Definition at line 137 of file mitkToFImageRecorder.h.

◆ m_ToFImageType

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

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

Definition at line 160 of file mitkToFImageRecorder.h.

◆ m_ToFImageWriter

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

image writer writing the acquired images to a file

Definition at line 152 of file mitkToFImageRecorder.h.

◆ m_ToFPixelNumber

int mitk::ToFImageRecorder::m_ToFPixelNumber
protected

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

Definition at line 139 of file mitkToFImageRecorder.h.


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