STL files

Hi there,

I need to store points of a STL file in a container,
I found this class: itkSTLMeshIO,
But I’m not able to store point of the input STL file in a container. Should I use ReadDataPoint?
I don’t understand how it works, where can I find some examples?

const unsigned int Dimension = 3; typedef float PixelType;

typedef itk::QuadEdgeMesh<PixelType, Dimension> QEMeshType;

itk::STLMeshIOFactory::RegisterOneFactory();

typedef itk::MeshFileReader< QEMeshType > ReaderType;ReaderType::Pointer reader = ReaderType::New();
std::vectoritk::STLMeshIO::PointType test;
reader->SetFileName( argv[1] );
itk::STLMeshIO pointer=itk::STLMeshIO::New();
pointer=reader->GetOutput();
pointer.ReadPointData();

Hi Giulia,

For a detailed description, example usage, and example datasets, the
corresponding Insight Journal article
and repository
are good references.

HTH,
Matt

2 Likes

Hello,

Overall, ITK is not really efficient with meshes. You should take a look at VTK which handles STL reading easily, giving a polydata structure that contains the points.

Should you stay with ITK, you have mere examples in the wiki.
I think the way to do it is to use a STLMeshIO within a MeshFileReader (through the SetMeshIO function).
Then you can access points through the various functions of the output Mesh.

HTH

1 Like