Skip to content

Segmentation features needed for intracranial mask computation#46

Open
cdaversin wants to merge 28 commits intomainfrom
cecile/segmentation_refinement
Open

Segmentation features needed for intracranial mask computation#46
cdaversin wants to merge 28 commits intomainfrom
cecile/segmentation_refinement

Conversation

@cdaversin
Copy link
Copy Markdown
Collaborator

  • CSF segmentation (needed to compute intracranial mask), requires refined segmentation
  • Segmentation refinement = resampling to reference image + (possibly) smoothing

These functions and the corresponding tests have been added.
The test for segmentation refinement is skipped because it takes quite some time, but I have tested it locally and it reproduces the data from the Gonzo dataset.

…, to be used in intracranial mask computation
@cdaversin cdaversin requested a review from finsberg April 23, 2026 12:05
Comment thread src/mritk/masks.py Outdated
Comment thread src/mritk/masks.py Outdated
Comment thread src/mritk/masks.py Outdated
Comment thread tests/test_segmentation.py Outdated
Comment thread src/mritk/segmentation.py Outdated
cdaversin and others added 4 commits April 24, 2026 15:32
…Data anymore and have its own from_file function, for the sake of consistency. csf_segmentation is moved to a dedicated CSFSegmentation class
@cdaversin
Copy link
Copy Markdown
Collaborator Author

cdaversin commented Apr 24, 2026

@finsberg Thanks for all the suggestions. They have been taken into account in the last commits. I have tried to use a smaller portion of the dataset as you did in test_looklocker, but the corresponding test is failing (marked as failing for now), I need to investigate this further.

Copy link
Copy Markdown
Member

@finsberg finsberg left a comment

Choose a reason for hiding this comment

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

Looks very good. I still have a few more comments

Comment thread src/mritk/segmentation.py Outdated
Comment on lines +96 to +99
mri: MRIData
rois: np.ndarray
lut: pd.DataFrame
label_name: str
Copy link
Copy Markdown
Member

@finsberg finsberg Apr 25, 2026

Choose a reason for hiding this comment

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

I don't understand why we need these lines? We could make Segmentation into a dataclass (in which case we can keep this and possible add a __post_init__ method). Otherwise I think we can remove this.

Comment thread src/mritk/segmentation.py Outdated

# @dataclass
class CSFSegmentation:
segmentation: MRIData
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it is a bit confusing that a segmentation is a MRIData and not a Segmentation.

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