Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkToFImageRecorder.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found 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"
18 #include "mitkToFImageCsvWriter.h"
19 #include "mitkToFNrrdImageWriter.h"
20 
21 #include <itkObject.h>
22 #include <itkObjectFactory.h>
23 #include <itkCommand.h>
24 
25 #include <mutex>
26 #include <thread>
27 
28 namespace mitk
29 {
44 class MITKTOFHARDWARE_EXPORT ToFImageRecorder : public itk::Object
45 {
46 public:
47 
49 
50  ~ToFImageRecorder() override;
51 
53 
54  itkFactorylessNewMacro(Self);
55 
56  itkCloneMacro(Self);
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 
128 protected:
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 
174 private:
175 
176 };
177 } //END mitk namespace
178 #endif
mitk::ToFImageWriter::ToFImageType
ToFImageType
Definition: mitkToFImageWriter.h:76
mitk::ToFImageRecorder::m_FileFormat
std::string m_FileFormat
file format for saving images. If .csv is chosen, ToFImageCsvWriter is used
Definition: mitkToFImageRecorder.h:162
mitk::ToFImageRecorder::m_IntensityImageSelected
bool m_IntensityImageSelected
flag indicating if intensity image should be recorded
Definition: mitkToFImageRecorder.h:166
mitk::ToFImageRecorder::m_Thread
std::thread m_Thread
Definition: mitkToFImageRecorder.h:170
mitk::ToFImageRecorder::m_AbortMutex
std::mutex m_AbortMutex
mutex for thread-safe data access of abort flag
Definition: mitkToFImageRecorder.h:171
mitk::ToFImageRecorder::m_IntensityArray
float * m_IntensityArray
array holding the intensity data
Definition: mitkToFImageRecorder.h:145
mitk::ToFImageRecorder::m_NumOfFrames
int m_NumOfFrames
number of frames to be recorded by this recorder
Definition: mitkToFImageRecorder.h:159
mitk::ToFImageRecorder::m_RGBImageSelected
bool m_RGBImageSelected
flag indicating if rgb image should be recorded
Definition: mitkToFImageRecorder.h:167
mitk::ToFImageRecorder::RecordMode
RecordMode
Definition: mitkToFImageRecorder.h:84
mitk::ToFImageRecorder::m_AmplitudeImageFileName
std::string m_AmplitudeImageFileName
file name for saving the amplitude image
Definition: mitkToFImageRecorder.h:155
mitk::ToFImageRecorder::m_ToFImageWriter
ToFImageWriter::Pointer m_ToFImageWriter
image writer writing the acquired images to a file
Definition: mitkToFImageRecorder.h:152
mitk::ToFImageRecorder::m_SourceDataSize
int m_SourceDataSize
size of the source data provided by the device
Definition: mitkToFImageRecorder.h:143
mitk::ToFImageRecorder::m_IntensityImageFileName
std::string m_IntensityImageFileName
file name for saving the intensity image
Definition: mitkToFImageRecorder.h:156
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ToFImageRecorder::m_ToFPixelNumber
int m_ToFPixelNumber
number of pixels (widht*height) of the images to record
Definition: mitkToFImageRecorder.h:139
mitk::ToFImageRecorder::m_DistanceImageSelected
bool m_DistanceImageSelected
flag indicating if distance image should be recorded
Definition: mitkToFImageRecorder.h:164
mitk::ToFImageRecorder::m_AmplitudeArray
float * m_AmplitudeArray
array holding the amplitude data
Definition: mitkToFImageRecorder.h:147
mitk::ToFImageRecorder::m_ToFCameraDevice
ToFCameraDevice::Pointer m_ToFCameraDevice
ToFCameraDevice used for acquiring the images.
Definition: mitkToFImageRecorder.h:136
mitkCommon.h
mitk::ToFImageRecorder::m_RecordMode
ToFImageRecorder::RecordMode m_RecordMode
mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite)
Definition: mitkToFImageRecorder.h:161
mitk::ToFImageRecorder::m_ImageSequence
int m_ImageSequence
number of images currently acquired
Definition: mitkToFImageRecorder.h:144
mitk::ToFImageRecorder::m_SourceDataArray
char * m_SourceDataArray
array holding the source data
Definition: mitkToFImageRecorder.h:149
mitk::ToFImageRecorder::m_ToFImageType
ToFImageWriter::ToFImageType m_ToFImageType
type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)
Definition: mitkToFImageRecorder.h:160
mitk::ToFImageRecorder
Recorder class for ToF images.
Definition: mitkToFImageRecorder.h:44
mitk::ToFImageRecorder::m_RGBImageFileName
std::string m_RGBImageFileName
file name for saving the rgb image
Definition: mitkToFImageRecorder.h:157
mitk::ToFImageRecorder::m_RGBCaptureWidth
int m_RGBCaptureWidth
width (x-dimension) of the images to record.
Definition: mitkToFImageRecorder.h:140
mitk::ToFImageRecorder::m_RGBCaptureHeight
int m_RGBCaptureHeight
height (y-dimension) of the images to record.
Definition: mitkToFImageRecorder.h:141
mitk::ToFImageRecorder::m_ToFCaptureWidth
int m_ToFCaptureWidth
width (x-dimension) of the images to record.
Definition: mitkToFImageRecorder.h:137
mitk::ToFImageRecorder::m_RGBPixelNumber
int m_RGBPixelNumber
number of pixels (widht*height) of the images to record
Definition: mitkToFImageRecorder.h:142
mitk::ToFCameraDevice
Virtual interface and base class for all Time-of-Flight devices.
Definition: mitkToFCameraDevice.h:37
mitkToFCameraDevice.h
mitk::ToFImageRecorder::m_DistanceImageFileName
std::string m_DistanceImageFileName
file name for saving the distance image
Definition: mitkToFImageRecorder.h:154
mitk::ToFImageRecorder::m_Abort
bool m_Abort
flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combin...
Definition: mitkToFImageRecorder.h:172
mitk::ToFImageRecorder::m_ToFCaptureHeight
int m_ToFCaptureHeight
height (y-dimension) of the images to record.
Definition: mitkToFImageRecorder.h:138
mitkToFNrrdImageWriter.h
mitk::ToFImageRecorder::m_AmplitudeImageSelected
bool m_AmplitudeImageSelected
flag indicating if amplitude image should be recorded
Definition: mitkToFImageRecorder.h:165
mitkToFImageCsvWriter.h
mitk::ToFImageRecorder::m_RGBArray
unsigned char * m_RGBArray
array holding the RGB data if available (e.g. for Kinect)
Definition: mitkToFImageRecorder.h:148
mitk::ToFImageRecorder::m_DistanceArray
float * m_DistanceArray
array holding the distance data
Definition: mitkToFImageRecorder.h:146