ITK  4.10.0
Insight Segmentation and Registration Toolkit
itkFDFImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkFDFImageIO_h
20 #define itkFDFImageIO_h
21 #include "IOFDFExport.h"
22 #include "itkImageIOBase.h"
23 
24 namespace itk
25 {
26 
34 class IOFDF_EXPORT FDFImageIO : public ImageIOBase
35 {
36 public:
38  typedef FDFImageIO Self;
41 
43  itkNewMacro(Self);
44 
46  itkTypeMacro(FDFImageIO, ImageIOBase);
47 
48  virtual bool SupportsDimension( unsigned long dim ) ITK_OVERRIDE
49  {
50  if( dim == 2 || dim == 3 )
51  {
52  return true;
53  }
54  else
55  {
56  return false;
57  }
58  }
59 
60 
61  /*-------- This part of the interface deals with reading data. ------ */
62 
65  virtual bool CanReadFile(const char*) ITK_OVERRIDE;
66 
68  virtual void ReadImageInformation() ITK_OVERRIDE;
69 
71 // virtual const std::type_info& GetPixelType() const;
72 
74  virtual void Read(void* buffer) ITK_OVERRIDE;
75 
77  virtual void ReadVolume(void* buffer);
78 
82 // virtual unsigned int GetComponentSize() const;
83 
84  /*-------- This part of the interfaces deals with writing data. ----- */
85 
88  virtual bool CanWriteFile(const char*) ITK_OVERRIDE;
89 
92  virtual void WriteImageInformation() ITK_OVERRIDE;
93 
96  virtual void Write(const void* buffer) ITK_OVERRIDE;
97 
98 protected:
99  FDFImageIO();
100  ~FDFImageIO();
101  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
102 
103  void WriteSlice(std::string& fileName, const void* buffer);
104 
105  int ReadHeader(const char *FileNameToRead);
106 
107 private:
108  FDFImageIO(const Self&); //purposely not implemented
109  void operator=(const Self&); //purposely not implemented
110 
111  void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
112 
113  // Position after ReadImageInformation.
115 
116  std::string m_SpatialRank;
117  std::string m_Checksum;
118  std::string m_Bits;
119  std::vector<int> m_Size;
120  std::vector<float> m_Location;
121  std::vector<float> m_Span;
122  std::vector<float> m_Roi;
123 };
124 
125 } // end namespace itk
126 
127 
128 #define RAISE_EXCEPTION() \
129  { ExceptionObject exception(__FILE__, __LINE__); \
130  exception.SetDescription("File cannot be read"); \
131  throw exception; }
132 
133 #endif
ImageIOBase Superclass
Definition: itkFDFImageIO.h:39
FDFImageIO Self
Definition: itkFDFImageIO.h:38
std::string m_Bits
Abstract superclass defines image IO interface.
std::string m_Checksum
std::vector< float > m_Location
std::vector< float > m_Span
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
Definition: itkArray.h:30
std::string m_SpatialRank
ImageIO object for reading and writing FDF images.
Definition: itkFDFImageIO.h:34
SmartPointer< Self > Pointer
Definition: itkFDFImageIO.h:40
vcl_size_t m_InputPosition
std::vector< float > m_Roi
std::vector< int > m_Size
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual bool SupportsDimension(unsigned long dim) override
Definition: itkFDFImageIO.h:48