Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[META] Next steps for development on experimental surface module #4027

Open
10 of 42 tasks
ymzayek opened this issue Oct 4, 2023 · 20 comments
Open
10 of 42 tasks

[META] Next steps for development on experimental surface module #4027

ymzayek opened this issue Oct 4, 2023 · 20 comments
Labels
API This issue is related to the Nilearn's API. Enhancement for feature requests Surface Related to surface data or surface analysis.

Comments

@ymzayek
Copy link
Member

ymzayek commented Oct 4, 2023

General

  • split experimental package into: maskers, plotting, datasets to make them easier to later integrate into the rest of the code base

Plotting

Maskers

  • Implement extraction of signals from ROI and transforming region signals back to surface object
  • Add report for surface masker
  • From (SurfaceImage and maskers #3856 (comment)):
    • improve a bit the masker for the very frequent use case where we don't want to mask anything by avoiding to store the mask img
    • Implement a SurfaceVectorizer that just checks shapes and concatenates data but doesn't have a mask_img and doesn't mask

Decoder

GLM

Plotting

Documentation

Misc

Examples to adapt

Move experimental into stable

  • Double check public class/method and function names
  • Double check/improve docstrings (still need review of course)
  • How to handle I/O and provide some public functions to replace surface.py loaders
    • At the moment just copied over wrappers from experimental.surface._io to surface._io
  • Remove type hints
  • Update doc/modules/surface.rst and remove experimental.rst
  • Update experimental surface example
    • Integrate parts into stable examples (to do in follow-up PRs)
  • Increase testing
  • What to deprecate from old surface.py API?

PRs and issues made obsolete

List previous attempts of surface development that will ultimately be closed by this development.

Older issues for context

@ymzayek ymzayek added Enhancement for feature requests API This issue is related to the Nilearn's API. Surface Related to surface data or surface analysis. labels Oct 4, 2023
@Remi-Gau
Copy link
Collaborator

Copying some of the notes from our hackathon regarding writing surface data:

Writing surface images

  • Separate meshes and textures into different gifti files
  • Question about naming: should try and make reasonable defaults for that, yet leave the users the possibility to change names
    • Suggestion to go with with something BIDS like where the hemisphere:
    • [hemi-{L|R}][_space-][_den-]_suffix.surf.gii
      • Wonder how much of those we can infer without having to keep track of the name of the input file…
      • Suffix is going to be almost impossible to have a sensible default for
      • Hemi specifies the hemisphere of a given file
      • Space for example “fsaverage”
      • Den for density, for example:
        • Den-10k for "10242 vertices per hemisphere (5th order icosahedron)"

@ymzayek
Copy link
Member Author

ymzayek commented Jan 12, 2024

@Remi-Gau we need to note that #4120 needs to be reverted if we release without the surface API.

In addition I'm thinking whether it would be better to develop the integration on a feature branch?

@Remi-Gau
Copy link
Collaborator

@Remi-Gau we need to note that #4120 needs to be reverted if we release without the surface API.

Good point

In addition I'm thinking whether it would be better to develop the integration on a feature branch?

We could try that indeed: to avoid those reversions, it would make sense.
Just need to make sure that we back merge main into it often to avoid diverging (though I suspect that if we work mostly on experimental stuff then we should be fine)

@bthirion
Copy link
Member

What's preventing from releasing with the Surface API ? The plotting functions ?

@ymzayek
Copy link
Member Author

ymzayek commented Jan 12, 2024

I wanted to point that out in case we decide not to for whatever reason.

I'm happy to work on the plotting next week if @jeromedockes or @alexisthual point me to any notes or list them here that you made when discussing this if you do not have time to work on it.

@jeromedockes
Copy link
Member

@Remi-Gau we need to note that #4120 needs to be reverted if we release without the surface API.

maybe we could avoid reverting it. to avoid importing the experimental module we can add some attribute for duck typing or even just check the class name instead of the isinstance checks in the check_embedded_nifti_masker and decoding functions. Once the module is no longer experimental we can change it back

@Remi-Gau
Copy link
Collaborator

As far as I can tell the SurfaceMasker does not include a generate_report method like the other maskers.

@ymzayek
Copy link
Member Author

ymzayek commented Jan 24, 2024

As far as I can tell the SurfaceMasker does not include a generate_report method like the other maskers.

I define it and raise NotImplemetedError in #4126

@ymzayek
Copy link
Member Author

ymzayek commented Jan 24, 2024

Oh meant that's for GLM but I think you can do the same for the masker for now

@jeromedockes
Copy link
Member

jeromedockes commented Jan 24, 2024 via email

@ymzayek
Copy link
Member Author

ymzayek commented Jan 24, 2024

@jeromedockes to raise a message with the error that it is not yet implemented and imply that it will be. But feel free to do otherwise

@Remi-Gau
Copy link
Collaborator

Why is that better than not defining it?

I would say mostly as signal to users (and future us) that this is coming.

@Remi-Gau
Copy link
Collaborator

met with @bthirion and @jeromedockes at the open office hours

Decisions:

  • need to better develop the experimental aspects of the Surface features before we move it into the stable API
    • integrate plotting first
    • integrate surface GLM
    • integrate decoding
  • so the next release will be a minor release instead of a major one

@bthirion
Copy link
Member

... and for the time being, we represent meshes through dictionaries.

@Remi-Gau
Copy link
Collaborator

@bthirion @htwangtw @emdupre @alexisthual @ymzayek

Opinions needed

@jeromedockes and I chatted a bit more regarding the next steps.

Currently on main, the experimental module is imported in the following "non-experiemntal" places.

$ find nilearn -name '*.py' -exec grep -H "nilearn.experimental" {} \;

nilearn/decoding/space_net.py:from nilearn.experimental.surface import SurfaceMasker
nilearn/decoding/decoder.py:from nilearn.experimental.surface import SurfaceMasker
nilearn/decoding/tests/test_decoder.py:from nilearn.experimental.surface import SurfaceMasker
nilearn/_utils/masker_validation.py:from nilearn.experimental.surface import SurfaceMasker
nilearn/_utils/tests/test_masker_validation.py:from nilearn.experimental.surface import SurfaceMasker

This leads to the warning from experimental module to be thrown when users use non-experimental part of the codebase.

We feel that rather reverting #4120 (see #4027 (comment)) it would be OK to get rid of the experimental warning, assuming that users wanting to use the experimental features would literal have to type "experimental".

This could be replaced with a additional warning in the doc: https://nilearn.github.io/dev/modules/experimental.html and in the coming release notes.

How do others feel about this?

@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Jan 24, 2024

TODO:

A similar approach (copy to experimental + mention new experimental example in old version) should be be used for other examples where the new surface API can be applied.

  • update top message of this issue with a list of examples to be modified with the new surface API

@jeromedockes
Copy link
Member

would literal have to type "experimental".

indeed that is more likely to catch their attention than any warning

@jeromedockes
Copy link
Member

... and for the time being, we represent meshes through dictionaries.

or rather collections of meshes containing one or more hemispheres. each individual mesh is still represented by a Mesh instance

@jeromedockes
Copy link
Member

I would say mostly as signal to users (and future us) that this is coming.

ok my 2 cents is stating it exists by defining it and then surprise it doesn't when we call it is not super helpful, and not defining it at all is less work but it's not important either way

@Remi-Gau
Copy link
Collaborator

Adding a section in the top messages to mention issues or PR that will be made obsolete or superseded by the ones created here

@nilearn nilearn deleted a comment from ymzayek Jun 3, 2024
@Remi-Gau Remi-Gau changed the title [ENH] Next steps for development on experimental surface module [META] Next steps for development on experimental surface module Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This issue is related to the Nilearn's API. Enhancement for feature requests Surface Related to surface data or surface analysis.
Projects
None yet
Development

No branches or pull requests

4 participants