<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<br>
Hi all,<br>
<br>
I working with BinaryMask3DMeshSource. If I understand correctly, the filter selects pixels with a given
ObjectValue parameter.<br>
Now, how can I get the ObjectValue parameter of a given pixel that I
see in an image data?<br>
Moreover, is there any way of enforce that the output should be a
connected surface?<br>
<br>
code:<br>
<br>
int main(int argc, char * argv[] ) <br>
{<br>
<br>
if( argc < 3 )<br>
{<br>
std::cerr << "Usage: IsoSurfaceExtraction inputImageFile objectValue" << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
const unsigned int Dimension = 3;<br>
typedef signed short PixelType;<br>
<br>
typedef itk::Image< PixelType, Dimension > ImageType;<br>
<br>
typedef itk::ImageFileReader< ImageType > ReaderType;<br>
ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName( argv[1] );<br>
<br>
try<br>
{<br>
reader->Update();<br>
}<br>
catch( itk::ExceptionObject & exp )<br>
{<br>
std::cerr << "Exception thrown while reading the input file " << std::endl;<br>
std::cerr << exp << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double> TriangleMeshTraits; <br>
typedef itk::Mesh<double,3, TriangleMeshTraits> MeshType;<br>
typedef MeshType::Pointer MeshPointer; <br>
typedef itk::BinaryMask3DMeshSource< ImageType, MeshType > MeshSourceType;<br>
<br>
MeshSourceType::Pointer meshSource = MeshSourceType::New();<br>
<br>
const PixelType objectValue = static_cast<PixelType>( atof( argv[2] ) );<br>
meshSource->SetObjectValue( objectValue );<br>
meshSource->SetInput( reader->GetOutput() );<br>
<br>
try<br>
{<br>
meshSource->Update();<br>
}<br>
catch( itk::ExceptionObject & exp )<br>
{<br>
std::cerr << "Exception thrown during Update() " << std::endl;<br>
std::cerr << exp << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
std::cout << "Nodes = " << meshSource->GetNumberOfNodes() << std::endl;<br>
std::cout << "Cells = " << meshSource->GetNumberOfCells() << std::endl;<br>
<br>
typedef itk::VTKPolyDataWriter< MeshType > MeshWriterType;
<br>
MeshWriterType::Pointer meshWriter = MeshWriterType::New();
<br>
meshWriter->SetFileName( "newojo.vtk" );
<br>
meshWriter->SetInput( meshSource->GetOutput() );
<br>
meshWriter->Update();<br>
<br>
return 0;<br>
<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
thanks,<br>
Noé Jiménez<br>
<br /><hr />Disfruta antes que nadie del nuevo <a href='http://download.live.com' target='_new'>Windows Live Messenger</a></body>
</html>