ProstateSeg_QC is a quality control algorithm to fix prostate zone and lesion segmentation masks. It finds and rectifies common errors that occur during manual segmentation.
This is an all-in-one algorithm to process the entire dataset. It is largely based on finding and analyzing connected components.
QC of zone segmentation masks:
- Finds and removes all small connected components from all the masks.
- Finds and patches all small holes in the masks.
- Finds snippets that are labeled as central zone but were very clearly just small errors when marking the peripheral zone mask onto the whole prostate mask. It converts those to peripheral zone.
- Checks if the whole mask equals the sum of the peripheral and central zone masks. If not, it replaces the whole mask. (optional)
QC of lesion segmentation masks:
- Finds and removes all small connected components from all the masks.
- Finds and patches all small holes in the masks.
Filtering small components
Patching holes
Fixing snippets
The program requires these modules to be installed:
- numpy
- pandas
- SimpleITK
- connected-components-3d
- tqdm
- regex
Comming soon:
pip install prostate_seg_qc
For now clone the repository, navigate to the folder where the clone resides and run: pip install -e .
from psqc import qc_zone, qc_lesion
# To do quality control on zone masks
qc_zone(combined_path='path/to/combined/mask/directory')
# To do quality control on lesion masks
qc_lesion(lesion_path='path/to/lesion/mask/directory')
By default the program saves only the masks that were changed, saving them into new directories that are created in the cwd. This can all be changed by passing appropriate arguments into the respective functions. It also creates .csv files that store the information on all the errors that were found.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
The method was developed at the CIMORe group at the Norwegian University of Science and Technology (NTNU) in Trondheim, Norway. https://www.ntnu.edu/isb/cimore