Scripting: How to generate 3D VTK canvas without click mouse?

35 views
Skip to first unread message

fangl...@berkeley.edu

unread,
Oct 20, 2018, 5:28:42 PM10/20/18
to Icy imaging
Hi,

I am using Icy to make a 3D time-lapse video, in which each frame is a 3D volume at different time point. I'm using script editor to load every Z-stack, draw on canvas, take a snapshot, and then make a video using all the snapshots. 

My problem is that, when I use gui.addsequence(seq), it always generate the 2D canvas. Is there a way to switch to 3D VTK canvas in script? I only know that I can click the 3D VTK button with my mouse, but there are thousands of time points I'm going to process.

Linda Liu

unread,
Oct 21, 2018, 7:10:55 PM10/21/18
to Icy imaging
I have figured it out. For anyone else who have the problem, here are the functions I used:

viewer = new Viewer(seq)
canvas=VtkCanvasPlugin().createCanvas(viewer)
viewer.setCanvas(canvas)

It takes me a while to figure out which Class and function to use. In the future, it might to useful to show every function corresponding to each mouse click in the Console; or add Macro recorder like ImageJ. 

Thanks,
Linda Liu

Stephane

unread,
Nov 6, 2018, 6:14:25 AM11/6/18
to icy-so...@googlegroups.com
Hi Linda,

Well done ! Indeed that is the method to use, the problem is that "canvas" are plugin in Icy (even if VTK canvas is a "kernel" plugin) so we can't make static methods to change easily the type of canvas. Also catching every command / action with macro recording would be difficult (if not impossible), it's why we prefer to promote "Protocols" in general.
About your specific script, i think you could just have loaded all Z stacks together so Icy would have generated a single time laps 3D stack image (if your system has enough memory) then just use the screen shot feature to generate the movie.

Best,

- Stephane
Reply all
Reply to author
Forward
0 new messages