AICAN-Research / H2G-Net

🚀 H2G-Net: Segmentation of breast cancer region from whole slide images
MIT License
22 stars 5 forks source link

How can I segment my own slide and get the segmentation results? #5

Open Lewislou opened 2 hours ago

Lewislou commented 2 hours ago

Hi,

I have tried "runPipeline --datahub breast-tumour-segmentation --file my_slide.svs". But none results are saved. Could you please provide a full command or python codes to segment a testing WSI using your trained model?

andreped commented 2 hours ago

Hello, @Lewislou :]

Yes, the pipeline when using it through the runPipeline CLI is only to demonstrate running the pipeline. It does not export or save the result on disk. To do so, you would need to modify the actual pipeline, if you wanted to use the runPipeline CLI for inference.

If you use FastPathology and download the model from there, it is possible to see why that is the case. Below is a snapshot from FastPathology on my MacBook:

Screenshot 2024-11-05 at 10 53 48

What is evident from here is that this pipeline (FPL) is missing the actual exporters. FastPathology handles the export for you, so if it is of interest to you, you could use FastPathology to create the segmentations. Just remember to download the model and creating a project first. Then the results will be stored in the Project.

If you want to do this from code, it is possible to change the pipeline. I did this in another project: https://github.com/andreped/FP-DSA-plugin/blob/main/dsa/fastpathology/fastpathology/pipelines/breast_tumour_segmentation.fpl#L55).

This FPL could then be used with runPipeline, or you could just handle this from Python, which gives you more control: https://github.com/AICAN-Research/H2G-Net/blob/main/src/docker/applications/run_breast_cancer_segmentation.py

Not sure what is most optimal to you. Feel free to ask if you have further questions :]