Deep-MI / LaPy

Toolbox for Differential Geometry on Triangle and Tetrahedra Meshes (FEM, Laplace, Poisson, Heat Flow ...)
MIT License
61 stars 14 forks source link

Is there any tutorials? #15

Closed littlehegemon closed 1 year ago

littlehegemon commented 1 year ago

Only the examples? Is there any tutorials for beginners?

m-reuter commented 1 year ago

Sadly we do not (yet) have a tutorial. Can you describe more clearly what you want to do? You can compute eigenvalues and eigenvectors from a shape. You can represent the coordinates of the shape as a linear combination of the eigenvectors and filter the shape (or any function on the shape). What you cannot do is:

littlehegemon commented 1 year ago

Also can you describe more clearly what you want to do? You can compute eigenvalues and eigenvectors from a shape. You can represent the coordinates of the shape as a linear combination of the eigenvectors and filter the shape (or any function on the shape). What you cannot do is:

  • calculate 2D shapes from a set of eigenvectors
  • use eigenvectors and eigenvalues alone to reconstruct the shape

Thanks. I understand.

I have surface annotation files. It contains individualized parcellations different for each individual. I want to extract the shape DNA for the each of the parcellations and may be parcellation of the brain as a whole and run a GWAS to find associated genetic locus (real DNA now!). Although brain is 3D, I want to try 2D first. so I need to convert the annotation to vtk format I guess?

littlehegemon commented 1 year ago

@kdiers How do you think?

kdiers commented 1 year ago

Hi @littlehegemon, and sorry, at the moment we can only provide the jupyter notebooks as examples and do not have specific tutorials yet.

In general, we would suggest to start the analysis with structures that are distinct anatomical entities - such as the subcortical structures as returned by the 'aseg' segmentation or maybe the whole GM or WM surface. These represent 'natural' shapes, whereas the shape of individual cortical parcellations will to a large extent also be driven by the boundaries imposed by the atlas that was used for the analysis. This may introduce additional, and possibly unwanted, variability, and we have less experience with these analyses.

Exporting data to VTK format and importing using lapy's TriaIO library is one feasible option, but not the . It is possible to use other formats (see functions in the TriaIO module), and it is also possible to directly construct tria meshes (see Test_TriaMesh.ipynb or TriaMesh.py).

littlehegemon commented 1 year ago

kdiers, Thank you!

m-reuter commented 1 year ago

Hi @littlehegemon , I will close this now, as it is really not a lapy issue. You need to cut your surface into patches based on your annotations and store those smaller surfaces in a format that lapy can read. Lapy can then compute the Laplace spectra as demonstrated in our examples. You would need to decide what boundary condition to use (Neumann or Dirichlet), as that will affect the eigenvalues a lot. For full hemisphere (without boundary) you don't need to make this decision.

Assuming you speak about FreeSurfer cortical annotations:

For cutting a label from a surface, see FreeSurfer command as we called them in our legacy brain print code: https://github.com/Deep-MI/BrainPrint-legacy/blob/6c7e6cbd04c2ece32aa71bad2b9fc076af84c553/fs_shapeDNA.py#L419

For aparc parcellations convert it to a label first: https://github.com/Deep-MI/BrainPrint-legacy/blob/6c7e6cbd04c2ece32aa71bad2b9fc076af84c553/fs_shapeDNA.py#L493 you can then also merge labels and convert those to surfaces with mris_convert