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.
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):
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.