Skip to content

Commit

Permalink
Minor update to move edge-related attributes to border (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 authored Sep 22, 2024
1 parent 26749a1 commit 88e2889
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions micro_sam/sam_annotator/_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def _create_layers(self):
self._point_prompt_layer = self._viewer.add_points(
name="point_prompts",
property_choices={"label": self._point_labels},
edge_color="label",
edge_color_cycle=vutil.LABEL_COLOR_CYCLE,
border_color="label",
border_color_cycle=vutil.LABEL_COLOR_CYCLE,
symbol="o",
face_color="transparent",
edge_width=0.5,
border_width=0.5,
size=12,
ndim=self._ndim,
)
self._point_prompt_layer.edge_color_mode = "cycle"
self._point_prompt_layer.border_color_mode = "cycle"

# Add the shape layer for box and other shape prompts.
self._viewer.add_shapes(
Expand Down
12 changes: 6 additions & 6 deletions micro_sam/sam_annotator/annotator_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ def _create_layers(self):
"state": self._track_state_labels,
"track_id": ["1"], # we use string to avoid pandas warning
},
edge_color="label",
edge_color_cycle=vutil.LABEL_COLOR_CYCLE,
border_color="label",
border_color_cycle=vutil.LABEL_COLOR_CYCLE,
symbol="o",
face_color="state",
face_color_cycle=STATE_COLOR_CYCLE,
edge_width=0.4,
border_width=0.4,
size=12,
ndim=self._ndim,
)
self._point_prompt_layer.edge_color_mode = "cycle"
self._point_prompt_layer.border_color_mode = "cycle"
self._point_prompt_layer.face_color_mode = "cycle"

# Using the box layer to set divisions currently doesn't work.
Expand All @@ -132,9 +132,9 @@ def _create_layers(self):
edge_color="green",
property_choices={"track_id": ["1"]},
# property_choces={"track_id": ["1"], "state": self._track_state_labels},
# edge_color_cycle=STATE_COLOR_CYCLE,
# border_color_cycle=STATE_COLOR_CYCLE,
)
# self._box_prompt_layer.edge_color_mode = "cycle"
# self._box_prompt_layer.border_color_mode = "cycle"

# Add the label layers for the current object, the automatic segmentation and the committed segmentation.
dummy_data = np.zeros(self._shape, dtype="uint32")
Expand Down
8 changes: 4 additions & 4 deletions test/test_prompt_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def _debug(self, mask, coordinates=None, labels=None, box=None, deformed_mask=No
data=coordinates,
name="prompts",
properties={"label": labels},
edge_color="label",
edge_color_cycle=["#00FF00", "#FF0000"],
border_color="label",
border_color_cycle=["#00FF00", "#FF0000"],
symbol="o",
face_color="transparent",
edge_width=0.5,
border_width=0.5,
size=5,
ndim=2
) # this function helps to view the (colored) background/foreground points
prompts.edge_color_mode = "cycle"
prompts.border_color_mode = "cycle"

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

0 comments on commit 88e2889

Please sign in to comment.