Hello!
I have a small problem with QuPath and I do knot now where is the problem!
I am trying to import a custom GeoJson file in QuPath but seems that I miss some information. I used Hovernet algorithm to obtain the results of segmentation and cell classification of an image. The output information are in the json format, thus I need to convert them in Geojson and I followed this link Exporting and re-importing annotations from QuPath for usage in machine learning - Andrew Janowczyk.
I used also the code in the link for importing again my annotations. Now my code in python for the creation of the GeoJson is:
GEOdata=[]
for i in range(0,len(DATA)):
dict_data={}
cc=DATA[i][1]['contour']
cc.append(cc[0])
dict_data["type"]="Feature"
dict_data["id"]="PathCellObject"
dict_data["geometry"]={"type":"Polygon",
"coordinates":[cc]}
dict_data["properties"]={"isLocked":"false",
"measurements":[],
"classification": {"name": str(clas.name[i]), #-> the name is from another file
}}
GEOdata.append(dict_data)
#save of the GEOjson file
newQuPathFile="new_"+sample+".json"
with open(newQuPathFile, 'w') as outfile:
geojson.dump(GEOdata,outfile)
When import the final file, everything seems to work but I noticed that the information are just in the Hierarchy and not in the Annotations. It seems like the information about “Polygon” is missed, in fact I have just “cell(Tumor)” in the Hierarchy info and not “Cell(Polygon)(Tumor)”.
Could someone help me?
Thank you in advance!