Skip to content

Conversation

unichronic
Copy link
Contributor

@unichronic unichronic commented Jul 9, 2025

This PR is part of GSoC 2025.

It adds the feature of a Segmentation tool to segment the various Subparts of the brain (for example: precuneus, superiorfrontal, hippocampus, etc.) using the Fastsurfer open-source CNN models and add support for PyTorch as well as Onnx models.

It also updates the data panel with categories for the subpart masks.

Tasks Done -

  • Added the Subpart segmentation Dialog.
  • Implemented all the pre-processing steps.
  • Converted the models to Onnx.
  • Added support for both Pytorch and Tinygrad (Onnx) inference.
  • Added processing to label map the segmented output.
  • Generated binary masks from the labelled output.
  • Added Category feature to Data Panel.
  • Added Hide/Unhide and Select All to category header in the Surfaces tab.
  • Added a "Create all surfaces" feature to create multiple surfaces from the selected masks at once.
  • Enhanced the look and controls of the Data Panel.

Pending -

  • Notes Tab (will raise separate PR)

@tfmoraes
Copy link
Member

Hi @unichronic. Some comments:

@unichronic
Copy link
Contributor Author

Yeah sure I will add Tinygrad support.
I will move the fastsurfer directory and keep the other points in mind.

Copy link
Collaborator

@rmatsuda rmatsuda left a comment

Choose a reason for hiding this comment

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

Really nice! Thanks again @unichronic! I have just a few comments

@rmatsuda
Copy link
Collaborator

Also, could you please run Ruff to fix the pre-commit issues? https://github.com/invesalius/invesalius3/actions/runs/17199530210/job/48787491498?pr=1005

You can find setup instructions here: https://github.com/invesalius/invesalius3/wiki/Setting-Up-pre%E2%80%90commit

@unichronic unichronic force-pushed the subpart branch 4 times, most recently from 2d1f899 to 940875d Compare August 25, 2025 20:19
@unichronic
Copy link
Contributor Author

Also, could you please run Ruff to fix the pre-commit issues? https://github.com/invesalius/invesalius3/actions/runs/17199530210/job/48787491498?pr=1005

I have pre-commit setup with my git, but turns out I was using an older Ruff version.
but even after updating to match the current version in Invesalius, the pre-commit check was still raising errors, although it did pass in my CLI. So I went ahead and just fixed it manually.

@rmatsuda
Copy link
Collaborator

Thanks @unichronic! Could you please add the extra dependencies (like torchvision and yacs) to both the requirements.txt and environment.yml files?

@unichronic
Copy link
Contributor Author

Thanks @unichronic! Could you please add the extra dependencies (like torchvision and yacs) to both the requirements.txt and environment.yml files?

Sure!

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