nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
143 stars 54 forks source link

Minimal, maximal and Gaussian curvatures are the same and wrong #182

Closed kalemaria closed 5 years ago

kalemaria commented 5 years ago

I have applied MainCurvature using options -m 0 and -n 2, e.g. as shown in the command line example: CurvatureMain -m 0 -n 2 -i lh.min_curv.vtk -x lh.max_curv.vtk -g lh.gaussian_curv.vtk -d lh.min_dir.vtk lh.pial.vtk lh.mean_curv.vtk But I got same values for minimal, maximal and Gaussian curvatures, which also have the opposite sign than the mean curvatures at the folds. The sign of the mean curvature values makes sense, since the normal vectors are pointing outwards the surface, the curvature should be negative at the outer folds and positive at the inner folds (sorry, I'm not a neuroscientist). Anyway, minimal and maximal curvatures should not be the same for the whole cortical surface (but only for spherical shapes), and Gaussian curvature is the product of the both, which is also not the case in the output.

kalemaria commented 5 years ago

Mean curvature (OK): lh pial mindboggle_n2_mean_curv The other curvatures have exactly the same values: Minimal curvature: lh pial mindboggle_n2_min_curv Maximal curvature: lh pial mindboggle_n2_max_curv Gaussian curvature: lh pial mindboggle_n2_gauss_curv

kalemaria commented 5 years ago

I have tried -n 0.7, which seems to be the default of the function and is finally recommended here, or was it meant just for the method -m 2?. Then most of the mean curvature values become exactly 0 and the other three, which are again the same for each point, -1. This is probably the source of the 0 peak mentioned in the issue #11. Mean curvature with 0 marked in green: lh pial mindboggle_n0 7_mean_green0 The other curvatures with -1 marked in blue: lh pial mindboggle_n0 7_min_max_gauss_curv_blue-1

It seems to me like when the method fails for some reason, maybe because the neighborhood is too low, it outputs 0 for mean curvature and -1 for the others. I have not tried to look at the C++ code (yet), I just report what I have seen from my attempt to apply the method.

binarybottle commented 5 years ago

@kalemaria -- Thank you very much for looking into the curvature measures! As you saw from issue #11 we chose -m 2 as the default after much deliberation, despite wanting to use Gaussian, max, and min curvatures as well as mean curvature for feature extraction. I'm afraid I won't be able to respond satisfactorily to your questions about these additional curvature measures generated with argument -m 0, because we didn't end up using it in the Mindboggle pipeline, so I don't have experience with them. I would love it if you were to take a closer look at the C++ code to find out if these non-default measures can be salvaged for general use! @joachimgiard -- Do you have any feedback for @kalemaria?

kalemaria commented 5 years ago

Dear @binarybottle, thanks for your quick reply! Yes, I read issue #11 just today, before that I assumed that method 0 is the default (from the PLOS Comp. Biol. paper and the documentation it seemed like it's the best). Ok, I will try tomorrow -m 2, unfortunately it does not calculate the principle curvatures, which I think are more useful, because one can derive all other curvature measured from them (mean, Gaussian, curvedness etc.). I have never looked at C++ code before, so I'm afraid I will not be able to understand there anything.

joachimgiard commented 5 years ago

Dear @kalemaria . I just read the code and there was indeed bug in the export function (curvatures should be correct, but Gaussian curvaure was exported in the 3 cases). I just committed a patch in master. I didn't try it since I don't have the correct environement to develop anymore. I'm not sure about the scales but it seems that the second series of graphs problem may be due to a too small neighborhood. Try again with a larger -n.

kalemaria commented 5 years ago

Thanks, @joachimgiard! Just two lines. :-) I could not test it either, because I'm using Docker and don't know how to compile it there. @binarybottle, could you please try to compile it and update the container? Many thanks for your friendly support again!

binarybottle commented 5 years ago

Thank you so much, @joachimgiard!
I just pushed an updated container to docker hub. Please docker pull nipy/mindboggle, @kalemaria.

joachimgiard commented 5 years ago

@kalemaria Could you test the new version?

kalemaria commented 5 years ago

@kalemaria Could you test the new version?

@joachimgiard and @binarybottle Yes, it worked, now there is a different output for each curvature. Thank you both for fixing it!

kalemaria commented 5 years ago

@kalemaria Could you test the new version?

@joachimgiard and @binarybottle Yes, it worked, now there is a different output for each curvature. Thank you both for fixing it!