Skip to content

_robust_transform() after cropping gives problems with images and labels #167

Closed

Description

@LucaMarconato

Probably this bug will disappear once scverse/spatialdata#318 is merged.

I have noticed that if I do a bounding box query on the blobs dataset, and I try to plot the shapes, I get an error related to the images and labels (btw strange, since I was not trying to plot raster data).

This can be reproduced as follows:

import spatialdata as sd
from spatialdata.models import TableModel
from spatialdata.datasets import blobs
import spatialdata_plot
from napari_spatialdata import Interactive
import numpy as np

sdata = blobs()

sdata_cropped = sdata.query.bounding_box(axes=('x', 'y'), min_coordinate=[200, 150], max_coordinate=[300, 250], target_coordinate_system='global')
sdata_cropped

# del sdata_cropped.images['blobs_image']
# del sdata_cropped.images['blobs_multiscale_image']
# del sdata_cropped.labels['blobs_labels']
# del sdata_cropped.labels['blobs_multiscale_labels']

sdata_cropped.pl.render_shapes('blobs_circles').pl.show()

The last line will fail, but if we uncomment the 4 lines with del, which remove raster data from the sdata_cropped object, then plotting will work.

Activity

  1. Sonja-Stockhaus commented on Sep 29, 2023

    @Sonja-Stockhaus
    Collaborator

    @LucaMarconato I also noticed that there are bugs in this function, the problem is when it gets multi-scale images as input or labels with only [y, x] and not [c, y, x]. Leaving in sdata_cropped.images['blobs_image'] should be fine. I made some adjustments to the function so I hope the problem is gone when multiscale-image handling is finished (#164)

  2. timtreis commented on Oct 2, 2023

    @timtreis
    Member

    Yeah, I'd prefer not to fix robust_transform as it'll soon disappear. I'm just waiting for the fix of scverse/spatialdata#353 to finalise the scverse/spatialdata#318. Afterwards we plan to also do a release of spatialdata-plot 👍

  3. timtreis commented on Nov 3, 2023

    @timtreis
    Member

    _robust_transform is no longer part of the codebase since #162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions