1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 | /*!
* \file Tomato.h
* \author Konrad Werys
* \date 2018/08/14
*/
#ifndef Tomato_Tomato_H
#define Tomato_Tomato_H
#include "CmakeConfigForTomato.h"
#ifdef USE_ITK
#include "TomatoOptions.h"
#include "TomatoColormap.h"
#include "itkReadFileListFilter.h"
#include "itkReadDirectoryFilter.h"
#include "itkSortInvTimesImageFilter.h"
#include "itkCalculatorT1ImageFilter.h"
#include "itkColorbar2DImageFilter.h"
#include "itkNShmolliSamplesUsedTo123ImageFilter.h"
#include "itkTimeProbe.h"
// for exporting
#include "gdcmUIDGenerator.h"
#include "itkGDCMImageIO.h"
#include "itkGDCMSeriesFileNames.h"
#include "itkMultiplyImageFilter.h"
#include "itkImageFileWriter.h"
#include "itkFileTools.h"
#include "itkAdaptImageFilter.h"
namespace Ox {
/**
* \class Tomato
* includes factories and methods needed for calculation
*/
template< typename MeasureType >
class Tomato {
public:
// typedefs primitive data types
typedef MeasureType InputPixelType;
typedef int16_t OutputPixelType; // int does not work with some dicom viewers, be sure to use short (int16)
// typedefs image data types
typedef itk::Image<InputPixelType, 3> ImageType3D;
typedef itk::Image<InputPixelType, 2> ImageType2D;
typedef itk::Image<OutputPixelType, 2> OutputImageType;
typedef itk::ReadFileListFilter<ImageType3D> ReadFileListFilterType;
typedef itk::ReadDirectoryFilter<ImageType3D> ReadDirectoryFilterType;
typedef itk::SortInvTimesImageFilter<ImageType3D, ImageType3D> SortInvTimesImageFilterType;
typedef itk::CalculatorT1ImageFilter<ImageType3D, ImageType2D> CalculatorT1ImageFilterType;
typedef itk::MetaDataDictionary DictionaryType;
// member variables
TomatoOptions<InputPixelType> *_opts;
InputPixelType *_invTimes;
InputPixelType *_echoTimes;
int _nSamples;
typename ImageType3D::Pointer _imageMag;
typename ImageType3D::Pointer _imagePha;
typename CalculatorT1ImageFilterType::Pointer _imageCalculatorItk;
//SortInvTimesImageFilterType::Pointer _sorterMag;
//SortInvTimesImageFilterType::Pointer _sorterPha;
DictionaryType _dictionaryInput;
/**
* readAndSort
* @return success/failure
*/
int readAndSort();
/**
* calculate
* @return success/failure
*/
int calculate();
/**
* method so long and ugly, that I put it in a separate file
* @return success/failure
*/
int exportToDicom();
/**
* constructor
* @param inputFileName
*/
Tomato(std::string inputFileName);
/**
* \brief do not forget about the virtual destructor, see
* https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors
*/
virtual ~Tomato();
private:
/**
* We do not want the default constructor, so let's make it private.
* I cant delete it to be compatible with c++98
*/
Tomato(){};
/**
* readAndSortInputFileList
* @return success/failure
*/
int readAndSortInputFileList();
/**
* readAndSortInputDirs
* @return success/failure
*/
int readAndSortInputDirs();
};
} // namespace Ox
#include "Tomato.hxx"
#include "Tomato_export.hxx"
#endif
#endif //Tomato_Tomato_H
|