|
| 1 | +#include "BordersOutCLP.h" |
| 2 | + |
| 3 | +//VTK Includes |
| 4 | +#include "vtkXMLPolyDataWriter.h" |
| 5 | +#include "vtkXMLPolyDataReader.h" |
| 6 | +#include "vtkSmartPointer.h" |
| 7 | +#include "vtkPolyData.h" |
| 8 | +#include "vtkTriangleFilter.h" |
| 9 | +#include "vtkNew.h" |
| 10 | +#include "vtkFeatureEdges.h" |
| 11 | +#include "vtkCleanPolyData.h" |
| 12 | + |
| 13 | + |
| 14 | +int main (int argc, char * argv[]) |
| 15 | + { |
| 16 | + PARSE_ARGS; |
| 17 | + |
| 18 | + try{ |
| 19 | + int NBorders; |
| 20 | + int TOTALBorders; |
| 21 | + |
| 22 | + vtkSmartPointer<vtkPolyData> polyData; |
| 23 | + |
| 24 | + // Read the file |
| 25 | + vtkNew<vtkXMLPolyDataReader> reader; |
| 26 | + reader->SetFileName(inputVolume.c_str()); |
| 27 | + reader->Update(); |
| 28 | + polyData = reader->GetOutput(); |
| 29 | + |
| 30 | + vtkNew<vtkCleanPolyData> meshinC; |
| 31 | + meshinC->SetInputData(polyData); |
| 32 | + meshinC->Update(); |
| 33 | + |
| 34 | + vtkNew<vtkFeatureEdges> boundaryEdges; |
| 35 | + boundaryEdges->SetInputData(meshinC->GetOutput()); |
| 36 | + boundaryEdges->BoundaryEdgesOn(); |
| 37 | + //boundaryEdges->FeatureEdgesOff(); |
| 38 | + boundaryEdges->NonManifoldEdgesOff(); |
| 39 | + boundaryEdges->ManifoldEdgesOff(); |
| 40 | + boundaryEdges->Update(); |
| 41 | + |
| 42 | + NBorders = (boundaryEdges->GetOutput()->GetNumberOfLines()); |
| 43 | + TOTALBorders = NBorders; |
| 44 | + |
| 45 | + //std::cout << "Number of Border Edges... " << TOTALBorders << std::endl; |
| 46 | + |
| 47 | + //Write to file |
| 48 | + vtkNew<vtkXMLPolyDataWriter> writer; |
| 49 | + writer->SetFileName(outputVolume.c_str()); |
| 50 | + writer->SetInputData(boundaryEdges->GetOutput()); |
| 51 | + writer->Update(); |
| 52 | + } |
| 53 | + catch (int e) |
| 54 | + { |
| 55 | + cout << "An exception occurred. Exception Nr. " << e << '\n'; |
| 56 | + return EXIT_FAILURE; |
| 57 | + } |
| 58 | + |
| 59 | + return EXIT_SUCCESS; |
| 60 | + |
| 61 | + } |
0 commit comments