19 #ifndef itkFreeSurferBinaryMeshIO_h
20 #define itkFreeSurferBinaryMeshIO_h
21 #include "ITKIOMeshExport.h"
63 virtual bool CanReadFile(
const char *FileNameToRead) ITK_OVERRIDE;
66 virtual void ReadMeshInformation() ITK_OVERRIDE;
69 virtual
void ReadPoints(
void *buffer) ITK_OVERRIDE;
71 virtual
void ReadCells(
void *buffer) ITK_OVERRIDE;
73 virtual
void ReadPointData(
void *buffer) ITK_OVERRIDE;
75 virtual
void ReadCellData(
void *buffer) ITK_OVERRIDE;
84 virtual
bool CanWriteFile(const
char *FileNameToWrite) ITK_OVERRIDE;
87 virtual
void WriteMeshInformation() ITK_OVERRIDE;
91 virtual
void WritePoints(
void *buffer) ITK_OVERRIDE;
93 virtual
void WriteCells(
void *buffer) ITK_OVERRIDE;
95 virtual
void WritePointData(
void *buffer) ITK_OVERRIDE;
97 virtual
void WriteCellData(
void *buffer) ITK_OVERRIDE;
99 virtual
void Write() ITK_OVERRIDE;
103 template< typename T >
104 void WritePoints(T *buffer, std::ofstream & outputFile)
106 float *data =
new float[this->m_NumberOfPoints * this->m_PointDimension];
108 for (
SizeValueType ii = 0; ii < this->m_NumberOfPoints; ii++ )
110 for (
unsigned int jj = 0; jj < this->m_PointDimension; jj++ )
112 data[ii * this->m_PointDimension + jj] =
static_cast< float >( buffer[ii * this->m_PointDimension + jj] );
121 template<
typename T >
128 ReadCellsBuffer(buffer, data);
135 template<
typename TInput,
typename TOutput >
138 if ( input && output )
140 for (
SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
142 for (
unsigned int jj = 0; jj < 3; jj++ )
147 output[ii * 3 + jj] =
static_cast< TOutput
>( input[5 * ii + jj + 2] );
154 template<
typename T >
157 float *data =
new float[this->m_NumberOfPointPixels];
159 for (
SizeValueType ii = 0; ii < this->m_NumberOfPointPixels; ii++ )
161 data[ii] =
static_cast< float >( buffer[ii] );
172 virtual void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
180 void operator=(const Self &) ITK_DELETE_FUNCTION;
184 std::ifstream m_InputFile;
FreeSurferBinaryMeshIO Self
virtual ~FreeSurferBinaryMeshIO()
SmartPointer< const Self > ConstPointer
Light weight base class for most itk classes.
std::streamoff StreamOffsetType
KWIML_INT_uint32_t uint32_t
unsigned long SizeValueType
SmartPointer< Self > Pointer
void WritePointData(T *buffer, std::ofstream &outputFile)
Superclass::StreamOffsetType StreamOffsetType
void WriteCells(T *buffer, std::ofstream &outputFile)
Superclass::SizeValueType SizeValueType
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.