DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkCastVectorImageFileWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Cast Vector Image File Writer
4 
5  Copyright (c) Pew-Thian Yap. All rights reserved.
6  See http://www.unc.edu/~ptyap/ for details.
7 
8  This software is distributed WITHOUT ANY WARRANTY; without even
9  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  PURPOSE. See the above copyright notices for more information.
11 
12  =========================================================================*/
13 
14 #ifndef __itkCastVectorImageFileWriter_h
15 #define __itkCastVectorImageFileWriter_h
16 
17 #include "itkProcessObject.h"
18 #include "itkImageIOBase.h"
19 #include "itkExceptionObject.h"
20 #include "itkSize.h"
21 #include "itkImageIORegion.h"
22 
23 namespace itk
24 {
25 
32 template <class TInputImage>
33 class ITK_EXPORT CastVectorImageFileWriter : public ProcessObject
34 {
35 public:
38  typedef ProcessObject Superclass;
39  typedef SmartPointer<Self> Pointer;
40  typedef SmartPointer<const Self> ConstPointer;
41 
43  itkNewMacro(Self);
44 
46  itkTypeMacro(CastVectorImageFileWriter,ProcessObject);
47 
49  typedef TInputImage InputImageType;
50  typedef typename InputImageType::Pointer InputImagePointer;
51  typedef typename InputImageType::RegionType InputImageRegionType;
52  typedef typename InputImageType::PixelType InputImagePixelType;
53 
54  typedef typename ImageIOBase::IOComponentType IOComponentType;
55 
57  using Superclass::SetInput;
58  void SetInput(const InputImageType *input);
59  const InputImageType * GetInput(void);
60  const InputImageType * GetInput(unsigned int idx);
61 
63  itkSetStringMacro(FileName);
64  itkGetStringMacro(FileName);
65 
76  void SetImageIO (ImageIOBase* io)
77  {
78  if (this->m_ImageIO != io)
79  {
80  this->Modified();
81  this->m_ImageIO = io;
82  }
83  m_FactorySpecifiedImageIO = false;
84  }
85  itkGetObjectMacro(ImageIO,ImageIOBase);
86 
94  virtual void Write(void);
95 
98  void SetIORegion(const ImageIORegion & region);
99  const ImageIORegion &GetIORegion(void) const
100  {
101  return m_PasteIORegion;
102  }
103 
104 
107  itkSetMacro(NumberOfStreamDivisions,unsigned int);
108  itkGetConstReferenceMacro(NumberOfStreamDivisions,unsigned int);
109 
110 
113  virtual void Update() ITK_OVERRIDE
114  {
115  this->Write();
116  }
117 
119  itkSetMacro(UseCompression,bool);
120  itkGetConstReferenceMacro(UseCompression,bool);
121  itkBooleanMacro(UseCompression);
122 
129  itkSetMacro(UseInputMetaDataDictionary,bool);
130  itkGetConstReferenceMacro(UseInputMetaDataDictionary,bool);
131  itkBooleanMacro(UseInputMetaDataDictionary);
132 
134  itkSetEnumMacro(ComponentType, IOComponentType);
135  itkGetEnumMacro(ComponentType, IOComponentType);
136 
137 protected:
140  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
141 
143  void GenerateData(void) ITK_OVERRIDE;
144 
145 private:
146  CastVectorImageFileWriter(const Self&); //purposely not implemented
147  void operator=(const Self&); //purposely not implemented
148 
149  std::string m_FileName;
150 
151  ImageIOBase::Pointer m_ImageIO;
152  bool m_UserSpecifiedImageIO; // track whether the ImageIO
153  // is user specified
154 
155  ImageIORegion m_PasteIORegion;
157  bool m_UserSpecifiedIORegion; // track whether the region
158  // is user specified
159  bool m_FactorySpecifiedImageIO; //track whether the factory
160  // mechanism set the ImageIO
162  bool m_UseInputMetaDataDictionary; // whether to use the
163  // MetaDataDictionary from the
164  // input or not.
165 
166  IOComponentType m_ComponentType;
167 };
168 
169 
170 } // end namespace itk
171 
172 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkCastVectorImageFileWriter_hxx)
174 #endif
175 
176 #endif // __itkCastVectorImageFileWriter_h
Writes image data, after casting, to a single file.
ImageIOBase::IOComponentType IOComponentType
const ImageIORegion & GetIORegion(void) const
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
InputImageType::RegionType InputImageRegionType
InputImageType::PixelType InputImagePixelType