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

ApplyTransform.Warp.run() alters the TransformsList such that it can't be used again #1866

Open
mattcai opened this issue Apr 10, 2020 · 1 comment
Labels
bug An issue with an existing feature
Milestone

Comments

@mattcai
Copy link
Contributor

mattcai commented Apr 10, 2020

Description

Sometimes, starfish users may want to apply a TransformsList to multiple ImageStacks with ApplyTransform.Warp. For example, applying the same transforms to both dapi and primary ImageStacks. The issue is that TransformsList gets modified when used by ApplyTransform.Warp such that the next time it is used by ApplyTransform.Warp it can return erroneous results or throws an error.

A quick workaround is to only use each TransformsList once, and re-LearnTransform if needed.

Steps/Code to Reproduce

transforms bug gist

Expected Results

The transforms printed before and after Warp.run() are the same. No error is thrown on the second Warp.run().

Actual Results

Before:
tile indices: {<Axes.ROUND: 'r'>: 0}
translation: y=0.0, x=0.0, rotation: 0.0, scale: 1.0
tile indices: {<Axes.ROUND: 'r'>: 1}
translation: y=-102.126, x=194.721, rotation: 0.0, scale: 1.0
tile indices: {<Axes.ROUND: 'r'>: 2}
translation: y=-190.79, x=120.938, rotation: 0.0, scale: 1.0

After:
tile indices: {<Axes.ROUND: 'r'>: 0, <Axes.CH: 'c'>: 2, <Axes.ZPLANE: 'z'>: 0}
translation: y=0.0, x=0.0, rotation: 0.0, scale: 1.0
tile indices: {<Axes.ROUND: 'r'>: 1, <Axes.CH: 'c'>: 2, <Axes.ZPLANE: 'z'>: 0}
translation: y=-102.126, x=194.721, rotation: 0.0, scale: 1.0
tile indices: {<Axes.ROUND: 'r'>: 2, <Axes.CH: 'c'>: 2, <Axes.ZPLANE: 'z'>: 0}
translation: y=-190.79, x=120.938, rotation: 0.0, scale: 1.0

KeyError thrown.

@mattcai mattcai added the bug An issue with an existing feature label Apr 10, 2020
@mattcai mattcai changed the title ApplyTransform.Warp.run() alters the TransformsList such that it can't be used again ApplyTransform.Warp.run() alters the TransformsList such that it can't be used again Apr 10, 2020
@neuromusic neuromusic added this to the 0.3.0 milestone Apr 10, 2020
@neuromusic neuromusic modified the milestones: 0.2.1, 0.2.x, 0.2.2 Aug 7, 2020
@davidhbrann
Copy link

It looks like this issue is still present, and due to how the Axes of the selector gets updated. I had to make a deepcopy of TransformsList to warp both a dots fiducial image and an image stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants