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

Split Stack resets coordinates? #143

Open
harrig12 opened this issue Jul 28, 2023 · 7 comments
Open

Split Stack resets coordinates? #143

harrig12 opened this issue Jul 28, 2023 · 7 comments

Comments

@harrig12
Copy link

I have a SpatialData with two images, a and b. Each image is mapped to two coordinate system: global and aligned, with the following mapping:

a -> global: identity
b -> global: identity
a -> aligned: identity
b -> aligned: affine

in the viewer, when I open the aligned images, things look good, but if I rightclick image b and use Split Stack to separate out the channels, then my aligned coordinated system seems to be ignored, and the channels all get reset to global. Mean (or other) projections don't seem to have this issue.

@LucaMarconato
Copy link
Member

Hi, thanks for reporting.

@melonora do you know if there is a hook for Split Stack? I think that calling the function you wrote to transfer the metadata would fix this issue.

@melonora
Copy link
Collaborator

@harrig12 @LucaMarconato there is no callback other than a new layer being added as far as I know. However, we can potentially overload the call with the SpatialDataViewer class. I will look into it and report back / implement changes later this week. @harrig12 would you be able to share a small test example? No worries if you can't. One question what number of channels does B have?

@LucaMarconato
Copy link
Member

Thanks a lot @melonora!

@harrig12
Copy link
Author

harrig12 commented Aug 2, 2023

Sure, here's an example zarr

splitstack_mwe.zarr.zip

The affine transformation on B is:

Affine (x, y -> x, y)
    [2.90898430e-01 6.02962457e-03 1.48529400e+02]
    [-2.58579771e-03  2.91931444e-01  2.53555781e+02]
    [0. 0. 1.]

In this example, I have 4 channels in B, but there may be anywhere from 1-40

Thanks! 💃

@melonora
Copy link
Collaborator

melonora commented Aug 2, 2023

Thanks for providing the sample data! I will get on it

@melonora
Copy link
Collaborator

melonora commented Aug 8, 2023

Hi @harrig12,

Just to give an update. I opened #136 to support multiple spatialdata objects. As a follow up PR I can fix the issue that you have as I have added a callback function when a layer gets inserted. Could you tell me whether you are using split rgb or split stack? Based on napari documentation these should behave differently.

Based on napari documentation:

Split RGB - if the image layer is an RGB image, it will be split into 3 new layers with red, green, and blue values in separate layers.

Split Stack - if an image layer is a stack (has 3 or more dimensions), it is split into a list of layers along the axis. This option takes a little time to execute. Properties will be changed as follows:

    - Colormap: (magenta, green) for a stack with 2 channels, (CYMRGB) for stacks with more than 2 channels

    - Blending: additive

    - Contrast_limits: min and max values of the layer

    - All other properties, such as Scale and Translate will be propagated from the original stack.

@harrig12
Copy link
Author

harrig12 commented Aug 8, 2023

I'm using split stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants