ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkFDFImageIO.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
24namespace itk
25{
26
34class IOFDF_EXPORT FDFImageIO : public ImageIOBase
35{
36public:
37 ITK_DISALLOW_COPY_AND_MOVE(FDFImageIO);
38
43
45 itkNewMacro(Self);
46
48 itkOverrideGetNameOfClassMacro(FDFImageIO);
49
50 bool
51 SupportsDimension(unsigned long dim) override
52 {
53 if (dim == 2 || dim == 3)
54 {
55 return true;
56 }
57 else
58 {
59 return false;
60 }
61 }
62
63
64 /*-------- This part of the interface deals with reading data. ------ */
65
68 bool
69 CanReadFile(const char *) override;
70
72 void
74
76 // virtual const std::type_info& GetPixelType() const;
77
79 void
80 Read(void * buffer) override;
81
83 virtual void
84 ReadVolume(void * buffer);
85
89 // virtual unsigned int GetComponentSize() const;
90
91 /*-------- This part of the interfaces deals with writing data. ----- */
92
95 bool
96 CanWriteFile(const char *) override;
97
100 void
102
105 void
106 Write(const void * buffer) override;
107
108protected:
110 ~FDFImageIO() override;
111 void
112 PrintSelf(std::ostream & os, Indent indent) const override;
113
114 void
115 WriteSlice(std::string & fileName, const void * buffer);
116
117 int
118 ReadHeader(const char * FileNameToRead);
119
120private:
121 void
122 SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
123
124 // Position after ReadImageInformation.
126
127 std::string m_SpatialRank;
128 std::string m_Checksum;
129 std::string m_Bits;
130 std::vector<int> m_Size;
131 std::vector<float> m_Location;
132 std::vector<float> m_Span;
133 std::vector<float> m_Roi;
134};
135
136} // end namespace itk
137
138
139#define RAISE_EXCEPTION() \
140 { \
141 ExceptionObject exception(__FILE__, __LINE__); \
142 exception.SetDescription("File cannot be read"); \
143 throw exception; \
144 }
145
146#endif
bool CanReadFile(const char *) override
bool CanWriteFile(const char *) override
void Write(const void *buffer) override
~FDFImageIO() override
void ReadImageInformation() override
std::string m_SpatialRank
ImageIOBase Superclass
std::string m_Checksum
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< Self > Pointer
std::vector< float > m_Location
std::string m_Bits
void Read(void *buffer) override
int ReadHeader(const char *FileNameToRead)
void WriteSlice(std::string &fileName, const void *buffer)
virtual void ReadVolume(void *buffer)
bool SupportsDimension(unsigned long dim) override
std::vector< float > m_Span
void SwapBytesIfNecessary(void *buffer, unsigned long numberOfPixels)
std::vector< float > m_Roi
FDFImageIO Self
vcl_size_t m_InputPosition
std::vector< int > m_Size
void WriteImageInformation() override
Control indentation during Print() invocation.
Definition itkIndent.h:53
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....