Skip to content

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

@LucaMarconato

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.

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