Skip to content

[BUG]: Cannot register parcellation with non-continuous values#257

Merged
synchon merged 9 commits intomainfrom
update/non-cont-parcel-support
Oct 7, 2025
Merged

[BUG]: Cannot register parcellation with non-continuous values#257
synchon merged 9 commits intomainfrom
update/non-cont-parcel-support

Conversation

@synchon
Copy link
Copy Markdown
Member

@synchon synchon commented Sep 24, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I want to register the Glasser parcellation: https://afni.nimh.nih.gov/pub/dist/atlases/MNI_HCP/MNI_Glasser_HCP_2021_v1.0a/

However, I get this error:

  File "/home/fraimondo/dev/tbox/junifer/junifer/data/parcellations.py", line 269, in load_parcellation
    raise_error(
  File "/home/fraimondo/dev/tbox/junifer/junifer/utils/logging.py", line 289, in raise_error
    raise klass(msg)
ValueError: Parcellation Glasser must have all the values in the range  [0, 361].

This is because so far, junifer expects that parcellation values are continuous. Some parcellations are not, like this one. The values are 1-180 for one hemisphere, and 1001-1180 for the other.

This was a restriction added when merging parcellations, as we have to "shift" the values to merge them, and this is done by adding the number of labels:

# Increase the values of each ROI to match the labels
t_parc_data[t_parc_data != 0] += len(labels)

Expected Behavior

Parcellations without continuous numbering should be able to be included in junifer (and merged)

Steps To Reproduce

  1. Get junifer latest
  2. Register the Glasser parcellation
  3. Try to compute any marker that uses a parcel (or even load_parcellation)

Environment

junifer:
  version: 0.0.3.dev101
python:
  version: 3.11.3
  implementation: CPython
dependencies:
  click: 8.1.3
  numpy: 1.23.5
  datalad: 0.18.2+59.gc5054cb91
  pandas: 1.5.3
  nibabel: 4.0.2
  nilearn: 0.10.0
  sqlalchemy: 1.4.48
  ruamel.yaml: 0.17.31
system:
  platform: Linux-6.1.0-12-amd64-x86_64-with-glibc2.36
environment:
  LC_CTYPE: en_US.UTF-8
  PATH: 
    /home/fraimondo/miniconda3/envs/junifer/bin:/home/fraimondo/miniconda3/condabin:/home/fraimondo/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/local/games:/usr/games

Relevant log output

No response

Anything else?

No response

@fraimondo fraimondo added bug Something isn't working triage New issues waiting to be reviewed and removed triage New issues waiting to be reviewed labels Oct 13, 2023
@fraimondo fraimondo added this to the 0.0.4 (alpha 3) milestone Oct 13, 2023
@fraimondo fraimondo added the CRITICAL High Priority Issue label Oct 13, 2023
@fraimondo fraimondo removed the CRITICAL High Priority Issue label Feb 7, 2024
@synchon synchon added the parcellation Issues or pull requests related to parcellations (deterministic atlases) label Sep 24, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 24, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-10-07 10:47 UTC

@synchon synchon force-pushed the update/non-cont-parcel-support branch from d0e1c83 to f2b8852 Compare October 6, 2025 15:18
@synchon
Copy link
Copy Markdown
Member

synchon commented Oct 6, 2025

CI passing on juseless.

@synchon synchon requested a review from fraimondo October 6, 2025 15:18
@synchon synchon merged commit acc3e31 into main Oct 7, 2025
4 of 12 checks passed
@synchon synchon deleted the update/non-cont-parcel-support branch October 7, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working parcellation Issues or pull requests related to parcellations (deterministic atlases)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants