Skip to content

Commit

Permalink
Merge branch 'main' into update-extension-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaferyildiz authored Dec 9, 2024
2 parents b017b19 + a8be54d commit bc3fb36
Show file tree
Hide file tree
Showing 29 changed files with 86 additions and 70 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ project(SegmentHumanBody)
set(EXTENSION_HOMEPAGE "https://github.com/mazurowski-lab/SlicerSegmentHumanBody#readme")
set(EXTENSION_CATEGORY "Segmentation")
set(EXTENSION_CONTRIBUTORS "Zafer Yildiz (Mazurowski Lab, Duke University)")
set(EXTENSION_DESCRIPTION "SegmentHumanBody aims to asist its users in segmenting MRI medical data on 3D Slicer by comprehensively integrating the SegmentHumanBody model developed by Mazurowski Lab.")
set(EXTENSION_DESCRIPTION "SegmentHumanBody aims to asist its users in segmenting MRI medical data on 3D Slicer by integrating varios deep learning models developed by Mazurowski Lab. SegmentHumanBody has CC BY-NC 4.0 license which does not allow commercial use.")
set(EXTENSION_ICONURL "https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/main/SegmentHumanBody/Resources/Icons/SegmentHumanBody.png")
set(EXTENSION_SCREENSHOTURLS
"https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/main/Screenshots/sws1.png"
"https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/main/Screenshots/sws2.png"
"https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/main/Screenshots/sws3.png"
"https://raw.githubusercontent.com/mazurowski-lab/SegmentAnyBone/main/segment-any-bone.png"
"https://raw.githubusercontent.com/mazurowski-lab/SegmentAnyBone/main/dataset.png"
)
set(EXTENSION_DEPENDS "PyTorch") # Specified as a list or "NA" if no dependencies

Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SlicerSegmentHumanBody
# SegmentHumanBody

