DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkVariableLengthVectorImageFileWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Variable Length 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 __itkVariableLengthVectorImageFileWriter_h
15 #define __itkVariableLengthVectorImageFileWriter_h
16 
17 #include "itkProcessObject.h"
18 #include "itkExceptionObject.h"
19 #include "itkImage.h"
20 #include "itkImageFileWriter.h"
21 
22 namespace itk
23 {
24 
30 template <class TInputImage>
31 class ITKIOImageBase_HIDDEN VariableLengthVectorImageFileWriter : public ProcessObject
32 {
33 public:
36  typedef ProcessObject Superclass;
37  typedef SmartPointer<Self> Pointer;
38  typedef SmartPointer<const Self> ConstPointer;
39 
41  itkNewMacro(Self);
42 
44  itkTypeMacro(VariableLengthVectorImageFileWriter, ProcessObject);
45 
47  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
48 
50  typedef TInputImage InputImageType;
51  typedef typename InputImageType::Pointer InputImagePointer;
52  typedef typename InputImageType::RegionType InputImageRegionType;
53  typedef typename InputImageType::SizeType InputImageSizeType;
54  typedef typename InputImageType::SpacingType InputImageSpacingType;
55  typedef typename InputImageType::PointType InputImagePointType;
56  typedef typename InputImageType::DirectionType InputImageDirectionType;
57  typedef typename InputImageType::PixelType InputImagePixelType;
58  typedef typename InputImageType::ValueType InputImageValueType;
59  typedef typename InputImageType::PixelContainer InputImagePixelContainerType;
60  typedef typename InputImageType::PixelContainer::Pointer InputImagePixelContainerPointerType;
61 // typedef typename InputImageType::PixelContainer::PixelMapType InputImagePixelMapType;
62 // typedef typename InputImagePixelMapType::iterator InputImagePixelMapIteratorType;
63 
65  using Superclass::SetInput;
66  void SetInput(const InputImageType *input);
67  const InputImageType * GetInput(void);
68  const InputImageType * GetInput(unsigned int idx);
69 
71  itkSetStringMacro(FileName);
72  itkGetStringMacro(FileName);
73 
81  virtual void Write(void);
82 
85  virtual void Update()
86  {
87  this->Write();
88  }
89 
91  itkSetMacro(UseCompression, bool);
92  itkGetConstReferenceMacro(UseCompression, bool);
93  itkBooleanMacro(UseCompression);
94 
101 // itkSetMacro(UseInputMetaDataDictionary,bool);
102 // itkGetConstReferenceMacro(UseInputMetaDataDictionary,bool);
103 // itkBooleanMacro(UseInputMetaDataDictionary);
104 
105 
106 protected:
109  void PrintSelf(std::ostream& os, Indent indent) const;
110 
111  typedef unsigned int LengthType;
112  typedef Image<LengthType, ImageDimension> LengthImageType;
113  typedef Image<typename InputImagePixelType::ValueType, 1> ValueImageType;
114  typedef typename LengthImageType::Pointer LengthImagePointer;
115  typedef typename ValueImageType::Pointer ValueImagePointer;
116 
117  LengthImagePointer m_LengthImage;
118  ValueImagePointer m_ValueImage;
119 
120  typedef itk::ImageFileWriter<LengthImageType> LengthImageFileWriterType;
121  typedef itk::ImageFileWriter<ValueImageType> ValueImageFileWriterType;
122 
123  typename LengthImageFileWriterType::Pointer m_LengthImageFileWriter;
124  typename ValueImageFileWriterType::Pointer m_ValueImageFileWriter;
125 
127  void GenerateData(void);
128 
129 
130 private:
131  VariableLengthVectorImageFileWriter(const Self&); //purposely not implemented
132  void operator=(const Self&); //purposely not implemented
133 
134  std::string m_FileName;
135 
137 // bool m_UseInputMetaDataDictionary; // whether to use the
138  // MetaDataDictionary from the
139  // input or not.
140 };
141 
142 
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
147 #endif
148 
149 #endif // __itkVariableLengthVectorImageFileWriter_h
InputImageType::PixelContainer::Pointer InputImagePixelContainerPointerType
Image< typename InputImagePixelType::ValueType, 1 > ValueImageType
Writes variable length vector image data. std::vector is used to store the variable length vector...
itk::ImageFileWriter< ValueImageType > ValueImageFileWriterType
itk::ImageFileWriter< LengthImageType > LengthImageFileWriterType