Skip to content

Commit

Permalink
Add labels to visible layers
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Jun 19, 2024
1 parent 61f9627 commit be32576
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions experiments/misc/normalization/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@


# for HLRN
ROOT = "/scratch/projects/nim00007/sam/data"
SAVE_DIR = "/scratch/share/cidas/cca/test/verify_normalization"
# ROOT = "/scratch/projects/nim00007/sam/data"
# SAVE_DIR = "/scratch/share/cidas/cca/test/verify_normalization"

# for local
# ROOT = "/media/anwai/ANWAI/data/"
# SAVE_DIR = "/media/anwai/ANWAI/predictions/verify_normalization"
ROOT = "/media/anwai/ANWAI/data/"
SAVE_DIR = "/media/anwai/ANWAI/predictions/verify_normalization"


def get_model(dataset, task, norm):
Expand Down
7 changes: 4 additions & 3 deletions experiments/misc/normalization/run_unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def run_evaluation(norm, dataset, task, save_root):


def run_analysis_per_dataset(dataset, task, save_root):
k = 10 # determines the number of images to visualize
k = 50 # determines the number of images to visualize

image_paths, gt_paths = get_test_images(dataset=dataset)

Expand Down Expand Up @@ -236,7 +236,7 @@ def run_analysis_per_dataset(dataset, task, save_root):
import napari
v = napari.Viewer()
v.add_image(islice)
v.add_image(gslice, visible=False)
v.add_image(gslice, name="GT", visible=False)
v.add_image(p1slice, name="OldDefault", visible=False)
v.add_image(p2slice, name="InstanceNorm", visible=False)
napari.run()
Expand All @@ -246,6 +246,7 @@ def run_analysis_per_dataset(dataset, task, save_root):
dice_2d_samples.append(dice_score(gt > 0, fg_exp1 > 0.5))
image_ids.append(image_id)

# NOTE: visualizing each 2d image
# import napari
# v = napari.Viewer()
# v.add_image(image)
Expand Down Expand Up @@ -283,7 +284,7 @@ def run_analysis_per_dataset(dataset, task, save_root):
import napari
v = napari.Viewer()
v.add_image(_load_image(image_path))
v.add_image(_load_image(gt_path), visible=False)
v.add_labels(_load_image(gt_path), name="GT")
v.add_image(fg_exp1, name="OldDefault", visible=False)
v.add_image(fg_exp2, name="InstanceNorm", visible=False)
napari.run()
Expand Down

0 comments on commit be32576

Please sign in to comment.