ImageJ API: how to change the framerate when writing AVI
Asked Answered
P

1

0

I would like to use the AVI_Writer from the ImageJ API in my java program. However, even though I can automate the movie writing, I haven't found out how to change the framerate when using the method:

writeImage(ImagePlus imp, java.lang.String path, int compression, int jpegQuality)

Any idea?

Thanks.

Paperhanger answered 7/2, 2014 at 19:27 Comment(0)
O
1

If you look at the menu command for saving as AVI, it has an option to set the frame rate, which is taken from a setting hidden in Image > Stacks > Tools > Animation Options... in the menu.

Using the command finder, which you can invoke by typing [L], you find the sources for these two commands:

  • File > Save As > AVI... => ij.plugin.filter.AVI_Writer
  • Image > Stacks > Tools > Animation Options... => ij.plugin.Animator("options")

The command finder provides a handy button that directly links to the source files, have a look here and here. You'll find that the frame rate setting is stored as fps in the Calibration of the ImagePlus.

Octameter answered 7/2, 2014 at 21:49 Comment(1)
Thank you, I had tried to create a new Calibration like this: Calibration cal=new Calibration(ip), where ip is my ImagePlus, but it hadn't worked. Instead, I did Calibration cal=ip.getCalibration(); cal.fps=60; ip.setCalibration(cal); and now it works perfectly :DPaperhanger

© 2022 - 2024 — McMap. All rights reserved.