ITK  6.0.0
Insight Toolkit
itkVoxBoCUBImageIO.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#ifndef itkVoxBoCUBImageIO_h
19#define itkVoxBoCUBImageIO_h
20
21
22#include <fstream>
23#include <string>
24#include <map>
25#include "itkImageIOBase.h"
27#include <cstdio>
28
29namespace itk
30{
31// Forward declaration
32class GenericCUBFileAdaptor;
33
51{
52public:
53 ITK_DISALLOW_COPY_AND_MOVE(VoxBoCUBImageIO);
54
59
61 itkNewMacro(Self);
62
64 itkOverrideGetNameOfClassMacro(VoxBoCUBImageIO);
65
66 /*-------- This part of the interfaces deals with reading data. ----- */
67
70 bool
71 CanReadFile(const char *) override;
72
74 void
76
78 void
79 Read(void * buffer) override;
80
81 /*-------- This part of the interfaces deals with writing data. ----- */
82
85 bool
86 CanWriteFile(const char *) override;
87
89 void
91
94 void
95 Write(const void * buffer) override;
96
98 ~VoxBoCUBImageIO() override;
99 void
100 PrintSelf(std::ostream & os, Indent indent) const override;
101
102private:
103 bool
104 CheckExtension(const char *, bool & isCompressed);
105
106 GenericCUBFileAdaptor *
107 CreateReader(const char * filename);
108
109 GenericCUBFileAdaptor *
110 CreateWriter(const char * filename);
111
112 GenericCUBFileAdaptor *m_Reader, *m_Writer;
113
114 // Initialize the orientation map (from strings to ITK)
115 void
117
118 // Orientation stuff
120 using OrientationMap = std::map<std::string, OrientationFlags>;
121 using InverseOrientationMap = std::map<OrientationFlags, std::string>;
122
125
126 // Method to swap bytes in read buffer
127 void
128 SwapBytesIfNecessary(void * buffer, BufferSizeType numberOfBytes);
129
130 // Strings used in VoxBo files
131 static const char * m_VB_IDENTIFIER_SYSTEM;
132 static const char * m_VB_IDENTIFIER_FILETYPE;
133 static const char * m_VB_DIMENSIONS;
134 static const char * m_VB_SPACING;
135 static const char * m_VB_ORIGIN;
136 static const char * m_VB_DATATYPE;
137 static const char * m_VB_BYTEORDER;
138 static const char * m_VB_ORIENTATION;
139 static const char * m_VB_BYTEORDER_MSB;
140 static const char * m_VB_BYTEORDER_LSB;
141 static const char * m_VB_DATATYPE_BYTE;
142 static const char * m_VB_DATATYPE_INT;
143 static const char * m_VB_DATATYPE_FLOAT;
144 static const char * m_VB_DATATYPE_DOUBLE;
145};
146} // end namespace itk
147
148#endif // itkVoxBoCUBImageIO_h
Abstract superclass defines image IO interface.
itk::OffsetValueType BufferSizeType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
Read VoxBoCUBImage file format.
GenericCUBFileAdaptor * CreateReader(const char *filename)
GenericCUBFileAdaptor * m_Reader
static const char * m_VB_DATATYPE
static const char * m_VB_BYTEORDER
std::map< std::string, OrientationFlags > OrientationMap
GenericCUBFileAdaptor * m_Writer
void Read(void *buffer) override
static const char * m_VB_IDENTIFIER_FILETYPE
static const char * m_VB_BYTEORDER_LSB
OrientationMap m_OrientationMap
void SwapBytesIfNecessary(void *buffer, BufferSizeType numberOfBytes)
static const char * m_VB_DIMENSIONS
std::map< OrientationFlags, std::string > InverseOrientationMap
static const char * m_VB_DATATYPE_FLOAT
static const char * m_VB_IDENTIFIER_SYSTEM
bool CanReadFile(const char *) override
static const char * m_VB_ORIGIN
void InitializeOrientationMap()
void WriteImageInformation() override
bool CanWriteFile(const char *) override
GenericCUBFileAdaptor * CreateWriter(const char *filename)
static const char * m_VB_DATATYPE_BYTE
~VoxBoCUBImageIO() override
static const char * m_VB_SPACING
static const char * m_VB_ORIENTATION
static const char * m_VB_BYTEORDER_MSB
static const char * m_VB_DATATYPE_INT
static const char * m_VB_DATATYPE_DOUBLE
void Write(const void *buffer) override
bool CheckExtension(const char *, bool &isCompressed)
void ReadImageInformation() override
InverseOrientationMap m_InverseOrientationMap
void PrintSelf(std::ostream &os, Indent indent) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....