SPHARM-PDM Euler Number problem


Hello everyone,

For my M.Sc. Thesis work, I need to apply SPHARM-PDM analysis to certain number of segmented hippocampi from an experiment but I am really new to the program and I still cannot make sense out of it clearly.

When I follow the tutorial, I open the Slicer 3D and I go to the Shape Analysis Model and I want to apply it to the segmented hippocampi mesh file .vtk (which is not empty, I can visualize it in MATLAB through trisurf command). It first converts it from mesh to label map (Step 0 folder is non-empty), then applies post process segmentation and I get the _pp file but on second step I get the following error:

itk::ExceptionObject (0x7ffeb221f1a0)
Location: “Unknown”
File: /home/kitware/Dashboards/Stable/S-481-E-b/SPHARM-PDM/Libraries/Shape/Algorithms/BinaryMask3DEqualAreaParametricMeshSource.txx
Line: 183
Description: Warning: Euler equation not satisfied. Euler Number : 781156 - 781156 = 0

and I don’t know where to look for the problem - I looked through many forum posts and could not find a similar problem. Is it because I am using .vtk file instead of .nii.gz or something similar, a label map? Which I highly doubt because the tutorial says that .vtk files are valid inputs. Is it because there is something wrong in the segmentation or in the settings I have?

I would appreciate any help, thanks in advance.

(Andras Lasso) #2

@bpaniagua @laurapascal

(Beatriz Paniagua) #3

Hi Arda,

Have you visualized the topology of your VTK / nii.gz object? If the Euler Number is not satisfied that means the spherical topology required by SPHARM is not met.

More information on the Euler Number is here https://en.wikipedia.org/wiki/Euler_characteristic#Surfaces

Thank you!


Hi Beatriz,

I do not know exactly what you mean by visualizing the topology but when I visualized the .vtk file it was a normal right hippocampus of one subject which was segmented with another program that I used couple of weeks ago, named FSL. Interesting thing is that the program also gives the masks for segmenting out the subcortical structure in NIFTI format, which are label maps (1 for the structure 0 for background) and when I used these files I did not have any problem with applying SPHARM-PDM analysis - there was no Euler number error, I was able to extract SPHARM parameters and visualize the images in the tutorial. Thus, I was really confused. I am not exactly sure if it would be the same analysis doing it through the masks rather than segmented subcortical structure but I would feel more secure if I was able to carry out the analysis through the meshed segmented file .vtk. Do you have any idea what might be the cause of that? Because the structure is the same structure (probably same topology) just different representations, one mesh and one label map. At the end of the day it might not be any problem (especially since I was able to get different SPHARM parameters for different subjects as expected) but I would like to figure out why .vtk mesh file raises the problem of Euler number.

Thank you for your help,

(Beatriz Paniagua) #5

Hi Arda,

I apologize for this error!

I would double check the SegPostprocess output. It is possible that the scan conversion from VTK to binary label map is causing topology errors. This is a new feature in SPHARM-PDM and I would recommend looking at the label created after the conversion in the Step1_SegPostprocess folder to see if the VTK topology holds after scan conversion.


(Hamed Rabiei) #6


I encountered the same problem for some triangulated mouse brain surfaces (Euler number = 0). I put here a heuristic solution that I found: I applied the “Close Holes” and “TwoStep Smooth” filters of MeshLab on problematic meshes and then the SPHARM worked properly. The intuition behind this idea is to close holes and refine the problematic regions by smoothing.


P.S. I used PyMesh package to check whether a mesh is closed through the method mesh.is_closed(). (https://github.com/qnzhou/PyMesh)

(Beatriz Paniagua) #7

Hi Hamed,

This is great information, thank you so much!