int main(int argc, char * argv[] )
{
if( argc < 3 )
{
std::cerr << "Usage: IsoSurfaceExtraction inputImageFile objectValue " << std::endl;
return EXIT_FAILURE;
}
const unsigned int Dimension = 3;
typedef unsigned char PixelType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
try
{
reader->Update();
}
{
std::cerr << "Exception thrown while reading the input file " << std::endl;
std::cerr << exp << std::endl;
return EXIT_FAILURE;
}
MeshSourceType::Pointer meshSource = MeshSourceType::New();
const PixelType objectValue = static_cast<PixelType>( atof( argv[2] ) );
meshSource->SetObjectValue( objectValue );
meshSource->SetInput( reader->GetOutput() );
try
{
meshSource->Update();
}
{
std::cerr << "Exception thrown during Update() " << std::endl;
std::cerr << exp << std::endl;
return EXIT_FAILURE;
}
std::cout << "Nodes = " << meshSource->GetNumberOfNodes() << std::endl;
std::cout << "Cells = " << meshSource->GetNumberOfCells() << std::endl;
return EXIT_SUCCESS;
}