Medical Imaging Interaction Toolkit  2018.4.99-07c45cb1
Medical Imaging Interaction Toolkit
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 <itkFastMutexLock.h>
24 #include <itkCommand.h>
25 
26 namespace mitk
27 {
42 class MITKTOFHARDWARE_EXPORT ToFImageRecorder : public itk::Object
43 {
44 public:
45 
47 
48  ~ToFImageRecorder() override;
49 
51 
52  itkFactorylessNewMacro(Self);
53 
54  itkCloneMacro(Self);
55 
56  itkGetMacro( DistanceImageFileName, std::string );
57  itkGetMacro( AmplitudeImageFileName, std::string );
58  itkGetMacro( IntensityImageFileName, std::string );
59  itkGetMacro( RGBImageFileName, std::string );
60  itkGetMacro( ToFCaptureWidth, int );
61  itkGetMacro( ToFCaptureHeight, int );
62  itkGetMacro( RGBCaptureWidth, int );
63  itkGetMacro( RGBCaptureHeight, int );
64  itkGetMacro( DistanceImageSelected, bool );
65  itkGetMacro( AmplitudeImageSelected, bool );
66  itkGetMacro( IntensityImageSelected, bool );
67  itkGetMacro( RGBImageSelected, bool );
68  itkGetMacro( NumOfFrames, int );
69  itkGetMacro( FileFormat, std::string );
70 
71  itkSetMacro( DistanceImageFileName, std::string );
72  itkSetMacro( AmplitudeImageFileName, std::string );
73  itkSetMacro( IntensityImageFileName, std::string );
74  itkSetMacro(RGBImageFileName, std::string );
75  itkSetMacro( DistanceImageSelected, bool );
76  itkSetMacro( AmplitudeImageSelected, bool );
77  itkSetMacro( IntensityImageSelected, bool );
78  itkSetMacro( RGBImageSelected, bool );
79  itkSetMacro( NumOfFrames, int );
80  itkSetMacro( FileFormat, std::string );
81 
82  enum RecordMode{ PerFrames, Infinite };
87  ToFImageRecorder::RecordMode GetRecordMode();
92  void SetRecordMode(ToFImageRecorder::RecordMode recordMode);
97  void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
102  ToFCameraDevice* GetCameraDevice();
107  ToFImageWriter::ToFImageType GetToFImageType();
112  void SetToFImageType(ToFImageWriter::ToFImageType toFImageType);
116  void StartRecording();
120  void StopRecording();
124  void WaitForThreadBeingTerminated();
125 
126 protected:
127 
131  static ITK_THREAD_RETURN_TYPE RecordData(void* pInfoStruct);
132 
133  // data acquisition
134  ToFCameraDevice::Pointer m_ToFCameraDevice;
146  unsigned char* m_RGBArray;
148 
149  // data writing
150  ToFImageWriter::Pointer m_ToFImageWriter;
151 
155  std::string m_RGBImageFileName;
156 
160  std::string m_FileFormat;
161 
166 
167  // threading
168  itk::MultiThreader::Pointer m_MultiThreader;
170  itk::FastMutexLock::Pointer m_AbortMutex;
171  bool m_Abort;
172 
173 private:
174 
175 };
176 } //END mitk namespace
177 #endif //mitkToFImageRecorder_h
ToFImageRecorder::RecordMode m_RecordMode
mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite) ...
int m_ImageSequence
number of images currently acquired
std::string m_AmplitudeImageFileName
file name for saving the amplitude image
itk::FastMutexLock::Pointer m_AbortMutex
mutex for thread-safe data access of abort flag
ToFImageWriter::ToFImageType m_ToFImageType
type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)
bool m_Abort
flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combin...
int m_ToFCaptureHeight
height (y-dimension) of the images to record.
#define MITKTOFHARDWARE_EXPORT
ToFCameraDevice::Pointer m_ToFCameraDevice
ToFCameraDevice used for acquiring the images.
Virtual interface and base class for all Time-of-Flight devices.
DataCollection - Class to facilitate loading/accessing structured data.
std::string m_FileFormat
file format for saving images. If .csv is chosen, ToFImageCsvWriter is used
int m_ToFCaptureWidth
width (x-dimension) of the images to record.
int m_RGBCaptureHeight
height (y-dimension) of the images to record.
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
std::string m_DistanceImageFileName
file name for saving the distance image
int m_ToFPixelNumber
number of pixels (widht*height) of the images to record
Recorder class for ToF images.
int m_SourceDataSize
size of the source data provided by the device
bool m_AmplitudeImageSelected
flag indicating if amplitude image should be recorded
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
float * m_DistanceArray
array holding the distance data
std::string m_RGBImageFileName
file name for saving the rgb image
int m_RGBCaptureWidth
width (x-dimension) of the images to record.
float * m_IntensityArray
array holding the intensity data
itk::MultiThreader::Pointer m_MultiThreader
member for thread-handling (ITK-based)
ToFImageWriter::Pointer m_ToFImageWriter
image writer writing the acquired images to a file
bool m_DistanceImageSelected
flag indicating if distance image should be recorded
bool m_RGBImageSelected
flag indicating if rgb image should be recorded
unsigned char * m_RGBArray
array holding the RGB data if available (e.g. for Kinect)
std::string m_IntensityImageFileName
file name for saving the intensity image
bool m_IntensityImageSelected
flag indicating if intensity image should be recorded
char * m_SourceDataArray
array holding the source data
int m_ThreadID
ID of the thread recording the data.
float * m_AmplitudeArray
array holding the amplitude data