DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkDWIReader.h
Go to the documentation of this file.
1 
18 #ifndef __itkDWIReader_h
19 #define __itkDWIReader_h
20 
21 #include "itkImage.h"
22 #include "itkVectorImage.h"
23 #include "itkImageSource.h"
24 #include "utlITK.h"
25 #include <tr1/memory>
26 
28 
29 namespace itk
30 {
58 template <class TPixelType, unsigned int VImageDimension = 3 >
59 class ITK_EXPORT DWIReader : public ImageSource< VectorImage<TPixelType, VImageDimension> >
60 {
61 
62 public:
64  typedef DWIReader Self;
65  typedef ImageSource< VectorImage<TPixelType, VImageDimension> > Superclass;
66  typedef SmartPointer< Self > Pointer;
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(DWIReader, ImageSource);
73 
74  typedef Image<TPixelType, VImageDimension> B0ImageType;
75  typedef VectorImage<TPixelType, VImageDimension> DWIImageType;
76  typedef Image<double, VImageDimension> MaskImageType;
77 
79  typedef utl_shared_ptr<MatrixType> MatrixPointer;
80  typedef std::vector<double> STDVectorType;
81  typedef utl_shared_ptr<STDVectorType > STDVectorPointer;
82 
83  typedef typename DWIImageType::SizeType SizeType;
84  typedef typename DWIImageType::IndexType IndexType;
85  typedef typename DWIImageType::RegionType RegionType;
86  typedef typename DWIImageType::PixelType PixelType;
87  typedef typename DWIImageType::DirectionType DirectionType;
88  typedef typename DWIImageType::SpacingType SpacingType;
89 
90  typedef typename B0ImageType::SizeType B0SizeType;
91  typedef typename B0ImageType::IndexType B0IndexType;
92  typedef typename B0ImageType::RegionType B0RegionType;
93  typedef typename B0ImageType::PixelType B0PixelType;
94  typedef typename B0ImageType::DirectionType B0DirectionType;
95  typedef typename B0ImageType::SpacingType B0SpacingType;
96 
99 
101  itkSetObjectMacro(MaskImage, MaskImageType);
102  itkGetConstObjectMacro(MaskImage, MaskImageType);
103 
105  itkSetObjectMacro(B0Image, B0ImageType);
106  itkGetObjectMacro(B0Image, B0ImageType);
107 
108  itkSetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
109  itkGetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
110 
111  typename DWIImageType::Pointer GetDWIImage()
112  {
113  this->GetOutput();
114  }
115 
116  itkSetMacro(ConfigurationFile, std::string);
117  itkGetMacro(ConfigurationFile, std::string);
118 
120  itkSetMacro(NormalizeDWI, bool);
121  itkGetMacro(NormalizeDWI, bool);
122  itkBooleanMacro(NormalizeDWI);
123 
124  // [>* If set on, the first dimension of output DWI Image will be B0Image <]
125  // itkSetMacro(DWIWithB0, bool);
126  // itkGetMacro(DWIWithB0, bool);
127  // itkBooleanMacro(DWIWithB0);
128 
130  itkSetMacro(IsInput4DImage, bool);
131  itkGetMacro(IsInput4DImage, bool);
132  itkBooleanMacro(IsInput4DImage);
133 
135  itkSetMacro(CorrectDWIValues, bool);
136  itkGetMacro(CorrectDWIValues, bool);
137  itkBooleanMacro(CorrectDWIValues);
138 
140  itkSetMacro(ShowWarnings, bool);
141  itkGetMacro(ShowWarnings, bool);
142  itkBooleanMacro(ShowWarnings);
143 
164  void ReadFromConfigurationFile(const std::string& file);
165 
166  // void ReadBGradDWI(const std::string& bFile, const std::string& gradFile, const std::string& imageFile, const std::string& indexFile="");
167 
168  static bool DetermineIsInput4DImage(const std::string& dataStr);
169 
171  void NormalizeDWI();
172 
174  void CorrectDWI();
175 
176 protected:
177  DWIReader();
178  virtual ~DWIReader(){}
179 
180  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
181 
183  virtual void GenerateData() ITK_OVERRIDE;
184 
185 private:
186  DWIReader(const Self &); //purposely not implemented
187  void operator=(const Self &); //purposely not implemented
188 
189  SamplingSchemeQSpacePointer m_SamplingSchemeQSpace;
190 
192  // bool m_DWIWithB0;
195 
196  std::string m_ConfigurationFile;
197 
199 
200  typename MaskImageType::Pointer m_MaskImage;
201  typename B0ImageType::Pointer m_B0Image;
202 };
203 
204 }
205 
206 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkDWIReader_hxx)
207 #include "itkDWIReader.hxx"
208 #endif
209 
210 #endif
211 
SmartPointer< Self > Pointer
Definition: itkDWIReader.h:66
B0ImageType::IndexType B0IndexType
Definition: itkDWIReader.h:91
SamplingSchemeQSpaceType::Pointer SamplingSchemeQSpacePointer
Definition: itkDWIReader.h:98
DWIImageType::SizeType SizeType
Definition: itkDWIReader.h:83
utl::NDArray< double, 2 > MatrixType
Definition: itkDWIReader.h:78
DWIImageType::SpacingType SpacingType
Definition: itkDWIReader.h:88
B0ImageType::PixelType B0PixelType
Definition: itkDWIReader.h:93
DWIImageType::PixelType PixelType
Definition: itkDWIReader.h:86
std::string m_ConfigurationFile
Definition: itkDWIReader.h:196
B0ImageType::DirectionType B0DirectionType
Definition: itkDWIReader.h:94
MaskImageType::Pointer m_MaskImage
Definition: itkDWIReader.h:200
VectorImage< TPixelType, VImageDimension > DWIImageType
Definition: itkDWIReader.h:75
DWIImageType::RegionType RegionType
Definition: itkDWIReader.h:85
Image< double, VImageDimension > MaskImageType
Definition: itkDWIReader.h:76
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
std::vector< double > STDVectorType
Definition: itkDWIReader.h:80
utl_shared_ptr< STDVectorType > STDVectorPointer
Definition: itkDWIReader.h:81
B0ImageType::SizeType B0SizeType
Definition: itkDWIReader.h:90
DWIImageType::DirectionType DirectionType
Definition: itkDWIReader.h:87
SamplingSchemeQSpacePointer m_SamplingSchemeQSpace
Definition: itkDWIReader.h:189
bool m_CorrectDWIValues
Definition: itkDWIReader.h:194
this class describes sampling in Q space.
Load gradient file, b values and DWI files (with optional index file)
Definition: itkDWIReader.h:59
virtual ~DWIReader()
Definition: itkDWIReader.h:178
Image< TPixelType, VImageDimension > B0ImageType
Definition: itkDWIReader.h:72
B0ImageType::Pointer m_B0Image
Definition: itkDWIReader.h:201
DWIImageType::IndexType IndexType
Definition: itkDWIReader.h:84
SamplingSchemeQSpace< double > SamplingSchemeQSpaceType
Definition: itkDWIReader.h:97
DWIReader Self
Definition: itkDWIReader.h:64
ImageSource< VectorImage< TPixelType, VImageDimension > > Superclass
Definition: itkDWIReader.h:65
DWIImageType::Pointer GetDWIImage()
Definition: itkDWIReader.h:111
utl_shared_ptr< MatrixType > MatrixPointer
Definition: itkDWIReader.h:79
B0ImageType::SpacingType B0SpacingType
Definition: itkDWIReader.h:95
B0ImageType::RegionType B0RegionType
Definition: itkDWIReader.h:92