19 #ifndef itkFreeSurferBinaryMeshIO_h
20 #define itkFreeSurferBinaryMeshIO_h
21 #include "ITKIOMeshFreeSurferExport.h"
65 bool CanReadFile(
const char *FileNameToRead)
override;
68 void ReadMeshInformation()
override;
71 void ReadPoints(
void *buffer)
override;
73 void ReadCells(
void *buffer)
override;
75 void ReadPointData(
void *buffer)
override;
77 void ReadCellData(
void *buffer)
override;
86 bool CanWriteFile(
const char *FileNameToWrite)
override;
89 void WriteMeshInformation()
override;
93 void WritePoints(
void *buffer)
override;
95 void WriteCells(
void *buffer)
override;
97 void WritePointData(
void *buffer)
override;
99 void WriteCellData(
void *buffer)
override;
101 void Write()
override;
105 template<
typename T >
108 auto * data =
new float[this->m_NumberOfPoints * this->m_PointDimension];
110 for (
SizeValueType ii = 0; ii < this->m_NumberOfPoints; ii++ )
112 for (
unsigned int jj = 0; jj < this->m_PointDimension; jj++ )
114 data[ii * this->m_PointDimension + jj] =
static_cast< float >( buffer[ii * this->m_PointDimension + jj] );
123 template<
typename T >
128 auto * data =
new itk::uint32_t[this->m_NumberOfCells * numberOfCellPoints];
130 ReadCellsBuffer(buffer, data);
137 template<
typename TInput,
typename TOutput >
140 if ( input && output )
142 for (
SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
144 for (
unsigned int jj = 0; jj < 3; jj++ )
149 output[ii * 3 + jj] =
static_cast< TOutput
>( input[5 * ii + jj + 2] );
156 template<
typename T >
159 auto * data =
new float[this->m_NumberOfPointPixels];
161 for (
SizeValueType ii = 0; ii < this->m_NumberOfPointPixels; ii++ )
163 data[ii] =
static_cast< float >( buffer[ii] );
174 void PrintSelf(std::ostream & os,
Indent indent)
const override;
Light weight base class for most itk classes.
IdentifierType SizeValueType
unsigned long SizeValueType
std::ifstream m_InputFile
void WritePoints(T *buffer, std::ofstream &outputFile)
void WritePointData(T *buffer, std::ofstream &outputFile)
std::streamoff StreamOffsetType
void WriteCells(T *buffer, std::ofstream &outputFile)
void ReadCellsBuffer(TInput *input, TOutput *output)
Control indentation during Print() invocation.
static void SwapWriteRangeFromSystemToBigEndian(T *p, int num, OStreamType *fp)
This class defins how to read Freesurfer binary surface file format. To use IO factory, define the suffix as *.fsb.
Abstract superclass defines mesh IO interface.
Base class for most ITK classes.