Skip to content

Commit

Permalink
Move _inspect_ROI_table to independent module, in examples/tools
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Jul 18, 2023
1 parent ed428d9 commit 9f5a788
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 42 deletions.
49 changes: 49 additions & 0 deletions examples/tools/lib_inspect_ROI_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from typing import Sequence

import anndata as ad

from fractal_tasks_core.lib_regions_of_interest import (
convert_ROI_table_to_indices,
)


def _inspect_ROI_table(
path: str,
full_res_pxl_sizes_zyx: Sequence[float],
level: int = 0,
coarsening_xy: int = 2,
) -> None:
"""
Description
:param dummy: this is just a placeholder
:type dummy: int
"""

print(f"{full_res_pxl_sizes_zyx=}")

adata = ad.read_zarr(path)
df = adata.to_df()
print("table")
print(df)
print()

try:
list_indices = convert_ROI_table_to_indices(
adata,
level=level,
coarsening_xy=coarsening_xy,
full_res_pxl_sizes_zyx=full_res_pxl_sizes_zyx,
# verbose=True,
)
print()
print(f"level: {level}")
print(f"coarsening_xy: {coarsening_xy}")
print("list_indices:")
for indices in list_indices:
print(indices)
print()
except KeyError as e:
print("Something went wrong in convert_ROI_table_to_indices\n", str(e))

return df
42 changes: 0 additions & 42 deletions fractal_tasks_core/lib_regions_of_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,48 +272,6 @@ def convert_ROI_table_to_indices(
return list_indices


def _inspect_ROI_table(
path: str,
full_res_pxl_sizes_zyx: Sequence[float],
level: int = 0,
coarsening_xy: int = 2,
) -> None:
"""
Description
:param dummy: this is just a placeholder
:type dummy: int
"""

print(f"{full_res_pxl_sizes_zyx=}")

adata = ad.read_zarr(path)
df = adata.to_df()
print("table")
print(df)
print()

try:
list_indices = convert_ROI_table_to_indices(
adata,
level=level,
coarsening_xy=coarsening_xy,
full_res_pxl_sizes_zyx=full_res_pxl_sizes_zyx,
# verbose=True,
)
print()
print(f"level: {level}")
print(f"coarsening_xy: {coarsening_xy}")
print("list_indices:")
for indices in list_indices:
print(indices)
print()
except KeyError as e:
print("Something went wrong in convert_ROI_table_to_indices\n", str(e))

return df


def array_to_bounding_box_table(
mask_array: np.ndarray, pxl_sizes_zyx: list[float]
) -> pd.DataFrame:
Expand Down

0 comments on commit 9f5a788

Please sign in to comment.