Skip to content

Commit 97dfc7a

Browse files
committed
Do not use hard-coded pixel spacing
1 parent a8036b0 commit 97dfc7a

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

multic/segmentationschool/Codes/wsi_loader_utils.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,13 @@
1717
from .xml_to_mask_minmax import write_minmax_to_xml
1818
import lxml.etree as ET
1919

20-
MPP = {'V42D20-364_XY01_2235505.svs':0.25,
21-
'V42D20-364_XY04_2240610.svs':0.25,
22-
'V42N07-339_XY04_F44.svs':0.25,
23-
'V42N07-395_XY01_235142.svs':0.25,
24-
'V42N07-395_XY04_235582.svs':0.25,
25-
'V42N07-399_XY01_3723.svs':0.25,
26-
'XY01_IU-21-015F.svs':0.50,
27-
'XY02_IU-21-016F.svs':0.50,
28-
'XY03_IU-21-019F.svs':0.50,
29-
'XY04_IU-21-020F.svs':0.50}
30-
3120

3221
def get_image_meta(i,args):
3322
image_annotation_info={}
3423
image_annotation_info['slide_loc']=i[0]
3524
slide=TiffSlide(image_annotation_info['slide_loc'])
36-
magx=MPP[image_annotation_info['slide_loc'].split('/')[-1]]#np.round(float(slide.properties['tiffslide.mpp-x']),2)
37-
magy=MPP[image_annotation_info['slide_loc'].split('/')[-1]]#np.round(float(slide.properties['tiffslide.mpp-y']),2)
25+
magx=np.round(float(slide.properties['tiffslide.mpp-x']),2)
26+
magy=np.round(float(slide.properties['tiffslide.mpp-y']),2)
3827

3928
assert magx == magy
4029
if magx ==0.25:
@@ -116,8 +105,8 @@ def get_slide_data(args, wsi_directory=None):
116105
slide =TiffSlide(slide_loc)
117106
chop_array=get_choppable_regions(slide,args,slideID,slideExt,mask_out_loc)
118107

119-
mag_x=MPP[slideID+slideExt]#np.round(float(slide.properties['tiffslide.mpp-x']),2)
120-
mag_y=MPP[slideID+slideExt]#np.round(float(slide.properties['tiffslide.mpp-y']),2)
108+
mag_x=np.round(float(slide.properties['tiffslide.mpp-x']),2)
109+
mag_y=np.round(float(slide.properties['tiffslide.mpp-y']),2)
121110
slide.close()
122111
tree = ET.parse(xmlpath)
123112
root = tree.getroot()

0 commit comments

Comments
 (0)