3DScript java.lang.RuntimeException: Error reading animations

Hi,
I have been trying to use the 3DScript but for some reason I keep having the following error.

*From frame 0 to frame 100 rotate by 360*
*rotate by 360*
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Error reading animations
	at animation3d.editor.AnimationEditor.runText(AnimationEditor.java:962)
	at animation3d.editor.TextEditorTab$1.actionPerformed(TextEditorTab.java:56)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6539)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: Error at position 39: Expected SPACE but found end of line.
	at animation3d.parser.Lexer.getNextToken(Lexer.java:45)
	at animation3d.parser.Interpreter.space(Interpreter.java:89)
	at animation3d.parser.Interpreter.rotation(Interpreter.java:258)
	at animation3d.parser.Interpreter.action(Interpreter.java:587)
	at animation3d.parser.Interpreter.line(Interpreter.java:652)
	at animation3d.parser.Interpreter.parse(Interpreter.java:658)
	at animation3d.parser.Interpreter.parse(Interpreter.java:662)
	at animation3d.textanim.Animator.render(Animator.java:80)
	at animation3d.editor.AnimationEditor.runText(AnimationEditor.java:958)
	... 37 more

This happens doing simple things like rotating or changing the clipping plane.
How can I prevent this java.lang.RuntimeException?

Thanks a lot

Hi @LPUoO

I think that the problem is that the script is missing the units (degrees) and the axis of rotation. Try:

From frame 0 to frame 100 rotate by 360 degrees horizontally

Nico

Thanks @NicoDF,
The example I made above wasn’t the best but the truth is that I tried to use multiple times the 3DScript but I never managed to use it properly.

For example if I run the script for suppl vid 9 (below) the result I have is very different from the one I should have,

From frame 0 to frame 100:
- rotate by -360 degrees horizontally
- translate horizontally by tr
- zoom by a factor of z

From frame 80 to frame 120 translate by (0, 0, 80) ease-in-out
From frame 120 to frame 190 translate by (0, 0, -160) ease-in-out
From frame 190 to frame 230 translate by (0, 0, 80) ease-in-out

script
function z(t) {
    return 0.75 + 0.25 * cos(2 * PI * t / 100);
}

script
function tr(t) {
    return 128 * cos(2 * PI * (t+25) / 100);
}
    

Attached is the output I have. In my case nothing happens after the frame 100. Also even the begining is different than the video I should have (here on youtube)
t1-head.tif.tif (14.9 MB)

Regarding the error I haven when running the following I don’t understand why it goes wrong since this is just the first 2 lines of the first example of the gallery

At frame 0:

  • change front clipping to 0
*At frame 0 change front clipping to 0*
*change front clipping to 0*
*front clipping to 0*
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Error reading animations
	at animation3d.editor.AnimationEditor.runText(AnimationEditor.java:962)
	at animation3d.editor.TextEditorTab$1.actionPerformed(TextEditorTab.java:56)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6539)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: Expected non-channel property
	at animation3d.parser.Interpreter.nonchannelproperty(Interpreter.java:400)
	at animation3d.parser.Interpreter.change(Interpreter.java:448)
	at animation3d.parser.Interpreter.action(Interpreter.java:595)
	at animation3d.parser.Interpreter.line(Interpreter.java:652)
	at animation3d.parser.Interpreter.parse(Interpreter.java:658)
	at animation3d.parser.Interpreter.parse(Interpreter.java:662)
	at animation3d.textanim.Animator.render(Animator.java:80)
	at animation3d.editor.AnimationEditor.runText(AnimationEditor.java:958)
	... 37 more

Thanks a lot for your help

Hi @LPUoO:

First of all, I must confess that I’ve started playing with 3Dscript only in the last week, so I’m also learning the basics, and sometimes struggling with behaviors I don’t expect.

That being said, here’s what I can tell you:

Perhaps the docs are a little outdated. I can get that to run as expected by adding the channel to the sentence:

At frame 0:
- change all channels' front clipping to 0

or

At frame 0:
- change channel 1 front clipping to 0

I learnt that the autocomplete feature in the editor usually hints for the correct syntax (like adding degrees, or the channel keyword after change).

As for this:

Please note that the example has the following text below:

Rendering of an MRI image volume of a human head using the BigDataViewer. To demonstrate the extendibility of our framework, we wrote an adapter for Fiji’s BigDataViewer.

So, perhaps, the behavior is different in the context of the BDV (yet, I haven’t been able to make the 3Dscript to pick up the image in the BDV).

Perhaps we could ping @bene.schmid for some help here.

Cheers,
Nico

Dear LPUoO and Nico,

indeed, suppl. video 9 was created using the BigDataViewer as rendering backend. The code for this example exists here: https://github.com/bene51/3Dscript/tree/master/3D_Animation_BDV. It’s not yet a ready-usable plugin, but more a proof-of-principle and a starting point if someone is interested in writing code to control the BDV with 3Dscript.

Since each rendering backend (like the BDV or POV-Ray, which was used suppl. video 10) has different capabilities and adjustable parameters, the language syntax needs to be adjusted accordingly. That’s the reason why video 9’s script will not work with the built-in renderer.

As Nico mentioned, I would recommend to let you guide by the editor’s autocompletion, but of course I’m biased and I may not see problems that a new user encounters. Therefore, I can only encourage you to just ask here in the forum. (And it will definitely help if you mention me personally.)

Thanks for pointing out the issue with example 1’s script, I updated it.

Best wishes,
Bene

1 Like

Thanks @bene.schmid for coming back,

I had some trouble figuring out the how the values for the clippings work, I managed to do more or less what I wanted but I’m still insure how the dimensions work.



Also, for some reason the object has some sort of rings when displayed with 3DScript (left) that are not present when displayed with other 3D viewers. No mater of how I changed the display I didn’t manage to make it look like with the inbuilt FIJI 3D viewer (right). Any suggestion ?

Thanks a lot

Would you mind sharing the dataset with me? Or can you at least tell me voxel width, height and depth?

Hi,
Thanks for for your help, the voxel size is : 0.0426x0.0426x0.4000 micron^3

Hi,
I guess that the rings you see come from the fact that your z-spacing is 10 times larger than your xy-spacing. You could try to reslice in z-direction, e.g. using >Image>Stacks>ResliceZ, such that the voxel depth matches the voxel width, before loading the data into 3Dscript.

1 Like