napari / napari-animation

A napari plugin for making animations
https://napari.github.io/napari-animation/
Other
76 stars 27 forks source link

saving tracks layer with napari-animation #208

Closed bicklem closed 5 months ago

bicklem commented 6 months ago

Dear all,

I am tracking cells and would like to make an animation to verify which cells have been correctly tracked. When using napari-animation, selecting the first frame, then the last step and inputing the length of the movie for step size I get an error about the truth value of an array. This error happen whether I create the movie programmatically or with the GUI.

This is the traceback: Rendering frames... 0%| | 0/100 [00:00<?, ?it/s]IMAGEIO FFMPEG_WRITER WARNING: input image is not divisible by macro_block_size=16, resizing from (3024, 1832) to (3024, 1840) to ensure video compatibility with most codecs and players. To prevent resizing, make your input image divisible by the macro_block_size or set the macro_block_size to 1 (risking incompatibility). 1%|1 | 1/100 [00:00<00:26, 3.70it/s] 1%|1 | 1/100 [00:00<00:29, 3.41it/s] The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() Traceback (most recent call last): File "", line 63, in File "/Users/bicklem/miniforge3/envs/knimepy3/lib/python3.9/site-packages/napari_animation/animation.py", line 225, in animate for frame_index, image in enumerate(frame_generator): File "/Users/bicklem/miniforge3/envs/knimepy3/lib/python3.9/site-packages/napari_animation/frame_sequence.py", line 152, in iter_frames frame = state.render(viewer, canvas_only=canvas_only) File "/Users/bicklem/miniforge3/envs/knimepy3/lib/python3.9/site-packages/napari_animation/viewer_state.py", line 79, in render self.apply(viewer) File "/Users/bicklem/miniforge3/envs/knimepy3/lib/python3.9/site-packages/napari_animation/viewer_state.py", line 58, in apply if not np.array_equal(original_value, value): File "/Users/bicklem/miniforge3/envs/knimepy3/lib/python3.9/site-packages/numpy/core/numeric.py", line 2439, in array_equal return bool(asarray(a1 == a2).all()) ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I am on Python 3.12.2 and napari version 0.4.19.post1 Any help would be greatly appreciated.

Screenshot 2024-03-15 at 07 27 53
brisvag commented 6 months ago

Probably same as #207, #180, #184... It was fixed by https://github.com/napari/napari-animation/pull/181, we just haven't released yet!

bicklem commented 6 months ago

Thanks, great to hear it is fixed. Is there a date for the release yet? I'm working on a revision of a paper and it would be great to know whether I should wait for resubmission or not.

brisvag commented 6 months ago

Hopefully within days! But if you're in a rush, you can also install from main!

pip install git+https://github.com/napari/napari-animation 
bicklem commented 6 months ago

Woohoo! Thank you very much, that worked like a charm.

camisap commented 5 months ago

has this fix been released? I am still getting this error with tracks files and I just installed the plugin

psobolewskiPhD commented 5 months ago

No 😢 Sorry! I'm not quite sure how to do it and haven't gotten around to looking into it. And I guess no-one else has had the time to take care of it in the meantime. I'll poke around this tonight, so hopefully can get it released ASAP.

psobolewskiPhD commented 5 months ago

Ok! 0.0.8 should be live! https://pypi.org/project/napari-animation/ Closing -- hopefully it fixes your issue. If not please open a new one.