The surface created from Marching Cube and the mesh created from it is not smooth enough

Hi,

I am still in the process of learning ITK/VTK and struggling for a few days to create a mesh with three types (triangle, tetrahedron, and Simplex) of cells from the binary mask volume. I feel that I am doing some mistakes.

What I did is that

  • I created the surface by following the procedure in this link using marching cubes and setting the parameters as follows:

    double isoValue = 0.5; // threshold value
    surface->ComputeNormalsOn();
    surface->ComputeGradientsOn();
    surface->SetValue(0, isoValue); // second value acts as threshold
    surface->Update();

and saved the surface in a vtkPolyData

  • I created the triangle mesh by following the commands in this link.

My question is two-folded:

  1. The surface created using Marching Cube does not look smooth, and the mesh edges and cells also look the same (see the figures). Is this a usual representation of triangle mesh and marching cube? Or should I change any parameter?

Marching cube surface

marchingcube

Mesh surface
mesh
and the mesh structure types that I have defined:

#ifndef vtkFloatingPointType
#define vtkFloatingPointType double
#endif

const unsigned int PointDimension   = 3;
const unsigned int MaxCellDimension = 3;

typedef itk::DefaultStaticMeshTraits<
        vtkFloatingPointType,
        PointDimension,
        MaxCellDimension,
        vtkFloatingPointType,
        vtkFloatingPointType  >       MeshTraits;


typedef itk::Mesh<
        vtkFloatingPointType,
        PointDimension,
        MeshTraits              >     floatMeshType;
  1. What changes can I carry out in this code to have a tetrahedron mesh?

Thank you

For smooth surface, turn on Module_Cuberille when building ITK and use itk::CuberilleImageToMeshFilter instead of vtkMarchingCubes.

For tetrahedal mesh generation, take a look at this message. The main class is here.

2 Likes

@dzenanz Hi Sir, Thanks for introducing CuberilleImageToMeshFilter. I have attached two meshes: 1)CuberilleMesh 2)MarchingCubeMesh, which have been created triangle mesh by using two methods.
meshes.zip (2.3 MB)

using CuberFilterType=itk::CuberilleImageToMeshFilter<ImageType ,floatMeshType >;

CuberFilterType::Pointer cuberFilter=CuberFilterType::New();
cuberFilter->SetInput(image);

   try
        {
            cuberFilter->Update();
        }
        catch (itk::ExceptionObject & error)
        {
            std::cerr << "Error: " << error << std::endl;
            return EXIT_FAILURE;
        }

floatMeshType::Pointer cuberMesh = cuberFilter->GetOutput();

As you can view the meshes, there is not that much difference between the two meshes in terms of smoothness. I am wondering should I change any parameter for the cuberFilter ? Or if I am doing some mistakes somewhere.

The famous bunny mesh looks smooth and the size of triangles are big. As attached here:
bunny_mesh.zip (1.1 MB)

How the size and the number of triangle (or other cell types) in a mesh can affect the mesh processing?

Probably your input mesh is highly anisotropic. Resampling the image to have cubic voxels before segmentation will fix the issue. See some more details in this discussion.

For a smoother mesh, use a b-spline interpolator on the original volume data, not the thresholded volume, as described in the Cuberille Insight Journal article.

2 Likes