[Insight-users] ObjectValue ITK

Noé Jimenez Costa noein69 at hotmail.com
Thu Jul 9 08:48:04 EDT 2009




Hi all,



I working with BinaryMask3DMeshSource. If I understand correctly, the filter selects pixels with a given
ObjectValue parameter.


Now, how can I get the ObjectValue parameter of a given pixel that I
see in an image data?


Moreover, is there any way of enforce that the output should be a
connected surface?



code:



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 signed short PixelType;



  typedef itk::Image< PixelType, Dimension >   ImageType;



  typedef itk::ImageFileReader< ImageType >    ReaderType;

  ReaderType::Pointer reader = ReaderType::New();

  reader->SetFileName( argv[1] );



  try

    {

    reader->Update();

    }

  catch( itk::ExceptionObject & exp )

    {

    std::cerr << "Exception thrown while reading the input file " << std::endl;

    std::cerr << exp << std::endl;

    return EXIT_FAILURE;

    }

  

  typedef itk::DefaultDynamicMeshTraits<double, 3, 3,double,double> TriangleMeshTraits; 

  typedef itk::Mesh<double,3, TriangleMeshTraits> MeshType;

  typedef MeshType::Pointer MeshPointer; 

  typedef itk::BinaryMask3DMeshSource< ImageType, MeshType > MeshSourceType;



  MeshSourceType::Pointer meshSource = MeshSourceType::New();

  

  const PixelType objectValue = static_cast<PixelType>( atof( argv[2] ) );

  meshSource->SetObjectValue( objectValue );

  meshSource->SetInput( reader->GetOutput() );



  try

    {

    meshSource->Update();

    }

  catch( itk::ExceptionObject & exp )

    {

    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;

  

typedef itk::VTKPolyDataWriter< MeshType > MeshWriterType;


    MeshWriterType::Pointer meshWriter = MeshWriterType::New();


    meshWriter->SetFileName( "newojo.vtk" );


    meshWriter->SetInput( meshSource->GetOutput() );


    meshWriter->Update();



return 0;





  return EXIT_SUCCESS;

}





thanks,

Noé Jiménez


_________________________________________________________________
Llévate Messenger en el móvil a todas partes ¡Conéctate!
http://www.microsoft.com/spain/windowsmobile/messenger/default.mspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090709/0e4a98cf/attachment.htm>


More information about the Insight-users mailing list