Skip to content

Commit 224ef6c

Browse files
Fix issues in structure processing
1 parent e7288b5 commit 224ef6c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/otoferlin/automatic_processing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _get_center_crop(input_):
2323

2424

2525
def _get_tiling():
26-
tile = {"x": 768, "y": 768, "z": 64}
26+
tile = {"x": 768, "y": 768, "z": 48}
2727
halo = {"x": 128, "y": 128, "z": 8}
2828
return {"tile": tile, "halo": halo}
2929

@@ -65,23 +65,25 @@ def process_ribbon_structures(mrc_path, output_path, process_center_crop):
6565
input_, voxel_size = read_mrc(mrc_path)
6666
if process_center_crop:
6767
bb, full_shape = _get_center_crop(input_)
68-
input_ = input_[bb]
68+
input_, vesicles = input_[bb], vesicles[bb]
69+
assert input_.shape == vesicles.shape
6970

7071
model_name = "ribbon"
7172
model = get_model(model_name)
7273
scale = compute_scale_from_voxel_size(voxel_size, model_name)
7374
tiling = _get_tiling()
75+
7476
segmentations, predictions = _segment_ribbon_AZ(
7577
input_, model, tiling=tiling, scale=scale, verbose=True, extra_segmentation=vesicles,
7678
return_predictions=True, n_slices_exclude=5,
7779
)
7880

7981
if process_center_crop:
80-
for name, seg in segmentations:
82+
for name, seg in segmentations.items():
8183
full_seg = np.zeros(full_shape, dtype=seg.dtype)
8284
full_seg[bb] = seg
8385
segmentations[name] = full_seg
84-
for name, pred in predictions:
86+
for name, pred in predictions.items():
8587
full_pred = np.zeros(full_shape, dtype=seg.dtype)
8688
full_pred[bb] = pred
8789
predictions[name] = full_pred

0 commit comments

Comments
 (0)