Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.02 KB

File metadata and controls

30 lines (24 loc) · 1.02 KB

XML_to_Binarymask_withPython

This script helps to create binary mask files from XML based on the color of annotation. If you want to change the color of annotation, refer to another code in my repository for XML modification.

Provide the folder paths:

xml_path= '.../Test_xml_path/'
file_path = r".../Test_svsfiles/"
mask_output =r".../Mak_out"

dict_mask =get_points_base(w,"yellow",custom_colors=[]) # selected "yellow" color to extract mask of it

required python library:

import openslide
from WSI_handling import wsi
import os
import numpy as np
import matplotlib.pyplot as plt
import xml.etree.ElementTree as ET
import numpy as np

from pathlib import Path
from shapely.geometry import Polygon, MultiPolygon
from shapely.strtree import STRtree
import shapely.affinity
import rasterio.features
import cv2
from tqdm import *
from skimage.util import view_as_blocks
import gc