DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkCastImageFileWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Cast 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 __itkCastImageFileWriter_h
15 #define __itkCastImageFileWriter_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 
31 template <class TInputImage>
32 class ITK_EXPORT CastImageFileWriter : public ProcessObject
33 {
34 public:
37  typedef ProcessObject Superclass;
38  typedef SmartPointer<Self> Pointer;
39  typedef SmartPointer<const Self> ConstPointer;
40 
42  itkNewMacro(Self);
43 
45  itkTypeMacro(CastImageFileWriter,ProcessObject);
46 
48  typedef TInputImage InputImageType;
49  typedef typename InputImageType::Pointer InputImagePointer;
50  typedef typename InputImageType::RegionType InputImageRegionType;
51  typedef typename InputImageType::PixelType InputImagePixelType;
52 
53  typedef typename ImageIOBase::IOComponentType IOComponentType;
54 
56  using Superclass::SetInput;
57  virtual void SetInput(const InputImageType *input);
58  const InputImageType * GetInput(void);
59  const InputImageType * GetInput(unsigned int idx);
60 
62  itkSetStringMacro(FileName);
63  itkGetStringMacro(FileName);
64 
75  void SetImageIO (ImageIOBase* io)
76  {
77  if (this->m_ImageIO != io)
78  {
79  this->Modified();
80  this->m_ImageIO = io;
81  }
82  m_FactorySpecifiedImageIO = false;
83  }
84  itkGetObjectMacro(ImageIO,ImageIOBase);
85 
93  virtual void Write(void);
94 
97  void SetIORegion(const ImageIORegion & region);
98  const ImageIORegion &GetIORegion(void) const
99  {
100  return m_PasteIORegion;
101  }
102 
103 
106  itkSetMacro(NumberOfStreamDivisions,unsigned int);
107  itkGetConstReferenceMacro(NumberOfStreamDivisions,unsigned int);
108 
109 
112  virtual void Update() ITK_OVERRIDE
113  {
114  this->Write();
115  }
116 
118  itkSetMacro(UseCompression,bool);
119  itkGetConstReferenceMacro(UseCompression,bool);
120  itkBooleanMacro(UseCompression);
121 
128  itkSetMacro(UseInputMetaDataDictionary,bool);
129  itkGetConstReferenceMacro(UseInputMetaDataDictionary,bool);
130  itkBooleanMacro(UseInputMetaDataDictionary);
131 
133  itkSetEnumMacro(ComponentType, IOComponentType);
134  itkGetEnumMacro(ComponentType, IOComponentType);
135 
136 protected:
139  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
140 
142  void GenerateData(void) ITK_OVERRIDE;
143 
144 private:
145  CastImageFileWriter(const Self&); //purposely not implemented
146  void operator=(const Self&); //purposely not implemented
147 
148  std::string m_FileName;
149 
150  ImageIOBase::Pointer m_ImageIO;
151  bool m_UserSpecifiedImageIO; // track whether the ImageIO
152  // is user specified
153 
154  ImageIORegion m_PasteIORegion;
156  bool m_UserSpecifiedIORegion; // track whether the region
157  // is user specified
158  bool m_FactorySpecifiedImageIO; //track whether the factory
159  // mechanism set the ImageIO
161  bool m_UseInputMetaDataDictionary; // whether to use the
162  // MetaDataDictionary from the
163  // input or not.
164 
165  IOComponentType m_ComponentType;
166 };
167 
168 
169 } // end namespace itk
170 
171 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkCastImageFileWriter_hxx)
173 #endif
174 
175 #endif // __itkCastImageFileWriter_h
SmartPointer< const Self > ConstPointer
ImageIOBase::Pointer m_ImageIO
InputImageType::Pointer InputImagePointer
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
virtual void Update() ITK_OVERRIDE
Writes image data, after casting, to a single file.
InputImageType::RegionType InputImageRegionType
void SetImageIO(ImageIOBase *io)
SmartPointer< Self > Pointer
const ImageIORegion & GetIORegion(void) const
ImageIOBase::IOComponentType IOComponentType
InputImageType::PixelType InputImagePixelType