[![arXiv Paper](https://img.shields.io/badge/arXiv-2401.12974-orange.svg?style=flat)](https://arxiv.org/abs/2401.12974)

Expand All @@ -8,8 +8,6 @@ SegmentHumanBody aims to asist its users in segmenting medical data on <a href="

The repository is licensed under the [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)

<img src="SegmentHumanBody/Resources/Icons/SegmentHumanBody.png" width=50% height=50%>

## Installation via GitHub Repository

You can clone this repository by running the following command:
Expand All @@ -22,29 +20,36 @@ After cloning the repository, you need to introduce the extension to 3D Slicer.

## Usage

If you've added the extension to 3D Slicer, you should be able to see it under **Modules > Segmentation > SegmentHumanBody**. You can see the user interface of the extension after you click on SegmentHumanBody in this menu.
### Preparation

Before starting the segmentation, make sure that you've created the necessary labels for your case by clicking "Configure labels in the segment editor" button. You need to turn back to our extension through Modules > Segmentation > SegmentHumanBody path again, after you create your labels in the segment editor. You are ready to segment now!
- Load an image to be segmented.
- Choose **Modules > Segmentation > SegmentHumanBody** module in the module selector. The first time the module is started, it will ask permission to install pytorch. Give permission and wait several minutes for the installation to complete. The application will not be responsive during the installation.
- Click "Configure labels in the segment editor" button to create a label for each structure that will be segmented. For example, "hip" and "femur".
- Go back to **SegmentHumanBody** module by clicking the green left arrow on the module toolbar. You are ready to segment now!

### Automatic Segmentation

<img src="Screenshots/sws1.png" width=45%> <img src="Screenshots/sws2.png" width=42%>

If you click "Run Automatic Segmentation" button, SegmentAnyBone will run in automated mode and will segment bones in each slice it can detect. You can assign different labels after you get your binary segmentation. There is 2 different modes for label assignment:

**2D Label Assignment:** This mode is used for changing the label of the connected component only in the current slice. You should first choose your target label and then click "Assign Label (2D)" button.

**3D Label Assignment:** This mode is used for changing the label of the connected component through consecutive slices in 3D space. You should first choose your target label and then click "Assign Label (3D)" button.
- Click "Run Automatic Segmentation" button and wait until the processing is completed (it may take some time based on number of slices). SegmentAnyBone will run in automated mode and will segment bones in each slice it can detect. This is going to be a binary segmentation (e.g. bone vs no-bone). To assign labels to different object of interests in slices, you can use label assignment feature:
- For each structure of interest: choose a label to assign (above the "Run automatic segmentation" button, for example: "hip") and click "Assign label (2D)" or "Assign label (3D)" button
- **2D Label Assignment:** Change label of the connected component *only in the current slice*. You should first place a prompt point on the object of interest whose label you want to change and click Assign Label (2D) button. Label of the object of interest will be changed only on that particular slice.
- **3D Label Assignment:** Change label of the connected component *through consecutive slices in 3D*. You should first place a prompt point on the object of interest whose label you want to change. Then, you should click Assign Label (3D) button. Label of the connected component through consecutive slices will be changed.

### Prompt Based Segmentation

<img src="Screenshots/sws3.png" width=45% height=45%>

Firstly, select the label you want to segment from the dropdown list (hip for the image below). Then, click "Start Segmentation for Current Slice" button.
- Select the label you want to segment from the dropdown list (for example "femur" as shown in the image above).
- Click "Start Segmentation for Current Slice" button.

If it is the first time to segment a slice of this file, you need to wait for SegmentHumanBody to produce some files that will be used for the segmentation. After SegmentHumanBody generated these files, you can start putting **prompt points** or **prompt boxes** on the current slice. You'll be able to see the segmentation mask on 3D Slicer. Please click "Stop Segmentation for Current Slice" whenever you finish your segmentation for the current slice.

If you are not satisfied with the segmentation mask produced by SegmentHumanBody, you can edit it as you wish using the "Segment Editor" module of 3D Slicer.

If it is the first to segment a slice of this file, you need to wait for SegmentAnyBone to produce some files that will be used for the segmentation. After SegmentAnyBone generated these files, you can start putting **prompt points** or **prompt boxes** on the current slice. You'll be able to see the segmentation mask on 3D Slicer. Please click "Stop Segmentation for Current Slice" whenever you finish your segmentation for the current slice.
## Future Work

If you are not satisfied with the segmentation mask produced by SegmentAnyBone, you can edit it as you wish using the "Segment Editor" module of 3D Slicer.
More segmentation models that aims to segment various type of tissues will be added in the future.

## Citation

Expand Down
2 changes: 1 addition & 1 deletion SegmentHumanBody/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(MODULE_PYTHON_RESOURCES
set(EXTENSION_HOMEPAGE "https://github.com/mazurowski-lab/SlicerSegmentHumanBody")
set(EXTENSION_CATEGORY "Segmentation")
set(EXTENSION_CONTRIBUTORS "Zafer Yildiz (Duke University - Mazurowski Lab)")
set(EXTENSION_DESCRIPTION "SegmentHumanBody aims to asist its users in segmenting medical data on 3D Slicer by comprehensively integrating the SegmentAnyBone developed by Mazurowski Lab.")
set(EXTENSION_DESCRIPTION "SegmentHumanBody aims to asist its users in segmenting medical data on 3D Slicer by comprehensively integrating the SegmentAnyBone developed by Mazurowski Lab. SegmentHumanBody has CC BY-NC 4.0 license which does not allow commercial use.")
set(EXTENSION_ICONURL "https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/SegmentHumanBody/Resources/Icons/SegmentHumanBody.png")
set(EXTENSION_SCREENSHOTURLS "https://raw.githubusercontent.com/mazurowski-lab/SlicerSegmentHumanBody/Screenshots/sws1.png")
set(EXTENSION_DEPENDS "PyTorch") # Specified as a list or "NA" if no dependencies
Expand Down
Binary file modified SegmentHumanBody/Resources/Icons/SegmentHumanBody.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions SegmentHumanBody/Resources/UI/SegmentHumanBody.ui
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
</property>
</widget>
</item>


</layout>

</item>
Expand Down
Loading

0 comments on commit bc3fb36

Please sign in to comment.