Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't attempt ROI stats on big images #223

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion omero/export_scripts/Batch_ROI_Export.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def log(data):
print(data)


def is_big_image(image):
"""Return True if image is tiled."""
max_size = image._conn.getMaxPlaneSize()
return (image.getSizeX() * image.getSizeY()) > (max_size[0] * max_size[1])


def get_export_data(conn, script_params, image, units=None):
"""Get pixel data for shapes on image and returns list of dicts."""
log("Image ID %s..." % image.id)
Expand All @@ -58,6 +64,7 @@ def get_export_data(conn, script_params, image, units=None):
all_planes = script_params["Export_All_Planes"]
include_points = script_params.get("Include_Points_Coords", False)
size_c = image.getSizeC()
big_image = is_big_image(image)
# Channels index
channels = script_params.get("Channels", [1])
ch_indexes = []
Expand Down Expand Up @@ -110,7 +117,7 @@ def get_export_data(conn, script_params, image, units=None):
# get pixel intensities
for z in z_indexes:
for t in t_indexes:
if z is None or t is None:
if z is None or t is None or big_image:
stats = None
else:
stats = roi_service.getShapeStatsRestricted(
Expand Down