19 #ifndef itkFreeSurferBinaryMeshIO_h
20 #define itkFreeSurferBinaryMeshIO_h
21 #include "ITKIOMeshFreeSurferExport.h"
67 CanReadFile(
const char * fileName)
override;
71 ReadMeshInformation()
override;
75 ReadPoints(
void * buffer)
override;
78 ReadCells(
void * buffer)
override;
81 ReadPointData(
void * buffer)
override;
84 ReadCellData(
void * buffer)
override;
94 CanWriteFile(
const char * fileName)
override;
98 WriteMeshInformation()
override;
103 WritePoints(
void * buffer)
override;
106 WriteCells(
void * buffer)
override;
109 WritePointData(
void * buffer)
override;
112 WriteCellData(
void * buffer)
override;
119 template <
typename T>
123 const auto data = make_unique_for_overwrite<float[]>(this->m_NumberOfPoints * this->m_PointDimension);
125 for (
SizeValueType ii = 0; ii < this->m_NumberOfPoints; ++ii)
127 for (
unsigned int jj = 0; jj < this->m_PointDimension; ++jj)
129 data[ii * this->m_PointDimension + jj] = static_cast<float>(buffer[ii * this->m_PointDimension + jj]);
134 data.get(), this->m_NumberOfPoints * this->m_PointDimension, &outputFile);
138 template <
typename T>
142 constexpr itk::uint32_t numberOfCellPoints = 3;
144 const auto data = make_unique_for_overwrite<itk::uint32_t[]>(this->m_NumberOfCells * numberOfCellPoints);
146 ReadCellsBuffer(buffer, data.get());
148 data.get(), this->m_NumberOfCells * numberOfCellPoints, &outputFile);
152 template <
typename TInput,
typename TOutput>
160 for (
unsigned int jj = 0; jj < 3; ++jj)
165 output[ii * 3 + jj] = static_cast<TOutput>(input[5 * ii + jj + 2]);
172 template <
typename T>
176 const auto data = make_unique_for_overwrite<float[]>(this->m_NumberOfPointPixels);
178 for (
SizeValueType ii = 0; ii < this->m_NumberOfPointPixels; ++ii)
180 data[ii] = static_cast<float>(buffer[ii]);
191 PrintSelf(std::ostream & os,
Indent indent)
const override;
201 itk::uint32_t m_FileTypeIdentifier{ 0 };
202 std::ifstream m_InputFile{};