DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkDWIWriter.h
Go to the documentation of this file.
1 
18 #ifndef __itkDWIWriter_h
19 #define __itkDWIWriter_h
20 
21 
22 
23 #include "itkImage.h"
24 #include "itkVectorImage.h"
25 #include "itkImageSource.h"
26 #include "vnl/vnl_matrix.h"
27 #include "utlITK.h"
28 #include <tr1/memory>
29 
31 
32 namespace itk
33 {
59 template <class TPixelType, unsigned int VImageDimension = 3 >
60 class ITK_EXPORT DWIWriter : public ImageSource< VectorImage<TPixelType, VImageDimension> >
61 {
62 
63 public:
65  typedef DWIWriter Self;
66  typedef ImageSource< VectorImage<TPixelType, VImageDimension> > Superclass;
67  typedef SmartPointer< Self > Pointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(DWIWriter, ImageSource);
74 
75  typedef Image<TPixelType, VImageDimension> B0ImageType;
76  typedef VectorImage<TPixelType, VImageDimension> DWIImageType;
77  typedef B0ImageType MaskImageType;
78 
80  typedef utl_shared_ptr<MatrixType> MatrixPointer;
81  typedef std::vector<double> STDVectorType;
82  typedef utl_shared_ptr<STDVectorType > STDVectorPointer;
83 
84  typedef typename DWIImageType::SizeType SizeType;
85  typedef typename DWIImageType::IndexType IndexType;
86  typedef typename DWIImageType::RegionType RegionType;
87  typedef typename DWIImageType::PixelType PixelType;
88  typedef typename DWIImageType::DirectionType DirectionType;
89  typedef typename DWIImageType::SpacingType SpacingType;
90 
91  typedef typename B0ImageType::SizeType B0SizeType;
92  typedef typename B0ImageType::IndexType B0IndexType;
93  typedef typename B0ImageType::RegionType B0RegionType;
94  typedef typename B0ImageType::PixelType B0PixelType;
95  typedef typename B0ImageType::DirectionType B0DirectionType;
96  typedef typename B0ImageType::SpacingType B0SpacingType;
97 
100 
101  itkSetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
102  itkGetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
103 
105  itkSetObjectMacro(MaskImage, MaskImageType);
106  itkGetConstObjectMacro(MaskImage, MaskImageType);
107 
109  itkSetObjectMacro(B0Image, B0ImageType);
110  itkGetObjectMacro(B0Image, B0ImageType);
111 
112  itkSetMacro(ConfigurationFile, std::string);
113  itkGetMacro(ConfigurationFile, std::string);
114  itkSetMacro(DWIFile, std::string);
115  itkGetMacro(DWIFile, std::string);
116  itkSetMacro(OrientationFile, std::string);
117  itkGetMacro(OrientationFile, std::string);
118  itkSetMacro(BFile, std::string);
119  itkGetMacro(BFile, std::string);
120 
122  itkSetMacro(UseRelativePath, bool);
123  itkGetMacro(UseRelativePath, bool);
124  itkBooleanMacro(UseRelativePath);
125 
127  itkSetMacro(OutputEachShell, bool);
128  itkGetMacro(OutputEachShell, bool);
129  itkBooleanMacro(OutputEachShell);
130 
132  using Superclass::SetInput;
133  void SetInput(const DWIImageType *input);
134  const DWIImageType * GetInput();
135 
151  void WriteToConfigurationFile(const std::string& file);
152 
153 
154 protected:
155  DWIWriter();
156  virtual ~DWIWriter(){}
157 
158  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
159 
161  virtual void GenerateData() ITK_OVERRIDE;
162 
163 private:
164  DWIWriter(const Self &); //purposely not implemented
165  void operator=(const Self &); //purposely not implemented
166 
167  SamplingSchemeQSpacePointer m_SamplingSchemeQSpace;
168 
171 
172  std::string m_ConfigurationFile;
173  std::string m_DWIFile;
174  std::string m_BFile;
175  std::string m_OrientationFile;
176 
177  typename MaskImageType::Pointer m_MaskImage;
178  typename B0ImageType::Pointer m_B0Image;
179 };
180 
181 }
182 
183 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkDWIWriter_hxx)
184 #include "itkDWIWriter.hxx"
185 #endif
186 
187 #endif
virtual ~DWIWriter()
Definition: itkDWIWriter.h:156
B0ImageType::RegionType B0RegionType
Definition: itkDWIWriter.h:93
DWIImageType::IndexType IndexType
Definition: itkDWIWriter.h:85
bool m_OutputEachShell
Definition: itkDWIWriter.h:170
DWIWriter Self
Definition: itkDWIWriter.h:65
VectorImage< TPixelType, VImageDimension > DWIImageType
Definition: itkDWIWriter.h:76
SamplingSchemeQSpaceType::Pointer SamplingSchemeQSpacePointer
Definition: itkDWIWriter.h:99
bool m_UseRelativePath
Definition: itkDWIWriter.h:169
SmartPointer< Self > Pointer
Definition: itkDWIWriter.h:67
B0ImageType MaskImageType
Definition: itkDWIWriter.h:77
DWIImageType::SizeType SizeType
Definition: itkDWIWriter.h:84
SamplingSchemeQSpace< double > SamplingSchemeQSpaceType
Definition: itkDWIWriter.h:98
DWIImageType::DirectionType DirectionType
Definition: itkDWIWriter.h:88
MaskImageType::Pointer m_MaskImage
Definition: itkDWIWriter.h:177
ImageSource< VectorImage< TPixelType, VImageDimension > > Superclass
Definition: itkDWIWriter.h:66
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
utl::NDArray< double, 2 > MatrixType
Definition: itkDWIWriter.h:79
B0ImageType::SpacingType B0SpacingType
Definition: itkDWIWriter.h:96
B0ImageType::IndexType B0IndexType
Definition: itkDWIWriter.h:92
DWIImageType::PixelType PixelType
Definition: itkDWIWriter.h:87
std::string m_BFile
Definition: itkDWIWriter.h:174
this class describes sampling in Q space.
B0ImageType::SizeType B0SizeType
Definition: itkDWIWriter.h:91
write gradient file, b values and DWI files (with optional index file)
Definition: itkDWIWriter.h:60
std::string m_ConfigurationFile
Definition: itkDWIWriter.h:172
B0ImageType::Pointer m_B0Image
Definition: itkDWIWriter.h:178
std::vector< double > STDVectorType
Definition: itkDWIWriter.h:81
DWIImageType::RegionType RegionType
Definition: itkDWIWriter.h:86
B0ImageType::PixelType B0PixelType
Definition: itkDWIWriter.h:94
utl_shared_ptr< MatrixType > MatrixPointer
Definition: itkDWIWriter.h:80
DWIImageType::SpacingType SpacingType
Definition: itkDWIWriter.h:89
SamplingSchemeQSpacePointer m_SamplingSchemeQSpace
Definition: itkDWIWriter.h:167
std::string m_OrientationFile
Definition: itkDWIWriter.h:175
std::string m_DWIFile
Definition: itkDWIWriter.h:173
B0ImageType::DirectionType B0DirectionType
Definition: itkDWIWriter.h:95
Image< TPixelType, VImageDimension > B0ImageType
Definition: itkDWIWriter.h:73
utl_shared_ptr< STDVectorType > STDVectorPointer
Definition: itkDWIWriter.h:82