Skip to content

Commit

Permalink
fix: json scale typing and also processing for meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
seankmartin committed Sep 13, 2024
1 parent 29d7010 commit 4c5123c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cryoet_data_portal_neuroglancer/state_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _setup_creation(
name: str | None = None,
url: str | None = None,
zarr_path: str | None = None,
scale: float | tuple[float, float, float] = 1.0,
scale: tuple[float, float, float] | list[float] | float = 1.0,
) -> tuple[str, str, str, str, tuple[float, float, float]]:
name = Path(source).stem if name is None else name
url = url if url is not None else ""
Expand All @@ -41,7 +41,7 @@ def generate_point_layer(
url: str | None = None,
color: str = "#FFFFFF",
point_size_multiplier: float = 1.0,
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: float | tuple[float, float, float] = (1.0, 1.0, 1.0),
is_visible: bool = True,
is_instance_segmentation: bool = False,
) -> dict[str, Any]:
Expand All @@ -65,7 +65,7 @@ def generate_oriented_point_layer(
color: str = "#FFFFFF",
point_size_multiplier: float = 1.0,
line_width: float = 1.0,
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: float | tuple[float, float, float] = (1.0, 1.0, 1.0),
is_visible: bool = True,
is_instance_segmentation: bool = False,
) -> dict[str, Any]:
Expand All @@ -88,7 +88,7 @@ def generate_segmentation_mask_layer(
name: str | None = None,
url: str | None = None,
color: str = "#FFFFFF",
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: float | tuple[float, float, float] = (1.0, 1.0, 1.0),
is_visible: bool = True,
display_bounding_box: bool = False,
display_mesh: bool = True,
Expand All @@ -113,13 +113,13 @@ def generate_mesh_layer(
name: str | None = None,
url: str | None = None,
color: str = "#FFFFFF",
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: float | tuple[float, float, float] = (1.0, 1.0, 1.0),
is_visible: bool = True,
display_bounding_box: bool = False,
display_mesh: bool = True,
highlight_on_hover: bool = False,
) -> dict[str, Any]:
source, name, url, _, _ = _setup_creation(source, name, url, scale=scale)
source, name, url, _, scale = _setup_creation(source, name, url, scale=scale)
_validate_color(color)
return MeshJSONGenerator(
source=source,
Expand All @@ -138,13 +138,14 @@ def generate_oriented_point_mesh_layer(
name: str | None = None,
url: str | None = None,
color: str = "#FFFFFF",
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: float | tuple[float, float, float] = (1.0, 1.0, 1.0),
is_visible: bool = True,
display_bounding_box: bool = False,
display_mesh: bool = True,
highlight_on_hover: bool = False,
) -> dict[str, Any]:
source, name, url, _, _ = _setup_creation(source, name, url, scale=scale)
print("source", source, name, url, color, scale)
source, name, url, _, scale = _setup_creation(source, name, url, scale=scale)
_validate_color(color)
return MeshJSONGenerator(
source=source,
Expand All @@ -160,7 +161,7 @@ def generate_oriented_point_mesh_layer(

def generate_image_layer(
source: str,
scale: tuple[float, float, float],
scale: float | tuple[float, float, float],
size: dict[str, float],
name: str | None = None,
url: str | None = None,
Expand Down Expand Up @@ -189,7 +190,7 @@ def generate_image_volume_layer(
name: str | None = None,
url: str | None = None,
color: str = "#FFFFFF",
scale: tuple[float, float, float] = (1.0, 1.0, 1.0),
scale: tuple[float, float, float] | list[float] | float = (1.0, 1.0, 1.0),
is_visible: bool = True,
rendering_depth: int = 1024,
) -> dict[str, Any]:
Expand Down

0 comments on commit 4c5123c

Please sign in to comment.