[ITK] [ITK-dev] Problem using TriangleToSimplexFilter

Pfaehler, EAG (ngmb) e.a.g.pfaehler at umcg.nl
Tue Aug 22 10:33:04 EDT 2017


Dear all,

I have an image mask, from which I need the surface, the volume, the flatness etc.

For this, I wanted to transform my mask in  mesh. In order to calculate the volume, I wanted to transform the normal mesh to a simplex mesh using the TriangleToSimplexFilter.
This is my code:

typedef itk::Mesh<float, 3> MeshType;
    typedef itk::SimplexMesh<float, 3> TSimplex;
    typedef itk::TriangleMeshToSimplexMeshFilter<MeshType, TSimplex> TriangleToSimplexFilter;
    typedef itk::SimplexMeshVolumeCalculator<TSimplex> TVolume;
    typedef unsigned char PixelType;
    typedef itk::BinaryMask3DMeshSource<ImageType, MeshType> MeshSourceType;
    typename MeshSourceType::Pointer meshSource = MeshSourceType::New();
    const PixelType objectValue = static_cast<PixelType>(1);
    meshSource->SetObjectValue(objectValue);
    meshSource->SetInput(mask);
    try{
        meshSource->Update();
    }
    catch(itk::ExceptionObject &exp){
        std::cerr<<"Exception throwing during update()"<<std::endl;
    }
      // Ensure that all cells of the mesh are triangles.
  for (MeshType::CellsContainerIterator it = meshSource->GetOutput()->GetCells()->Begin();
       it != meshSource->GetOutput()->GetCells()->End();
       ++it)
    {
    MeshType::CellAutoPointer cell;
    meshSource->GetOutput()->GetCell(it->Index(), cell);
    if (3 != cell->GetNumberOfPoints())
      {
      std::cerr << "ERROR: All cells must be trianglar." << std::endl;

      }
    }

    TriangleToSimplexFilter::Pointer Transform2Simplex = TriangleToSimplexFilter::New();
    Transform2Simplex->SetInput(meshSource->GetOutput());
    Transform2Simplex->Update();

However, when I run the code, it is calculating and never stopping. Would there be another approach? And does someone knows where the problem could be?

Thanks in advance for the help

Elli
________________________________
De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de geadresseerde(n). Anderen dan de geadresseerde(n) mogen geen gebruik maken van dit bericht, het niet openbaar maken of op enige wijze verspreiden of vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor een incomplete aankomst of vertraging van dit verzonden bericht.

The contents of this message are confidential and only intended for the eyes of the addressee(s). Others than the addressee(s) are not allowed to use this message, to make it public or to distribute or multiply this message in any way. The UMCG cannot be held responsible for incomplete reception or delay of this transferred message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170822/54b839a9/attachment.html>
-------------- next part --------------
_______________________________________________
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://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-developers


More information about the Community mailing list