MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFImageRecorder.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12#ifndef mitkToFImageRecorder_h
13#define mitkToFImageRecorder_h
14
15#include "MitkToFHardwareExports.h"
16#include <mitkCommon.h>
17#include "mitkToFCameraDevice.h"
20
21#include <itkObject.h>
22#include <itkObjectFactory.h>
23#include <itkCommand.h>
24
25#include <mutex>
26#include <thread>
27
28namespace mitk
29{
44class MITKTOFHARDWARE_EXPORT ToFImageRecorder : public itk::Object
45{
46public:
47
49
50 ~ToFImageRecorder() override;
51
53
55
57
58 itkGetMacro( DistanceImageFileName, std::string );
59 itkGetMacro( AmplitudeImageFileName, std::string );
60 itkGetMacro( IntensityImageFileName, std::string );
61 itkGetMacro( RGBImageFileName, std::string );
62 itkGetMacro( ToFCaptureWidth, int );
63 itkGetMacro( ToFCaptureHeight, int );
64 itkGetMacro( RGBCaptureWidth, int );
65 itkGetMacro( RGBCaptureHeight, int );
66 itkGetMacro( DistanceImageSelected, bool );
67 itkGetMacro( AmplitudeImageSelected, bool );
68 itkGetMacro( IntensityImageSelected, bool );
69 itkGetMacro( RGBImageSelected, bool );
70 itkGetMacro( NumOfFrames, int );
71 itkGetMacro( FileFormat, std::string );
72
73 itkSetMacro( DistanceImageFileName, std::string );
74 itkSetMacro( AmplitudeImageFileName, std::string );
75 itkSetMacro( IntensityImageFileName, std::string );
76 itkSetMacro(RGBImageFileName, std::string );
77 itkSetMacro( DistanceImageSelected, bool );
78 itkSetMacro( AmplitudeImageSelected, bool );
79 itkSetMacro( IntensityImageSelected, bool );
80 itkSetMacro( RGBImageSelected, bool );
81 itkSetMacro( NumOfFrames, int );
82 itkSetMacro( FileFormat, std::string );
83
84 enum RecordMode{ PerFrames, Infinite };
89 ToFImageRecorder::RecordMode GetRecordMode();
94 void SetRecordMode(ToFImageRecorder::RecordMode recordMode);
99 void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
104 ToFCameraDevice* GetCameraDevice();
109 ToFImageWriter::ToFImageType GetToFImageType();
114 void SetToFImageType(ToFImageWriter::ToFImageType toFImageType);
118 void StartRecording();
122 void StopRecording();
126 void WaitForThreadBeingTerminated();
127
128protected:
129
133 void RecordData();
134
135 // data acquisition
136 ToFCameraDevice::Pointer m_ToFCameraDevice;
148 unsigned char* m_RGBArray;
150
151 // data writing
152 ToFImageWriter::Pointer m_ToFImageWriter;
153
157 std::string m_RGBImageFileName;
158
162 std::string m_FileFormat;
163
168
169 // threading
170 std::thread m_Thread;
171 std::mutex m_AbortMutex;
172 bool m_Abort;
173
174private:
175
176};
177} //END mitk namespace
178#endif
Virtual interface and base class for all Time-of-Flight devices.
Recorder class for ToF images.
char * m_SourceDataArray
array holding the source data
bool m_AmplitudeImageSelected
flag indicating if amplitude image should be recorded
int m_SourceDataSize
size of the source data provided by the device
itkGetMacro(RGBCaptureHeight, int)
itkSetMacro(IntensityImageFileName, std::string)
itkGetMacro(AmplitudeImageSelected, bool)
itkGetMacro(IntensityImageFileName, std::string)
itkGetMacro(RGBImageFileName, std::string)
int m_RGBCaptureHeight
height (y-dimension) of the images to record.
itkGetMacro(NumOfFrames, int)
int m_ImageSequence
number of images currently acquired
itkGetMacro(IntensityImageSelected, bool)
mitkClassMacroItkParent(ToFImageRecorder, itk::Object)
ToFImageWriter::ToFImageType m_ToFImageType
type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)
itkSetMacro(RGBImageFileName, std::string)
itkSetMacro(NumOfFrames, int)
itkSetMacro(IntensityImageSelected, bool)
itkSetMacro(AmplitudeImageFileName, std::string)
float * m_IntensityArray
array holding the intensity data
float * m_DistanceArray
array holding the distance data
itkSetMacro(FileFormat, std::string)
bool m_DistanceImageSelected
flag indicating if distance image should be recorded
itkSetMacro(DistanceImageSelected, bool)
std::string m_DistanceImageFileName
file name for saving the distance image
int m_ToFCaptureHeight
height (y-dimension) of the images to record.
bool m_Abort
flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combin...
std::string m_FileFormat
file format for saving images. If .csv is chosen, ToFImageCsvWriter is used
std::string m_RGBImageFileName
file name for saving the rgb image
std::mutex m_AbortMutex
mutex for thread-safe data access of abort flag
float * m_AmplitudeArray
array holding the amplitude data
itkSetMacro(AmplitudeImageSelected, bool)
itkSetMacro(RGBImageSelected, bool)
ToFImageRecorder::RecordMode m_RecordMode
mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite)
ToFImageWriter::Pointer m_ToFImageWriter
image writer writing the acquired images to a file
std::string m_IntensityImageFileName
file name for saving the intensity image
itkGetMacro(RGBImageSelected, bool)
int m_RGBCaptureWidth
width (x-dimension) of the images to record.
bool m_RGBImageSelected
flag indicating if rgb image should be recorded
int m_ToFPixelNumber
number of pixels (widht*height) of the images to record
std::string m_AmplitudeImageFileName
file name for saving the amplitude image
itkGetMacro(AmplitudeImageFileName, std::string)
itkGetMacro(FileFormat, std::string)
itkGetMacro(DistanceImageSelected, bool)
ToFCameraDevice::Pointer m_ToFCameraDevice
ToFCameraDevice used for acquiring the images.
unsigned char * m_RGBArray
array holding the RGB data if available (e.g. for Kinect)
itkGetMacro(ToFCaptureWidth, int)
itkGetMacro(DistanceImageFileName, std::string)
bool m_IntensityImageSelected
flag indicating if intensity image should be recorded
int m_NumOfFrames
number of frames to be recorded by this recorder
int m_RGBPixelNumber
number of pixels (widht*height) of the images to record
int m_ToFCaptureWidth
width (x-dimension) of the images to record.
itkGetMacro(RGBCaptureWidth, int)
itkSetMacro(DistanceImageFileName, std::string)
itkGetMacro(ToFCaptureHeight, int)
IGT Exceptions.