Closed AlexSauer closed 7 months ago
uh oh! Thanks for the report
If I remember rightly @brisvag made some changes to how napari handles interpolations in 3D which changed the API slightly. He might have a quick fix but otherwise @katherine-hutchings and I can take a look when we pair next week 🙂
Yeah, it's probably that; odd error though, it seems like napari-animation is providing the new value but napari is older?. bilinear
is now replaced by linear
. Also, interpolation2d
and interpolation3d
are now separate for Image
.
@brisvag is the above true in the released version or just on main? not sure where this is running - @AlexSauer what version of napari are you using?
The 0.4.17 release has the new api (and deprecations for the older one).
sweet, thanks!
ah yeah, I was still running 0.4.16
, thanks a lot!
Would be good to know the version of napari-animation that was involved here. The current version 0.0.7 has multiple issues in this context: https://github.com/napari/napari-animation/issues/177 https://github.com/napari/napari-animation/issues/180
But I think the issue is that there are different options for interpolation
in 2d and 3d.
linear
is valid in 0.4.16 but only in 3d. In current napari linear
works in both, so it "fixes it" but not really?
I this might be an issue with the way the attributes are handled between keyframes? I'll poke around.
I think I was on the right track.
So the viewer_state is set correctly.
But when napari-animation
does the interpolation for the layer_state interpolation
(in 0.4.16 shared between 2d and 3d) it uses:
https://github.com/napari/napari-animation/blob/5760ee2902f59edf6eeb85bd10651452f39746a4/napari_animation/interpolation/base_interpolation.py#L93-L113
Which means that that interpolation mode is switched immediately.
However, dims.ndisplay
is interpolated using default, so as int:
https://github.com/napari/napari-animation/blob/5760ee2902f59edf6eeb85bd10651452f39746a4/napari_animation/interpolation/base_interpolation.py#L70-L90
You can see that the value is computed, but then coerced to int, which truncates the decimals, resulting in the opposite effect to the bool
interpolation.
Importantly, this is still present in current napari. You don't get an error, because layers have both interpolation modes. But use 3D blobs and make a 2D keyframe, then change something along with ndisplay to 3, and set new keyframe. You will see the first parameter get changed for the steps and then 3D toggle at the end.
So I think because ndisplay
can only be 2 or 3, it should be interpolated like bool, rather than like number.
Which I think can be done here:
https://github.com/napari/napari-animation/blob/5760ee2902f59edf6eeb85bd10651452f39746a4/napari_animation/frame_sequence.py#L80-L82
I'm going to give it a whirl and see what happens.
Hi,
just discovered this plugin and already a big fan! I was trying to run the animatedMixed.py example but getting the following error message which seems to happen during the switch from 2D to 3D.
Can anyone reproduce this problem or has an idea how I can fix it?