Skip to content

Commit 8763e49

Browse files
committed
make usage of surface dice more general
1 parent 0c30cf0 commit 8763e49

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

run_sbatch_revision.sbatch

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#! /bin/bash
22
#SBATCH -c 4 #4 #8
3-
#SBATCH --mem 256G #120G #32G #64G #256G
3+
#SBATCH --mem 120G #120G #32G #64G #256G
44
#SBATCH -p grete:shared #grete:shared #grete-h100:shared
55
#SBATCH -t 3:00:00 #6:00:00 #48:00:00
66
#SBATCH -G A100:1 #V100:1 #2 #A100:1 #gtx1080:2 #v100:1 #H100:1
77
#SBATCH --output=/user/muth9/u12095/synapse-net/slurm_revision/slurm-%j.out
8-
#SBATCH -A nim00007
9-
#SBATCH --constraint 80gb
8+
#SBATCH -A nim00007 #SBATCH --constraint 80gb
109

1110
source ~/.bashrc
1211
conda activate synapse-net
13-
python /user/muth9/u12095/synapse-net/scripts/cooper/vesicle_segmentation_h5.py \
12+
python /user/muth9/u12095/synapse-net/scripts/cooper/revision/thin_az_gt.py \
1413
-i /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_for_eval/ \
1514
-o /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_for_eval/

scripts/cooper/revision/surface_dice.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import sys
22
import os
33

4-
# Add membrain-seg to Python path
4+
# Add membrain-seg to Python path
5+
#Delete before last commit
56
MEMBRAIN_SEG_PATH = "/user/muth9/u12095/membrain-seg/src"
67
if MEMBRAIN_SEG_PATH not in sys.path:
78
sys.path.insert(0, MEMBRAIN_SEG_PATH)
@@ -12,10 +13,14 @@
1213
from tqdm import tqdm
1314
import numpy as np
1415
from scipy.ndimage import label
15-
from skimage.measure import regionprops
16+
from skima
1617

17-
from membrain_seg.segmentation.skeletonize import skeletonization
18-
from membrain_seg.benchmark.metrics import masked_surface_dice
18+
try:
19+
from membrain_seg.segmentation.skeletonize import skeletonization
20+
from membrain_seg.benchmark.metrics import masked_surface_dice
21+
except ImportError:
22+
skeletonization=None
23+
masked_surface_dice=None
1924

2025

2126
def load_segmentation(file_path, key):
@@ -25,6 +30,10 @@ def load_segmentation(file_path, key):
2530

2631

2732
def evaluate_surface_dice(pred, gt, raw, check):
33+
if skeletonization is None:
34+
print("Error! Install membrain_seg. For more information check out https://teamtomo.org/membrain-seg/installation/ ")
35+
raise RuntimeError
36+
2837
gt_skeleton = skeletonization(gt == 1, batch_size=100000)
2938
pred_skeleton = skeletonization(pred, batch_size=100000)
3039
mask = gt != 2

scripts/cooper/revision/thin_az_gt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def run_az_thinning(folder=ROOT, out_path=OUTPUT_ROOT):
3434
az = f_in["labels/az"][:]
3535

3636
az_thin = thin_az(
37-
az, boundary_map=boundary_pred, vesicles=vesicles, tomo=tomo, presyn_dist=8, check=True,
37+
az, boundary_map=boundary_pred, vesicles=vesicles, tomo=tomo, presyn_dist=8, check=False,
3838
min_thinning_size=2500,
3939
)
4040

0 commit comments

Comments
 (0)