19#ifndef itkFreeSurferAsciiMeshIO_h
20#define itkFreeSurferAsciiMeshIO_h
21#include "ITKIOMeshFreeSurferExport.h"
116 template <
typename T>
118 WritePoints(T * buffer, std::ofstream & outputFile, T label = T{})
120 outputFile.precision(6);
122 for (
SizeValueType ii = 0; ii < this->m_NumberOfPoints; ++ii)
124 for (
unsigned int jj = 0; jj < this->m_PointDimension; ++jj)
126 outputFile << std::fixed << buffer[index++] <<
" ";
128 outputFile << label <<
'\n';
133 template <
typename T>
135 WriteCells(T * buffer, std::ofstream & outputFile, T label = T{})
137 constexpr unsigned int numberOfCellPoints = 3;
140 const auto data = make_unique_for_overwrite<T[]>(this->m_NumberOfCells * numberOfCellPoints);
142 ReadCellsBuffer(buffer, data.get());
146 for (
unsigned int jj = 0; jj < numberOfCellPoints; ++jj)
148 outputFile << data[index++] <<
" ";
150 outputFile << label <<
'\n';
155 template <
typename TInput,
typename TOutput>
163 for (
unsigned int jj = 0; jj < 3; ++jj)
168 output[ii * 3 + jj] =
static_cast<TOutput
>(input[5 * ii + jj + 2]);
187 std::ifstream m_InputFile{};
This class defines how to read and write freesurfer ASCII surface format. To use IO factory,...
void ReadCells(void *buffer) override
void WriteMeshInformation() override
void ReadPoints(void *buffer) override
bool CanReadFile(const char *fileName) override
void WritePoints(T *buffer, std::ofstream &outputFile, T label=T{})
void ReadPointData(void *buffer) override
void WriteCells(void *buffer) override
void ReadCellsBuffer(TInput *input, TOutput *output)
~FreeSurferAsciiMeshIO() override
bool CanWriteFile(const char *fileName) override
void PrintSelf(std::ostream &os, Indent indent) const override
void WritePoints(void *buffer) override
void WriteCellData(void *buffer) override
void WriteCells(T *buffer, std::ofstream &outputFile, T label=T{})
void WritePointData(void *buffer) override
void ReadCellData(void *buffer) override
void ReadMeshInformation() override
Control indentation during Print() invocation.
Light weight base class for most itk classes.
Abstract superclass defines mesh IO interface.
IdentifierType SizeValueType
Base class for most ITK classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType