juaml / junifer

Forschungszentrum Jülich Neuroimaging Feature Extractor
https://juaml.github.io/junifer
GNU Affero General Public License v3.0
14 stars 13 forks source link

[ENH]: Raise/warn if element is not ran #319

Open fraimondo opened 5 months ago

fraimondo commented 5 months ago

Are you requiring a new dataset or marker?

Which feature do you want to include?

I just did this:

  patterns:
    VBM_GM: 
        pattern: derivatives/fmriprep/sub-{subject}/anat/sub-{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
        space: MNI152NLin2009cAsym
  replacements: 
    - subject

and then tried to run junifer with --element sub-0001.

The issue (which take me a lot of time to solve) is that sub-0001 is not in the elements list, since the replacement is without the sub- prefix.

Now, there was no issue/warning from the run function. It cloned the dataset, did nothing and dropped the dataset.

How do you imagine this integrated in junifer?

We should implement a check in which if some of the elements in the list is not selected by the filter, there's a warning/error.

Exactly here is where we pass through the filter.

https://github.com/juaml/junifer/blob/a9e799caa3433d3d4eaa633d4565771b8eb297f6/junifer/api/functions.py#L170-L178

We should somehow keep a list of "unselected" elements so we can raise the warning.

Do you have a sample code that implements this outside of junifer?

No response

Anything else to say?

No response

synchon commented 5 months ago

@fraimondo Do you need it for v0.0.4 or can we move it to v0.0.5?

fraimondo commented 5 months ago

It's not that easy to implement, mainly because element can be a part of the full tuple, to iterate over a subject's sessions.

However, what we can do for v0.0.4 is to raise a warning if len(elements) > len(processed_elements). We compute processed_elements just by counting how many times we fit the mc inside that for loop (Line 171)

synchon commented 5 months ago

It's not that easy to implement, mainly because element can be a part of the full tuple, to iterate over a subject's sessions.

Yes that is a bit tricky.

However, what we can do for v0.0.4 is to raise a warning if len(elements) > len(processed_elements). We compute processed_elements just by counting how many times we fit the mc inside that for loop (Line 171)

Although the solution is good, I would like to have a comprehensive solution as it's not a critical feature issue, but more of a user notification.