ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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 <memory>
26#include "itkImageIOBase.h"
28#include <cstdio>
29
30namespace itk
31{
32// Forward declaration
33class GenericCUBFileAdaptor;
34
52{
53public:
54 ITK_DISALLOW_COPY_AND_MOVE(VoxBoCUBImageIO);
55
60
62 itkNewMacro(Self);
63
65 itkOverrideGetNameOfClassMacro(VoxBoCUBImageIO);
66
67 /*-------- This part of the interfaces deals with reading data. ----- */
68
71 bool
72 CanReadFile(const char *) override;
73
75 void
77
79 void
80 Read(void * buffer) override;
81
82 /*-------- This part of the interfaces deals with writing data. ----- */
83
86 bool
87 CanWriteFile(const char *) override;
88
90 void
92
95 void
96 Write(const void * buffer) override;
97
99 ~VoxBoCUBImageIO() override;
100 void
101 PrintSelf(std::ostream & os, Indent indent) const override;
102
103private:
104 bool
105 CheckExtension(const char *, bool & isCompressed);
106
107 std::unique_ptr<GenericCUBFileAdaptor>
108 CreateReader(const char * filename);
109
110 std::unique_ptr<GenericCUBFileAdaptor>
111 CreateWriter(const char * filename);
112
113 std::unique_ptr<GenericCUBFileAdaptor> m_Reader;
114 std::unique_ptr<GenericCUBFileAdaptor> m_Writer;
115
116 // Initialize the orientation map (from strings to ITK)
117 void
119
120 // Orientation stuff
122 using OrientationMap = std::map<std::string, OrientationFlags>;
123 using InverseOrientationMap = std::map<OrientationFlags, std::string>;
124
127
128 // Method to swap bytes in read buffer
129 void
130 SwapBytesIfNecessary(void * buffer, BufferSizeType numberOfBytes);
131
132 // Strings used in VoxBo files
133 static const char * m_VB_IDENTIFIER_SYSTEM;
134 static const char * m_VB_IDENTIFIER_FILETYPE;
135 static const char * m_VB_DIMENSIONS;
136 static const char * m_VB_SPACING;
137 static const char * m_VB_ORIGIN;
138 static const char * m_VB_DATATYPE;
139 static const char * m_VB_BYTEORDER;
140 static const char * m_VB_ORIENTATION;
141 static const char * m_VB_BYTEORDER_MSB;
142 static const char * m_VB_BYTEORDER_LSB;
143 static const char * m_VB_DATATYPE_BYTE;
144 static const char * m_VB_DATATYPE_INT;
145 static const char * m_VB_DATATYPE_FLOAT;
146 static const char * m_VB_DATATYPE_DOUBLE;
147};
148} // end namespace itk
149
150#endif // itkVoxBoCUBImageIO_h
itk::OffsetValueType BufferSizeType
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
static const char * m_VB_DATATYPE
static const char * m_VB_BYTEORDER
std::unique_ptr< GenericCUBFileAdaptor > m_Reader
std::map< std::string, OrientationFlags > OrientationMap
void Read(void *buffer) override
static const char * m_VB_IDENTIFIER_FILETYPE
static const char * m_VB_BYTEORDER_LSB
OrientationMap m_OrientationMap
std::unique_ptr< GenericCUBFileAdaptor > m_Writer
void SwapBytesIfNecessary(void *buffer, BufferSizeType numberOfBytes)
static const char * m_VB_DIMENSIONS
SmartPointer< Self > Pointer
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
SpatialOrientationEnums::ValidCoordinateOrientations OrientationFlags
static const char * m_VB_ORIGIN
void InitializeOrientationMap()
void WriteImageInformation() override
bool CanWriteFile(const char *) override
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
std::unique_ptr< GenericCUBFileAdaptor > CreateWriter(const char *filename)
static const char * m_VB_DATATYPE_DOUBLE
void Write(const void *buffer) override
bool CheckExtension(const char *, bool &isCompressed)
std::unique_ptr< GenericCUBFileAdaptor > CreateReader(const char *filename)
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....