18 #ifndef itkSTLMeshIO_h
19 #define itkSTLMeshIO_h
21 #include "IOSTLExport.h"
62 bool CanReadFile(
const char *FileNameToRead)
override;
68 void ReadMeshInformation()
override;
71 void ReadPoints(
void *buffer)
override;
74 void ReadCells(
void *buffer)
override;
77 bool GetUpdatePoints()
const override;
80 bool GetUpdateCells()
const override;
95 bool CanWriteFile(
const char *FileNameToWrite)
override;
98 void WriteMeshInformation()
override;
101 void Write()
override;
109 void WritePoints(
void * buffer )
override;
127 void WriteCells(
void *buffer)
override;
140 void PrintSelf(std::ostream & os,
Indent indent)
const override;
144 template<
typename TPo
intsBuffer >
148 const unsigned int pointDimension = this->GetPointDimension();
150 if ( pointDimension != 3 )
152 itkExceptionMacro(
"STL only supports 3D points");
155 const TPointsBuffer * pointCoordinates = buffer;
157 this->m_Points.clear();
161 this->m_Points.resize(numberOfPoints);
165 for(
unsigned int i = 0; i < pointDimension; ++i )
189 void WriteInt32AsBinary(
int32_t value);
190 void WriteInt16AsBinary(
int16_t value);
191 void WriteNormalAsBinary(
const NormalType & normal);
192 void WritePointAsBinary(
const PointType & point);
196 void ReadMeshInternalFromAscii();
197 void ReadMeshInternalFromBinary();
201 void ReadInt32AsBinary(
int32_t & value);
202 void ReadInt16AsBinary(
int16_t & value);
204 void ReadPointAsBinary(
PointType & point);
208 void ReadStringFromAscii(
const std::string & keyword);
209 void ReadPointAsAscii(
PointType & point);
210 bool CheckStringFromAscii(
const std::string & expected);
214 virtual void WriteCellsAsAscii(
void *buffer);
215 virtual void WriteCellsAsBinary(
void *buffer);
219 void InsertPointIntoSet(
const PointType & point );
231 return p1[0] < p2[0];
237 return p1[1] < p2[1];
241 return p1[2] < p2[2];
270 #endif // itkSTLMeshIO_h
void ReadCellData(void *) override
Light weight base class for most itk classes.
void WritePointsTyped(const TPointsBuffer *const buffer)
unsigned int m_PointInTriangleCounter
unsigned int m_InputLineNumber
static constexpr double pi
PointsMapType m_PointsMap
CellsVectorType m_CellsVector
void ReadPointData(void *) override
This class defines how to read and write STL file format.
std::map< PointType, IdentifierType, PointCompare > PointsMapType
void WriteCellData(void *) override
PointContainerType m_Points
A templated class holding a n-Dimensional vector.
IdentifierType m_LatestPointId
void WritePointData(void *) override
std::vector< TripletType > CellsVectorType
bool operator()(const PointType &p1, const PointType &p2) const
SizeValueType IdentifierType
std::ifstream m_InputStream
TripletType m_TrianglePointIds
Control indentation during Print() invocation.
Abstract superclass defines mesh IO interface.
std::ofstream m_OutputStream
Base class for most ITK classes.
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.
std::vector< PointType > PointContainerType