18 #include <vtkCleanPolyData.h>
19 #include <vtkPolyData.h>
20 #include <vtkPolyDataNormals.h>
21 #include <vtkSTLReader.h>
22 #include <vtkSmartPointer.h>
38 MITK_INFO(
"mitkSTLFileReader") <<
"Loading " << m_FileName <<
" as stl..." << std::endl;
40 stlReader->SetFileName(m_FileName.c_str());
43 normalsGenerator->SetInputConnection(stlReader->GetOutputPort());
46 cleanPolyDataFilter->SetInputConnection(normalsGenerator->GetOutputPort());
47 cleanPolyDataFilter->PieceInvariantOff();
48 cleanPolyDataFilter->ConvertLinesToPointsOff();
49 cleanPolyDataFilter->ConvertPolysToLinesOff();
50 cleanPolyDataFilter->ConvertStripsToPolysOff();
51 cleanPolyDataFilter->PointMergingOn();
52 cleanPolyDataFilter->Update();
54 if ((stlReader->GetOutput() !=
nullptr) && (cleanPolyDataFilter->GetOutput() !=
nullptr))
56 vtkSmartPointer<vtkPolyData> surfaceWithNormals = cleanPolyDataFilter->GetOutput();
57 output->SetVtkPolyData(surfaceWithNormals);
73 bool extensionFound =
false;
74 std::string::size_type STLPos = filename.rfind(
".stl");
75 if ((STLPos != std::string::npos) && (STLPos == filename.length() - 4))
77 extensionFound =
true;
80 STLPos = filename.rfind(
".STL");
81 if ((STLPos != std::string::npos) && (STLPos == filename.length() - 4))
83 extensionFound =
true;
Superclass of all classes generating surfaces (instances of class Surface) as output.
DataCollection - Class to facilitate loading/accessing structured data.
static const std::string filename
virtual void GenerateData() override
static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.