Annotation File Generator

assessment.annotation module


Title: ValidPath Toolbox - Annotation File Generation Module

Description: This is the Annotation File Generator module for the ValidPath toolbox. It is includes Annotation_Generator class and several methods

Classes: Annotation_Generator

Methods: There are three methods in the Annotation File Generation module as follows:

  • ROI_Generator.generate_map_file(input_DIR: str, output_DIR: str, file_Name: str)

  • ROI_Generator.create_xml(input_DIR,file_Name,path_size,ROI_output_DIR,tag_name)

  • make_region(self, x , y , id , txt,path_size,Regions)


class assessment.annotation.Annotation_Generator[source]

Bases: object

create_xml(input_DIR, file_path, path_size, save_xml_path)[source]

This method reads the map file generated uisng the ROI_Generator.generate_map_file and generated the XML annotation file based on Aperio ImageScope standard.

Parameters:
input_DIRstring

the path to the input directory of mapping file

file_pathstring

map file name (csv)

path_sizeinteger

Size of image patch

save_xml_path: string

output directory

Returns:

XML – the XML files

generate_map_file(input_DIR, output_DIR, file_Name, tag_name)[source]

This method extracts different types for annotations from Whole Slide Images. It can save the extracted annottions to the output directory as defined in inputs. This code also handles several annotations per slide. The output directory will be generated based on the strucutr of the input directories.

Parameters:
input_DIRstring

the path to the input directory of image patches

output_DIRstr

the path to the output directory to save the map file

file_Namestring

map file name (csv)

tag_namestring

Tag name

Returns:

CSV – the map file

make_region(x, y, id, txt, path_size, Regions)[source]

This method generate the XMl file structure and fill the content based on the Aperio ImageScope standard

Parameters:
xinteger

Output Directory to save the extracted annotations

xinteger

List of included WSIs

txtstring

List of XML files associated with included WSIs

path_sizeinteger

Patch size

Regionsobject

the corresponsing XML region object

Returns:

XML strycture