Skip to content
Closed
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
6 changes: 3 additions & 3 deletions starfish/core/spots/FindSpots/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ def image_to_spots(

# measure intensities
data_image = np.asarray(data_image)
if self.is_volume:
if fitted_blobs_array.shape[1] == 4:
z_inds = fitted_blobs_array[:, 0].astype(int)
y_inds = fitted_blobs_array[:, 1].astype(int)
x_inds = fitted_blobs_array[:, 2].astype(int)
radius = np.round(fitted_blobs_array[:, 3] * np.sqrt(3))
intensities = data_image[tuple([z_inds, y_inds, x_inds])]
else:
elif fitted_blobs_array.shape[1] == 3:
Comment on lines +140 to +146
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks only for shapes with 3 or 4 columns, but doesn't handle other potential array shapes. If fitted_blobs_array.shape[1] is neither 3 nor 4, the code will silently skip both branches, leaving intensities, z_inds, y_inds, x_inds, and radius undefined, which will cause errors in subsequent code. Add an else clause to raise an informative error for unexpected array shapes.

Copilot uses AI. Check for mistakes.
z_inds = np.asarray([0 for x in range(len(fitted_blobs_array))])
y_inds = fitted_blobs_array[:, 0].astype(int)
x_inds = fitted_blobs_array[:, 1].astype(int)
radius = np.round(fitted_blobs_array[:, 2] * np.sqrt(2))
intensities = data_image[tuple([z_inds, y_inds, x_inds])]
intensities = data_image[tuple([y_inds, x_inds])]

# construct dataframe
spot_data = pd.DataFrame(
Expand Down
Loading