Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef mitkToFImageRecorder_h
17 #define mitkToFImageRecorder_h
18 
19 #include "MitkToFHardwareExports.h"
20 #include <mitkCommon.h>
21 #include "mitkToFCameraDevice.h"
22 #include "mitkToFImageCsvWriter.h"
23 #include "mitkToFNrrdImageWriter.h"
24 
25 #include <itkObject.h>
26 #include <itkObjectFactory.h>
27 #include <itkFastMutexLock.h>
28 #include <itkCommand.h>
29 
30 namespace mitk
31 {
46 class MITKTOFHARDWARE_EXPORT ToFImageRecorder : public itk::Object
47 {
48 public:
49 
51 
53 
55 
56  itkFactorylessNewMacro(Self)
57  itkCloneMacro(Self)
58 
59  itkGetMacro( DistanceImageFileName, std::string );
60  itkGetMacro( AmplitudeImageFileName, std::string );
61  itkGetMacro( IntensityImageFileName, std::string );
62  itkGetMacro( RGBImageFileName, std::string );
63  itkGetMacro( ToFCaptureWidth, int );
64  itkGetMacro( ToFCaptureHeight, int );
65  itkGetMacro( RGBCaptureWidth, int );
66  itkGetMacro( RGBCaptureHeight, int );
67  itkGetMacro( DistanceImageSelected, bool );
68  itkGetMacro( AmplitudeImageSelected, bool );
69  itkGetMacro( IntensityImageSelected, bool );
70  itkGetMacro( RGBImageSelected, bool );
71  itkGetMacro( NumOfFrames, int );
72  itkGetMacro( FileFormat, std::string );
73 
74  itkSetMacro( DistanceImageFileName, std::string );
75  itkSetMacro( AmplitudeImageFileName, std::string );
76  itkSetMacro( IntensityImageFileName, std::string );
77  itkSetMacro(RGBImageFileName, std::string );
78  itkSetMacro( DistanceImageSelected, bool );
79  itkSetMacro( AmplitudeImageSelected, bool );
80  itkSetMacro( IntensityImageSelected, bool );
81  itkSetMacro( RGBImageSelected, bool );
82  itkSetMacro( NumOfFrames, int );
83  itkSetMacro( FileFormat, std::string );
84 
85  enum RecordMode{ PerFrames, Infinite };
90  ToFImageRecorder::RecordMode GetRecordMode();
95  void SetRecordMode(ToFImageRecorder::RecordMode recordMode);
100  void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
105  ToFCameraDevice* GetCameraDevice();
110  ToFImageWriter::ToFImageType GetToFImageType();
115  void SetToFImageType(ToFImageWriter::ToFImageType toFImageType);
119  void StartRecording();
123  void StopRecording();
127  void WaitForThreadBeingTerminated();
128 
129 protected:
130 
134  static ITK_THREAD_RETURN_TYPE RecordData(void* pInfoStruct);
135 
136  // data acquisition
149  unsigned char* m_RGBArray;
151 
152  // data writing
154 
158  std::string m_RGBImageFileName;
159 
163  std::string m_FileFormat;
164 
169 
170  // threading
174  bool m_Abort;
175 
176 private:
177 
178 };
179 } //END mitk namespace
180 #endif //mitkToFImageRecorder_h
itk::SmartPointer< Self > Pointer
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.
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:53
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