Skip to content

Commit

Permalink
Use 'qupath-stardist:current' image for stardist-simple
Browse files Browse the repository at this point in the history
1. Use 'current' instead of 'latest', because 'latest' is flaky.
2. We expect the qudist image to write a valid geoJSON file, now.

This image should produce valid GeoJSON files directly.
  • Loading branch information
Tom Pollard authored and tomp committed Aug 24, 2023
1 parent 2f19a7f commit 96d35e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/luna/pathology/cli/run_stardist_cell_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,18 @@ def stardist_simple(
config["output_storage_options"],
)


with fs.open(output_header_file, "wb") as of:
df.to_parquet(of)

logger.info("generated cell data:")
logger.info(df)

output_geojson_file = Path(output_path) / f"cell_detections.geojson"

properties = {
"cell_objects": str(output_header_file),
"feature_data": str(output_header_file),
"geojson_features": str(output_geojson_file),
"spatial": True,
"total_cells": len(df),
"segment_keys": {"slide_id": slide_id},
Expand Down Expand Up @@ -108,13 +110,12 @@ def stardist_simple_main(
pd.DataFrame: cell detections
"""
fs, slide_path = fsspec.core.url_to_fs(slide_urlpath, **storage_options)

ofs, output_path = fsspec.core.url_to_fs(output_urlpath, **output_storage_options)

slide_filename = Path(slide_path).name
docker_image = "mskmind/qupath-stardist:latest"
docker_image = "mskmind/qupath-stardist:current"
command = f"QuPath script --image /inputs/{slide_filename} --args [cellSize={cell_expansion_size},imageType={image_type},{debug_opts}] /scripts/stardist_simple.groovy"
logger.info("Launching docker container:")
logger.info(f"Launching QuPath via {docker_image} ...")
logger.info(
f"\tvolumes={slide_urlpath}:'/inputs/{slide_filename}', {slide_path}:'/output_dir'"
)
Expand Down Expand Up @@ -199,9 +200,12 @@ def stardist_cell_lymphocyte(
logger.info("generated cell data:")
logger.info(df)

output_geojson_file = Path(output_path) / f"cell_detections.geojson"

properties = {
"cell_objects": str(output_header_file),
"feature_data": str(output_header_file),
"geojson_features": str(output_geojson_file),
"spatial": True,
"total_cells": len(df),
"segment_keys": {"slide_id": slide_id},
Expand Down
1 change: 1 addition & 0 deletions src/luna/pathology/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,3 +617,4 @@ def get_tile_color(score: Union[str, float]) -> Optional[npt.ArrayLike]:
else:
print("Invalid Score Type")
return None

0 comments on commit 96d35e7

Please sign in to comment.