Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 999 Bytes

File metadata and controls

23 lines (17 loc) · 999 Bytes

XML_Annotation_modify_with_Python

XML annotation format commonly used in Imagescope and modyfying the color of annotation for every image could be cumbersome. This script helps to change the color of annotation and could be useful to adapt for other task.

Provide the folder paths:

xml_path= r'xml_folder'
mask_output =r"xml_newoutput"

Provide the label you want to change color for; e.g 'NSG_area2s':
if re.findall(r'Name="NSG_area2s".*LineColor="(\d+)"', line):

Provide the new color for label NSG_area2s; '255' is for red here:

line=re.sub(r'LineColor="(\d+)"',r'LineColor="255"', line)

List of color to choose:
255 and 8388863 for red
0 for black
65535 for yellow
65280 for green
4227327 for Brown

The XML annotation format exmaple is as follows, where 'LineColor' is annotation color. XML