18 #ifndef itkSTLMeshIO_h
19 #define itkSTLMeshIO_h
21 #include "IOSTLExport.h"
60 virtual bool CanReadFile(
const char *FileNameToRead) ITK_OVERRIDE;
66 virtual void ReadMeshInformation() ITK_OVERRIDE;
69 virtual
void ReadPoints(
void *buffer) ITK_OVERRIDE;
72 virtual
void ReadCells(
void *buffer) ITK_OVERRIDE;
75 virtual
bool GetUpdatePoints() const ITK_OVERRIDE;
78 virtual
bool GetUpdateCells() const ITK_OVERRIDE;
83 virtual
void ReadPointData(
void * itkNotUsed(buffer) ) ITK_OVERRIDE {};
84 virtual void ReadCellData(
void * itkNotUsed(buffer) ) ITK_OVERRIDE {};
93 virtual bool CanWriteFile(
const char *FileNameToWrite) ITK_OVERRIDE;
96 virtual void WriteMeshInformation() ITK_OVERRIDE;
99 virtual
void Write() ITK_OVERRIDE;
107 virtual
void WritePoints(
void * buffer ) ITK_OVERRIDE;
125 virtual
void WriteCells(
void *buffer) ITK_OVERRIDE;
130 virtual
void WritePointData(
void * itkNotUsed(buffer) ) ITK_OVERRIDE {};
138 void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
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 )
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
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
static ITK_CONSTEXPR_VAR double pi
PointsMapType m_PointsMap
CellsVectorType m_CellsVector
virtual void WriteCellData(void *) override
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
Control indentation during Print() invocation.
CovariantVector< PointValueType, 3 > NormalType
Abstract superclass defines mesh IO interface.
virtual void ReadCellData(void *) override
std::ofstream m_OutputStream
KWIML_INT_int32_t int32_t
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.
SmartPointer< const Self > ConstPointer