cctw  0.2.1
cctwimporter.h
Go to the documentation of this file.
1 #ifndef CCTWIMPORTER_H
2 #define CCTWIMPORTER_H
3 
4 #include "cctwobject.h"
5 #include "qcepimagedata.h"
6 #include <QSemaphore>
7 #include "hdf5.h"
9 
10 class CctwApplication;
11 
12 class CctwImporter : public CctwObject
13 {
14  Q_OBJECT
15 public:
16  explicit CctwImporter(CctwApplication *application,
17  QString name,
18  QObject *parent = 0);
19  virtual ~CctwImporter();
20 
21 signals:
22 
23 public slots:
24  void importData();
25  void loadDarkImage();
26  void clearInputFiles();
27  void changeDirectory(QString path);
28  void appendInputFile(QString path);
29  void appendMatchingFiles(QString pattern);
30  void checkImportedData();
33 
34 private slots:
35  void importDataFrame(int num, QString path);
36 
37 private:
38  bool createOutputFile();
39  void closeOutputFile();
40  void writeOutputFrame(int num, QcepImageData<double> *img);
41 
42  void initializeDataBuffer();
43  void deleteDataBuffer();
44  void allocateDataBuffer(hsize_t dimx, hsize_t dimy, hsize_t dimz);
45  void readDataFrameToBuffer(int i, int nb, QString path);
46  void outputDataFromBuffer(int i);
47 
48 private:
50  QMutex m_OutputMutex;
51  QSemaphore m_BacklogSemaphore;
53 
54  hid_t m_FileId;
55  hid_t m_DatasetId;
57 
58  float *m_InputBuffer;
63 
64  QSharedPointer< QcepImageData<double> > m_DarkImage;
65 
66 private:
67  Q_PROPERTY(int dataFormat READ get_DataFormat WRITE set_DataFormat)
68  QCEP_INTEGER_PROPERTY(DataFormat)
69 
70  Q_PROPERTY(QString darkImagePath READ get_DarkImagePath WRITE set_DarkImagePath)
71  QCEP_STRING_PROPERTY(DarkImagePath)
72 
73  Q_PROPERTY(QStringList imagePaths READ get_ImagePaths WRITE set_ImagePaths)
74  QCEP_STRING_LIST_PROPERTY(ImagePaths)
75 
76  Q_PROPERTY(QString imageDirectory READ get_ImageDirectory WRITE set_ImageDirectory)
77  QCEP_STRING_PROPERTY(ImageDirectory)
78 
79  Q_PROPERTY(QString imagePattern READ get_ImagePattern WRITE set_ImagePattern)
80  QCEP_STRING_PROPERTY(ImagePattern)
81 
82  Q_PROPERTY(QString outputPath READ get_OutputPath WRITE set_OutputPath)
83  QCEP_STRING_PROPERTY(OutputPath)
84 
85  Q_PROPERTY(QString outputDataset READ get_OutputDataset WRITE set_OutputDataset)
86  QCEP_STRING_PROPERTY(OutputDataset)
87 
88  Q_PROPERTY(CctwIntVector3D chunkSize READ get_ChunkSize WRITE set_ChunkSize)
89  CCTW_INTVECTOR3D_PROPERTY(ChunkSize)
90 
91  Q_PROPERTY(int compression READ get_Compression WRITE set_Compression)
92  QCEP_INTEGER_PROPERTY(Compression)
93 
94  Q_PROPERTY(int xDimension READ get_XDimension WRITE set_XDimension STORED false)
95  QCEP_INTEGER_PROPERTY(XDimension)
96 
97  Q_PROPERTY(int yDimension READ get_YDimension WRITE set_YDimension STORED false)
98  QCEP_INTEGER_PROPERTY(YDimension)
99 
100  Q_PROPERTY(int zDimension READ get_ZDimension WRITE set_ZDimension STORED false)
101  QCEP_INTEGER_PROPERTY(ZDimension)
102 
103  Q_PROPERTY(int inputDataBuffering READ get_InputDataBuffering WRITE set_InputDataBuffering)
104  QCEP_INTEGER_PROPERTY(InputDataBuffering)
105 
106  Q_PROPERTY(bool checkRigorously READ get_CheckRigorously WRITE set_CheckRigorously)
107  QCEP_BOOLEAN_PROPERTY(CheckRigorously)
108 
109  Q_PROPERTY(bool checkApproximately READ get_CheckApproximately WRITE set_CheckApproximately)
110  QCEP_BOOLEAN_PROPERTY(CheckApproximately)
111 };
112 
113 #endif // CCTWIMPORTER_H
void readDataFrameToBuffer(int i, int nb, QString path)
QSemaphore m_CompletionSemaphore
Definition: cctwimporter.h:52
bool checkRigorously
Definition: cctwimporter.h:106
QMutex m_OutputMutex
Definition: cctwimporter.h:50
float * m_InputBuffer
Definition: cctwimporter.h:58
QString outputDataset
Definition: cctwimporter.h:85
CctwIntVector3D chunkSize
Definition: cctwimporter.h:88
hid_t m_DataspaceId
Definition: cctwimporter.h:56
QString name
Definition: cctwobject.h:32
QSharedPointer< QcepImageData< double > > m_DarkImage
Definition: cctwimporter.h:64
hsize_t m_InputBufferSize
Definition: cctwimporter.h:61
QSemaphore m_BacklogSemaphore
Definition: cctwimporter.h:51
void writeOutputFrame(int num, QcepImageData< double > *img)
hid_t m_FileId
Definition: cctwimporter.h:54
void checkImportedData()
void checkImportedDataRigorously()
virtual ~CctwImporter()
QString imagePattern
Definition: cctwimporter.h:79
#define CCTW_INTVECTOR3D_PROPERTY(propname)
CctwApplication * m_Application
Definition: cctwimporter.h:49
bool checkApproximately
Definition: cctwimporter.h:109
void checkImportedDataApproximately()
void importData()
void loadDarkImage()
hid_t m_DatasetId
Definition: cctwimporter.h:55
void clearInputFiles()
hsize_t m_InputBufferStride
Definition: cctwimporter.h:62
int inputDataBuffering
Definition: cctwimporter.h:103
void initializeDataBuffer()
void outputDataFromBuffer(int i)
bool createOutputFile()
void deleteDataBuffer()
QStringList imagePaths
Definition: cctwimporter.h:73
QString outputPath
Definition: cctwimporter.h:82
QString darkImagePath
Definition: cctwimporter.h:70
void importDataFrame(int num, QString path)
int m_InputBufferCount
Definition: cctwimporter.h:60
void changeDirectory(QString path)
void closeOutputFile()
void appendInputFile(QString path)
CctwImporter(CctwApplication *application, QString name, QObject *parent=0)
Definition: cctwimporter.cpp:8
void allocateDataBuffer(hsize_t dimx, hsize_t dimy, hsize_t dimz)
void appendMatchingFiles(QString pattern)
int m_InputBufferStart
Definition: cctwimporter.h:59
QString imageDirectory
Definition: cctwimporter.h:76