# STL files

**URL:** <https://discourse.itk.org/t/stl-files/650>\
**Category:** Algorithms\
**Created:** [February 7, 2018, 8:36am UTC](https://discourse.itk.org/t/stl-files/650 "2018-02-07T08:36:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scleri](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@Scleri](https://discourse.itk.org/u/Scleri)\
**Post date:** [February 7, 2018, 8:36am UTC](https://discourse.itk.org/t/stl-files/650/1 "2018-02-07T08:36:03Z")

</div>

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();
`

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [February 7, 2018, 1:42pm UTC](https://discourse.itk.org/t/stl-files/650/2 "2018-02-07T13:42:35Z")

</div>

Hi Giulia,

For a detailed description, example usage, and example datasets, the  
corresponding [Insight Journal article](http://hdl.handle.net/10380/3452)  
and [repository](https://github.com/InsightSoftwareConsortium/ITKSTLMeshIO)  
are good references.

HTH,  
Matt

---

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [February 7, 2018, 1:45pm UTC](https://discourse.itk.org/t/stl-files/650/3 "2018-02-07T13:45:27Z")

</div>

Hello,

Overall, ITK is not really efficient with meshes. You should take a look at VTK which handles [STL reading](https://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadSTL) easily, giving a polydata structure that contains the points.

Should you stay with ITK, you have mere examples in the [wiki](https://itk.org/Wiki/ITK/Examples#Meshes).  
I think the way to do it is to use a STLMeshIO within a [MeshFileReader](https://itk.org/Insight/Doxygen/html/classitk_1_1MeshFileReader.html) (through the SetMeshIO function).  
Then you can access points through the various functions of the output [Mesh](https://itk.org/Insight/Doxygen/html/classitk_1_1Mesh.html).

HTH
