19 #ifndef itkOFFMeshIO_h
20 #define itkOFFMeshIO_h
21 #include "ITKIOMeshOFFExport.h"
55 itkOverrideGetNameOfClassMacro(
OFFMeshIO);
65 CanReadFile(
const char * fileName)
override;
69 ReadMeshInformation()
override;
73 ReadPoints(
void * buffer)
override;
76 ReadCells(
void * buffer)
override;
79 ReadPointData(
void * buffer)
override;
82 ReadCellData(
void * buffer)
override;
92 CanWriteFile(
const char * fileName)
override;
96 WriteMeshInformation()
override;
101 WritePoints(
void * buffer)
override;
104 WriteCells(
void * buffer)
override;
107 WritePointData(
void * buffer)
override;
110 WriteCellData(
void * buffer)
override;
117 template <
typename T>
122 unsigned int numberOfPoints = 0;
127 inputFile >> numberOfPoints;
128 buffer[index++] = static_cast<T>(numberOfPoints);
129 for (
unsigned int jj = 0; jj < numberOfPoints; ++jj)
131 inputFile >> buffer[index++];
133 std::getline(inputFile, line,
'\n');
140 template <
typename TInput,
typename TOutput>
151 auto numberOfPoints = static_cast<unsigned int>(input[indInput++]);
152 output[indOutput++] = static_cast<TOutput>(numberOfPoints);
153 for (
unsigned int jj = 0; jj < numberOfPoints; ++jj)
155 output[indOutput++] = static_cast<TOutput>(input[indInput++]);
162 template <
typename T>
171 auto numberOfCellPoints = static_cast<unsigned int>(buffer[index++]);
172 outputFile << numberOfCellPoints <<
" ";
174 for (
unsigned int jj = 0; jj < numberOfCellPoints; ++jj)
176 outputFile << buffer[index++] <<
" ";
183 template <
typename TOutput,
typename TInput>
187 const auto data = make_unique_for_overwrite<TOutput[]>(m_CellBufferSize - this->m_NumberOfCells);
189 ReadCellsBuffer(buffer, data.get());
190 WriteBufferAsBinary<TOutput>(data.get(), outputFile, m_CellBufferSize - this->m_NumberOfCells);
198 PrintSelf(std::ostream & os,
Indent indent)
const override;
207 std::ifstream m_InputFile{};
209 bool m_TriangleCellType{};