You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems outline=True takes a code path that causes labels to have a wrong scale.
It is important for the images that I render to not have filled labels, but outlines.
Example
importnumpyasnpimportspatialdataassdimportspatialdata_plot# noqa: F401fromskimage.transformimportAffineTransform# Same array, same transformation used for both image and labels.# They should exactly overlap.array=np.zeros((100, 100), dtype=int)
array[30:70, 30:70] =1affine=sd.transformations.Affine(
AffineTransform(translation=(10, 10), rotation=np.deg2rad(15), scale=0.65).params,
input_axes=("y", "x"),
output_axes=("y", "x"),
)
image1=sd.models.Image2DModel.parse(
array[:, :, np.newaxis], dims=("y", "x", "c"), transformations={"global": affine}
)
labels1=sd.models.Labels2DModel.parse(
array, dims=("y", "x"), transformations={"global": affine}
)
sdata=sd.SpatialData(images={"image1": image1}, labels={"labels1": labels1})
# Render with defaults. Spatialdata-plot fills the labels with color, but no outline.sdata.pl.render_images("image1").pl.render_labels("labels1").pl.show(title="without outline", save="without_outline.png")
# Render without fill, but with outline, because I don't want to occlude what is behind the labels.sdata.pl.render_images("image1").pl.render_labels(
"labels1", fill_alpha=0.0, outline=True, outline_alpha=1.0
).pl.show(title="with outline", save="with_outline.png")
The text was updated successfully, but these errors were encountered:
It seems
outline=True
takes a code path that causes labels to have a wrong scale.It is important for the images that I render to not have filled labels, but outlines.
Example
The text was updated successfully, but these errors were encountered: