Saving a stack as a Quicktime Movie
Posted by Philip Ershler on
URL: http://imagej.273.s1.nabble.com/Saving-a-stack-as-a-Quicktime-Movie-tp3682700.html
Hello,
I have modified the Batch Image processing plugin so that I can batch Quicktime movies as
1. Open the Quicktime Movie
2. Set an ROI
3. Crop the stack to the ROI
4. Save the stack back out as a compressed Quicktime movie (hopefully)
Here is a snipette of code that "almost" works.
public void convert(String dir1, String dir2, String format) {
IJ.log("\\Clear");
IJ.log("dir1: "+dir1);
IJ.log("dir2: "+dir2);
String[] list = new File(dir1).list();
if (list==null) return;
for (int i=0; i<list.length; i++) {
IJ.showProgress(i, list.length);
IJ.showStatus(i+"/"+list.length);
boolean isDir = (new File(dir1+list[i])).isDirectory();
if (!isDir && !list[i].startsWith(".")) {
theOpener = new My_QT_Movie_Opener(); // QT_Movie_Opener modified so it does not display a dialog "Convert to 8 bit"
theOpener.run(dir1+list[i]);
theIp = IJ.getImage();
theIp.setRoi(197, 74, 405, 354);
IJ.run(theIp, "Crop", "");
theIp.setTitle("temp.mov");
//IJ.log(" \"QuickTime Movie...\", \"compression=Sorenson quality=Normal frame=30 save=" + dir2 + list[i] + "\" ");
IJ.run(" \"QuickTime Movie...\", \"compression=Sorenson quality=Normal frame=30 save=" + dir2 + list[i] + "\" ");
IJ.run("Close");
}
}
IJ.showProgress(1.0);
IJ.showStatus("Done converting " + list.length + " files");
}
Everything down to this line, which is what comes from recording a plugin for one pass through the 4 steps above, which works properly.
IJ.run(" \"QuickTime Movie...\", \"compression=Sorenson quality=Normal frame=30 save=" + dir2 + list[i] + "\" ");
When it hits this line the machine complains "unknown command". At this point I have a cropped stack ready to be written out. What is the correct way to write a stack out as a Quicktime movie from a plugin?
Thanks, Phil
Philip R. Ershler Ph.D.
University of Utah
Cardiovascular Research and Training Institute
95 South 2000 East
Salt Lake City, UT 84112-5000