Skip to content

Commit 21d8a58

Browse files
Revert "Fix clearing shape layer (#696)" (#709)
This reverts commit 3ecce52.
1 parent 3ecce52 commit 21d8a58

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

environment_cpu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- nifty =1.2.1=*_4
88
- imagecodecs
99
- magicgui
10-
- napari
10+
- napari <0.5
1111
- pip
1212
- pooch
1313
- pyqt

environment_gpu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- imagecodecs
88
- nifty =1.2.1=*_4
99
- magicgui
10-
- napari
10+
- napari <0.5
1111
- pip
1212
- pooch
1313
- pyqt

micro_sam/sam_annotator/_annotator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ def _create_layers(self):
2929
self._point_prompt_layer = self._viewer.add_points(
3030
name="point_prompts",
3131
property_choices={"label": self._point_labels},
32-
border_color="label",
33-
border_color_cycle=vutil.LABEL_COLOR_CYCLE,
32+
edge_color="label",
33+
edge_color_cycle=vutil.LABEL_COLOR_CYCLE,
3434
symbol="o",
3535
face_color="transparent",
36-
border_width=0.5,
36+
edge_width=0.5,
3737
size=12,
3838
ndim=self._ndim,
3939
)
40-
self._point_prompt_layer.border_color_mode = "cycle"
40+
self._point_prompt_layer.edge_color_mode = "cycle"
4141

4242
# Add the shape layer for box and other shape prompts.
4343
self._viewer.add_shapes(

micro_sam/sam_annotator/annotator_tracking.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ def _create_layers(self):
109109
"state": self._track_state_labels,
110110
"track_id": ["1"], # we use string to avoid pandas warning
111111
},
112-
border_color="label",
113-
border_color_cycle=vutil.LABEL_COLOR_CYCLE,
112+
edge_color="label",
113+
edge_color_cycle=vutil.LABEL_COLOR_CYCLE,
114114
symbol="o",
115115
face_color="state",
116116
face_color_cycle=STATE_COLOR_CYCLE,
117-
border_width=0.4,
117+
edge_width=0.4,
118118
size=12,
119119
ndim=self._ndim,
120120
)
121-
self._point_prompt_layer.border_color_mode = "cycle"
121+
self._point_prompt_layer.edge_color_mode = "cycle"
122122
self._point_prompt_layer.face_color_mode = "cycle"
123123

124124
# Using the box layer to set divisions currently doesn't work.

micro_sam/sam_annotator/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def clear_annotations(viewer: napari.Viewer, clear_segmentations=True) -> None:
120120
viewer.layers["point_prompts"].data = []
121121
viewer.layers["point_prompts"].refresh()
122122
if "prompts" in viewer.layers:
123-
viewer.layers["prompts"].remove_selected()
123+
viewer.layers["prompts"].data = []
124124
viewer.layers["prompts"].refresh()
125125
if not clear_segmentations:
126126
return

micro_sam/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def get_sam_model(
357357

358358
# Add the decoder to the state if we have one and if the state is returned.
359359
if decoder_path is not None and return_state:
360-
state["decoder_state"] = torch.load(decoder_path, map_location=device, weights_only=False)
360+
state["decoder_state"] = torch.load(decoder_path, map_location=device)
361361

362362
if return_sam and return_state:
363363
return predictor, sam, state

test/test_prompt_generators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ def _debug(self, mask, coordinates=None, labels=None, box=None, deformed_mask=No
3434
data=coordinates,
3535
name="prompts",
3636
properties={"label": labels},
37-
border_color="label",
38-
border_color_cycle=["#00FF00", "#FF0000"],
37+
edge_color="label",
38+
edge_color_cycle=["#00FF00", "#FF0000"],
3939
symbol="o",
4040
face_color="transparent",
41-
border_width=0.5,
41+
edge_width=0.5,
4242
size=5,
4343
ndim=2
4444
) # this function helps to view the (colored) background/foreground points
45-
prompts.border_color_mode = "cycle"
45+
prompts.edge_color_mode = "cycle"
4646

4747
if deformed_mask is not None:
4848
v.add_labels(deformed_mask.astype("uint8"), name="deformed mask / prediction")

0 commit comments

Comments
 (0)