18 #ifndef itkSTLMeshIO_h
19 #define itkSTLMeshIO_h
21 #include "IOSTLExport.h"
60 virtual bool CanReadFile(
const char *FileNameToRead);
66 virtual void ReadMeshInformation();
69 virtual void ReadPoints(
void *buffer);
72 virtual void ReadCells(
void *buffer);
75 virtual bool GetUpdatePoints()
const;
78 virtual bool GetUpdateCells()
const;
93 virtual bool CanWriteFile(
const char *FileNameToWrite);
96 virtual void WriteMeshInformation();
107 virtual void WritePoints(
void * buffer );
125 virtual void WriteCells(
void *buffer);
138 void PrintSelf(std::ostream & os,
Indent indent)
const;
142 template<
typename TPo
intsBuffer >
146 const unsigned int pointDimension = this->GetPointDimension();
148 if ( pointDimension != 3 )
150 itkExceptionMacro(
"STL only supports 3D points");
153 const TPointsBuffer * pointCoordinates = buffer;
155 this->m_Points.clear();
159 this->m_Points.resize(numberOfPoints);
163 for(
unsigned int i = 0; i < pointDimension; ++i )
174 void operator=(
const Self &);
190 void WriteInt32AsBinary(
int32_t value);
191 void WriteInt16AsBinary(
int16_t value);
192 void WriteNormalAsBinary(
const NormalType & normal);
193 void WritePointAsBinary(
const PointType & point);
197 void ReadMeshInternalFromAscii();
198 void ReadMeshInternalFromBinary();
202 void ReadInt32AsBinary(
int32_t & value);
203 void ReadInt16AsBinary(
int16_t & value);
205 void ReadPointAsBinary(
PointType & point);
209 void ReadStringFromAscii(
const std::string & keyword);
210 void ReadPointAsAscii(
PointType & point);
211 bool CheckStringFromAscii(
const std::string & expected);
215 virtual void WriteCellsAsAscii(
void *buffer);
216 virtual void WriteCellsAsBinary(
void *buffer);
220 void InsertPointIntoSet(
const PointType & point );
232 return p1[0] < p2[0];
238 return p1[1] < p2[1];
242 return p1[2] < p2[2];
271 #endif // itkSTLMeshIO_h
virtual void ReadPointData(void *)
Light weight base class for most itk classes.
void WritePointsTyped(const TPointsBuffer *const buffer)
unsigned int m_PointInTriangleCounter
SmartPointer< Self > Pointer
Vector< PointValueType, 3 > VectorType
unsigned int m_InputLineNumber
virtual void ReadCellData(void *)
PointsMapType m_PointsMap
CellsVectorType m_CellsVector
This class defines how to read and write STL file format.
std::vector< TripletType > CellsVectorType
Point< PointValueType, 3 > PointType
std::vector< PointType > PointContainerType
SizeValueType IdentifierType
PointContainerType m_Points
KWIML_INT_int16_t int16_t
A templated class holding a n-Dimensional vector.
IdentifierType m_LatestPointId
bool operator()(const PointType &p1, const PointType &p2) const
std::map< PointType, IdentifierType, PointCompare > PointsMapType
std::ifstream m_InputStream
TripletType m_TrianglePointIds
virtual void WritePointData(void *)
Control indentation during Print() invocation.
CovariantVector< PointValueType, 3 > NormalType
Abstract superclass defines mesh IO interface.
std::ofstream m_OutputStream
KWIML_INT_int32_t int32_t
virtual void WriteCellData(void *)
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.
SmartPointer< const Self > ConstPointer