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

Unified preprocessing for masking and parcellating #103

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

pbarbarant
Copy link
Collaborator

@pbarbarant pbarbarant commented Nov 6, 2024

Solves #89. Creates a common preprocessing backend to be used with PairwiseAlignment and TemplateAlignment. Automatically masks and parcellates any number of nifti images in the spirit of scikit-learn's StandardScaler. Suggestions for better class name are welcome!

Goals:

  • Compatibility with PairwiseAlignment
  • Compatibility with TemplateAlignment
  • Compatibility with fastsrm
  • Docstrings
  • Unit tests

Pierre-Louis Barbarant added 30 commits November 6, 2024 01:11
@pbarbarant pbarbarant marked this pull request as ready for review November 12, 2024 18:44
@bthirion
Copy link
Contributor

Is it ready for review ?

@pbarbarant
Copy link
Collaborator Author

Is it ready for review ?

Apart from some docstrings that need updating, I think it's ready for review.

Copy link
Contributor

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still wondering about the necessity of the class (to be discussed)/
Docstrings should be a bit richer.


Parameters
----------
data: np.ndarray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2D ? 3D ? meaning of the dimensions ?

from nilearn.masking import apply_mask_fmri, intersect_masks
from nilearn.regions.parcellations import Parcellations


class ParceledData:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering about the usefulness of this class:

  • it does not follow sklearn API: fit method etc.
  • it is mostly a container, without internal state: do we need a class ?
    How different is it from LabelsMasker ?

+ "Its intersection with the clustering was used instead."
)

def _one_parcellation(self, imgs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add 1-line docstrings for private methods, full dosctrings for public methods.

from fmralign.tests.utils import random_niimg


def test_init_default_params():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-line docstrings for tests is very helpful for test mainetnance...

_make_parcellation(img, clustering_method, n_pieces, masker)


def test_initialization():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-line docsrtings welcome too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants