This is the official repository for 3D Slicer Plugin for MedSAM: Segment Anything in Medical Images.
output.mp4
You can watch a video tutorial of installation steps here.
- Install 3D Slicer from its official website. The compatibility of our plugin has been tested with 3D Slicer >= 5.4.0
- Download the specific version of the plugin from releases page and extract to your desired location.
- In the Slicer App, press Ctrl+4 to open Extension Manager.
- In
Install Extensiontab lookupPyTorchand install the extension. Our plugin currently relies on this. Restart 3D Slicer afterward. - Select the
Welcome to Slicerdrop-down menu in the toolbar at the top and navigate toDeveloper Tools > Extension Wizard. - Click on
select Extensionand locate theMedSAMfolder among the extracted files and directories at step 2. Accept if asked to add the new modules. - Now, from the
Welcome to Slicerdrop-down menu, under theSegmentationsub-menu,MedSAMLiteoption is added. By choosing it, you get to the final steps. Choose a folderto install module dependencies and click onInstall dependencies. It can take several minutes.- Restart 3D Slicer.
Remove all pre-existing files from step#2 and install the new version as instructed before.
You can watch a video guide for usage here.
- From the
Welcome to Slicerdrop-down menu, under theSegmentationsub-menu,MedSAMLiteoption is added. By choosing it, you get to the final steps. - Load your image file.
- From
Prepare Dataaccordion menu you can choose from preset preprocessing methods (optional, but extremely helpful) - From
Select the Region of Interestaccordion menu, you can click onAttach ROIto select the region for segmentation. It is possible to useSet Current Frame As Selection's StartandSet Current Frame As Selection's Endto set ROI boundaries on the L-R slice. - In
Start Segmentationaccordion menu, you have two different ways to infer the segmentation:- If you want to segment multiple regions or a single large one, it is advised to preprocess the whole image first. To do so:
- click on
Send Imagebutton. It will prepare the whole 3D image for the module to process. It will take several minutes. You will need to do this step only once for each image. As long as the image is not changed (new preprocessing / cropping / etc.) you do not have to redo this step. - Click on
Segmentationbutton to get the segmentation results. You can replace your ROI or delete and re-attach it (step 4) as many times as you need and repeat step 5.b without going over step 5.a again.
- click on
- If you need to segment a single smaller region, you can bypass preprocessing and only click on
Single Segmentation. After confirming, the segmentation would be inferred.
- If you want to segment multiple regions or a single large one, it is advised to preprocess the whole image first. To do so:
- In the same section, from the
SegmentationandSource volumedrop-down menus you can choose the right segmentation group and manually refine the segmentation results. You can also assign different color to each segmentation mask.