19 #ifndef __itkFreeSurferAsciiMeshIO_h
20 #define __itkFreeSurferAsciiMeshIO_h
21 #include "ITKIOMeshExport.h"
60 virtual bool CanReadFile(
const char *FileNameToRead);
63 virtual void ReadMeshInformation();
66 virtual void ReadPoints(
void *buffer);
68 virtual void ReadCells(
void *buffer);
70 virtual void ReadPointData(
void *buffer);
72 virtual void ReadCellData(
void *buffer);
81 virtual bool CanWriteFile(
const char *FileNameToWrite);
84 virtual void WriteMeshInformation();
88 virtual void WritePoints(
void *buffer);
90 virtual void WriteCells(
void *buffer);
92 virtual void WritePointData(
void *buffer);
94 virtual void WriteCellData(
void *buffer);
100 template<
typename T >
103 outputFile.precision(6);
105 for (
SizeValueType ii = 0; ii < this->m_NumberOfPoints; ii++ )
107 for (
unsigned int jj = 0; jj < this->m_PointDimension; jj++ )
109 outputFile << std::fixed << buffer[index++] <<
" ";
111 outputFile << label <<
'\n';
116 template<
typename T >
119 const unsigned int numberOfCellPoints = 3;
122 T *data =
new T[this->m_NumberOfCells * numberOfCellPoints];
124 ReadCellsBuffer(buffer, data);
126 for (
SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
128 for (
unsigned int jj = 0; jj < numberOfCellPoints; jj++ )
130 outputFile << data[index++] <<
" ";
132 outputFile << label <<
'\n';
138 template<
typename TInput,
typename TOutput >
141 if ( input && output )
143 for (
SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
145 for (
unsigned int jj = 0; jj < 3; jj++ )
149 output[ii * 3 + jj] =
static_cast< TOutput
>( input[5 * ii + jj + 2] );
159 void PrintSelf(std::ostream & os,
Indent indent)
const;
167 void operator=(
const Self &);
Light weight base class for most itk classes.
virtual ~FreeSurferAsciiMeshIO()
SmartPointer< const Self > ConstPointer
FreeSurferAsciiMeshIO Self
void ReadCellsBuffer(TInput *input, TOutput *output)
unsigned long SizeValueType
SmartPointer< Self > Pointer
void WritePoints(T *buffer, std::ofstream &outputFile, T label=itk::NumericTraits< T >::Zero)
Superclass::SizeValueType SizeValueType
This class defines how to read and write freesurfer ASCII surface format. To use IO factory...
void WriteCells(T *buffer, std::ofstream &outputFile, T label=itk::NumericTraits< T >::Zero)
Control indentation during Print() invocation.
Abstract superclass defines mesh IO interface.
Define additional traits for native types such as int or float.
std::ifstream m_InputFile