Skip to content

Conversation

@vinaysraghavan
Copy link
Collaborator

Reference Issues/PRs

See #214

What does this implement/fix? Explain your changes.

Fixes the distinction between coordinate spaces and brain atlases in the Brain object. Added the ability to specify atlas parcellation, including loading custom parcellations stored as .annot files.

Any other comments?

Should not break any prior functionality or use with loading MNI152 vs FreeSurfer and using the custom DK .annot file for the MNI152 data

Created structure for loading different labels based on coordinate space and atlas.

Still need to construct num2region dictionaries from relevant data
While retaining custom labels for specific scenarios
Making the existing brain functions play nice with the new refactor
@vinaysraghavan vinaysraghavan self-assigned this Apr 8, 2025
Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple little comments

surf_type: str = "pial",
subject: str = "fsaverage",
coordinate_space: str = 'FSAverage',
atlas: str = '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change this to default to None rather than empty string?

Comment on lines 86 to 87
self.coordinate_space = coordinate_space
self.atlas = atlas
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there input validation we can do on atlas?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to check that atlas is either "Destrieux" or "Desikan-Killiany" or SUBJECT_DIR/SUBJECT/label/{hemi}.{atlas}.annot exists

Subject to use, must be a directory within ``subject_dir``
coordinate_space : str, default='FSAverage'
Coordinate space of brain vertices. Must be 'FSAverage' or 'MNI152'
atlas : str, default=''
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you also make this one default to None?

@vinaysraghavan
Copy link
Collaborator Author

Still getting a little bit of unexpected behavior with annotate_coords and paint_overlay. Want to make sure everything is working cleanly first

@vinaysraghavan vinaysraghavan changed the title Create atlas and coordinate_space #241 Create atlas and coordinate_space Apr 9, 2025
@vinaysraghavan
Copy link
Collaborator Author

@gavinmischler

It seems like the Hemisphere properties self.has_overlay and self.has_overlay_cells are never used. Setting self.has_overlay_cells in paint_overlay() requires calling self.zones(), which is considerably more computationally intensive than simply setting self.overlay[self.labels==self.label2num[label]] = value.

Is there any reason to keep self.has_overlay and self.has_overlay_cells?

@gavinmischler
Copy link
Collaborator

gavinmischler commented Apr 9, 2025

It seems like the Hemisphere properties self.has_overlay and self.has_overlay_cells are never used. Setting self.has_overlay_cells in paint_overlay() requires calling self.zones(), which is considerably more computationally intensive than simply setting self.overlay[self.labels==self.label2num[label]] = value.

Is there any reason to keep self.has_overlay and self.has_overlay_cells?

Hmm I guess maybe not. I can't remember why we have those now to be honest.

Merge overlay values within each atlas parcel into a single value. Meant to be used after interpolate_electrodes_onto_brain()
Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

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

Just a little docstring thing but looks great!

Parameters
----------
merge_func : callable, optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to say "callable, default=numpy.mean", because optional means that you can pass None and it will be fine, which is not the case

@vinaysraghavan vinaysraghavan merged commit 803e4e5 into main Apr 10, 2025
4 checks passed
@vinaysraghavan vinaysraghavan deleted the coordinates_and_atlases_for_brainplots branch April 10, 2025 21:00
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.

3 participants