Skip to content

Commit

Permalink
Make some of the tests more consistent (#1094)
Browse files Browse the repository at this point in the history
manthey authored and cooperlab committed Apr 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent c2fc7c7 commit 914a202
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_cli_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections
import json
import os
import tempfile
from argparse import Namespace

import large_image
@@ -65,8 +66,8 @@ def test_segment_wsi_foreground_at_low_res(self):
if GENERATE_GROUNDTRUTH:
import PIL.Image

PIL.Image.fromarray(im_fgnd_mask_lres).save(
'/tmp/TCGA-06-0129-01Z-00-DX3_fgnd_mask_lres.png')
PIL.Image.fromarray(im_fgnd_mask_lres).save(os.path.join(
tempfile.gettempdir(), 'TCGA-06-0129-01Z-00-DX3_fgnd_mask_lres.png'))

for gtruth in {
'TCGA-06-0129-01Z-00-DX3_fgnd_mask_lres.png',
@@ -210,10 +211,12 @@ def test_create_tile_nuclei_annotations(self):
nuclei_bndry_annot_list.extend(cur_bndry_annot_list)

if GENERATE_GROUNDTRUTH:
open('/tmp/TCGA-06-0129-01Z-00-DX3_roi_nuclei_bbox.anot', 'w').write(
json.dumps({'elements': nuclei_bbox_annot_list}))
open('/tmp/TCGA-06-0129-01Z-00-DX3_roi_nuclei_boundary.anot', 'w').write(
json.dumps({'elements': nuclei_bndry_annot_list}))
open(os.path.join(
tempfile.gettempdir(), 'TCGA-06-0129-01Z-00-DX3_roi_nuclei_bbox.anot'),
'w').write(json.dumps({'elements': nuclei_bbox_annot_list}))
open(os.path.join(
tempfile.gettempdir(), 'TCGA-06-0129-01Z-00-DX3_roi_nuclei_boundary.anot'),
'w').write(json.dumps({'elements': nuclei_bndry_annot_list}))

# compare nuclei bbox annotations with gtruth
nuclei_bbox_annot_gtruth_file = os.path.join(datastore.fetch(

0 comments on commit 914a202

Please sign in to comment.