[ITK] [ITK-users] Surface extraction problem

Francisco López-Franca franciscolopezdelafranca at gmail.com
Wed Jul 2 09:19:41 EDT 2014


Hi everybody.
I've created a 3D cylinder by using the class CylinderSpatialObject. After
that, I pass the cylinder object to an object of class
SpatialObjectToImageFilter in order to prepare the spatial object to be
written to file.
I've set both the cylinder object and the image filter a value of 0 for
background and 255 for foreground.
Finally, I pass, as input, the image filter output to an image file writer
(ImageFileWriter) object to save it to file (Nifti format, for instance).
The result is the attached "cilindro.jpg" figure.

Up to here, all is ok. The problem comes next.
What I want is to extract the surface of the 3D cylinder. I search for the
web and found an example, from which I followed the implementation.
I copy below my code and attach the result of the surface extraction
("cilindro_superficie.jpg"), hoping that anyone see if I am committing any
error. I expected just the boundary of the 3D cylinder (with no inside
points), and it seems like the bounding box of the cylinder what I've got
including the inside points.

Thank you very much and my best regards.

My code is (I've erased the obvious code):


    typedef itk::Image< PixelType, Dimension > ImageType;
    typedef itk::Mesh<double, 3> MeshType;

    typedef itk::ImageFileReader< ImageType > ReaderType;
    ReaderType::Pointer reader = ReaderType::New();
    reader->SetFileName(
inputFileName);

        reader->Update();

    typedef itk::BinaryMask3DMeshSource< ImageType, MeshType >
MeshSourceType;
    MeshSourceType::Pointer meshSource = MeshSourceType::New();

    meshSource->SetObjectValue( 255);

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

        meshSource->Update();

    typedef itk::MeshSpatialObject<MeshType> SpatialObjectType;
    SpatialObjectType::Pointer mesh = SpatialObjectType::New();
    mesh->SetMesh(meshSource->GetOutput());

    typedef itk::SpatialObjectToImageFilter<SpatialObjectType, ImageType>
MeshFilterType;
    MeshFilterType::Pointer meshFilter = MeshFilterType::New();

    meshFilter->SetSize(size);
    meshFilter->SetOutsideValue(0);
    meshFilter->SetInsideValue(255);
    meshFilter->SetInput(mesh);

        meshFilter->Update();

    typedef itk::ImageFileWriter<ImageType> ImageWriterType;
    ImageWriterType::Pointer imageWriter = ImageWriterType::New();

    imageWriter->SetFileName(outputFileName);
    imageWriter->SetInput(meshFilter->GetOutput());

        imageWriter->Update();

<http://itk-insight-users.2283740.n2.nabble.com/file/n7585840/cilindro.jpg> 
<http://itk-insight-users.2283740.n2.nabble.com/file/n7585840/cilindro_superficie.jpg> 



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Surface-extraction-problem-tp7585840.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list