Skip to content

BSEL-UC3M/Image-Segmentation-Evaluation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Image Segmentation Evaluation

Evaluating segmentation algorithms using SimpleITK filters (Python) and results of statistical analysis (R) in order to demonstrate the statistical significance of comparisons between used models.


Table of contents


Evaluation

The python library can be found here.

Preparing images for evaluation

In order to apply and evaluate segmentation models, images must be in a dictionary with the following structure:

dict[Rater][Image] = [list_of_segmentations]

Where

  • Rater is rater's ground truth name
  • Image is image's path
  • list_of_segmentations is the list of GT segmentations.

For example:

data_dir = "/home/"
dataset_folders = sorted(glob.glob(os.path.join(data_dir,"subset*")))

images = []

segmentations = {"Rater_Name":{}}


for folder in dataset_folders:
    images = images + sorted(glob.glob(folder + "/*.mhd"))

for image in images:
        name = os.path.split(image)[1]
        segmentation_file_names = glob.glob(os.path.join(data_dir,'seg-lungs/',name))
        segmentations["Rater_Name"][image] = [segmentation_file_names]

GetMeasures

Get Measures of applying Neural Network to an image and its evaluation by SimpleITK filters. These measures will be saved in a csv file. Here is an example of how to apply this method.

rois_labels = {1:"Right_Lung", 2:"Left_Lung", 3:"Both_Lungs"}
GT_label_values = [2,3]
saving_path = "/path/results"
    
measures = GetMeasures(subset_name, segmentations, rois_labels, saving_path, GT_label_values = GT_label_values,
                       debug_mode = False, flip_image = True, flip_GT = True, image_extension = ".mhd", GT_extension = ".mhd")

Images and GTs must be in axial plane, as it is shown in the following pictures. If you need to rotate them, turn on flip_image and / or flip_GT.

spacial location

spacial location2

ShowGT

This function shows all GTs that are in the dictionary segmentations and their labels.

ShowGT(segmentations,flip_GT)  

showGT


Statistical Analysis

About

Evaluating segmentation algorithms using SimpleITK filters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published