1
/*=========================================================================
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkQuadEdgeMeshCleanFilterTest.cxx,v $
6
Date: $Date: 2008-10-04 14:27:51 $
7
Version: $Revision: 1.3 $
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
16
=========================================================================*/
18
#include "itkQuadEdgeMesh.h"
19
#include "itkVTKPolyDataReader.h"
20
#include "itkVTKPolyDataWriter.h"
24
#include "itkQuadEdgeMeshCleanFilter.h"
26
int itkQuadEdgeMeshCleanFilterTest( int argc, char* argv[] )
28
// ** ERROR MESSAGE AND HELP ** //
31
std::cout <<"Requires 3 argument: " <<std::endl;
32
std::cout <<"1-Input file name " <<std::endl;
33
std::cout <<"2-Relative Tolerance " <<std::endl;
34
std::cout <<"3-Output file name " <<std::endl;
40
const unsigned int Dimension = 3;
42
typedef itk::QuadEdgeMesh< Coord, Dimension > MeshType;
43
typedef itk::VTKPolyDataReader< MeshType > ReaderType;
44
typedef itk::VTKPolyDataWriter< MeshType > WriterType;
46
// ** READ THE FILE IN **
47
ReaderType::Pointer reader = ReaderType::New( );
48
reader->SetFileName( argv[1] );
54
catch( itk::ExceptionObject & exp )
56
std::cerr << "Exception thrown while reading the input file " << std::endl;
57
std::cerr << exp << std::endl;
61
MeshType::Pointer mesh = reader->GetOutput( );
64
std::stringstream ssout( argv[2] );
67
typedef itk::QuadEdgeMeshCleanFilter< MeshType, MeshType > CleanFilterType;
68
CleanFilterType::Pointer filter = CleanFilterType::New();
69
filter->SetInput( mesh );
70
filter->SetRelativeTolerance( tol );
74
WriterType::Pointer writer = WriterType::New( );
75
writer->SetInput( filter->GetOutput( ) );
76
writer->SetFileName( argv[3] );