http://imagej.273.s1.nabble.com/problems-with-Batch-Converter-tp5002705p5002750.html
Thanks Curtis, that did brought colors. Only thing now is that the brightness of the resulting JPG's is lower than if I view the original in AxioVision. I wonder which is 'correct'?
Sent: 19. april 2013 16:48
Probably your source ZVIs store channels as separate planes, so they open as a composite color image, rather than an RGB color one.
That will open the file as a hyperstack in composite color mode, then convert to RGB color before exporting as JPEG.
> PS. I read about ImageJ2 now and then - when is it due?
It is in beta now, meaning lots of stuff works but there are technical aspects that are still subject to change. You can download and try it from
. That page also has the release schedule.
> PPS. Is there a way to halt processes and macros in ImageJ (like
Not that I know of, other than quitting ImageJ. However, if you control the macro code, you could always build in a way to cancel it mid-execution.
> Hi Curtis,
>
> Thanks a lot. I played a bit with it, and I seem to be doing some
> progress. In addition to changing file extensions, I had to remove the
> uppercasing of the path before it gave results. Only thing now seems
> to be that my JPGs come in B/W instead of color like the source ZVIs.
> Any suggestions to solve that also (present code is below)?
>
> Lars
>
> PS. I read about ImageJ2 now and then - when is it due?
> PPS. Is there a way to halt processes and macros in ImageJ (like
> Ctrl-Break in some programs)?
>
> CODE:
> ____________________________________________________________
>
> ext = "zvi"; // this variable controls the extension of source files
>
> requires("1.39u");
> inDir = getDirectory("Choose Directory Containing " + ext + " Files
> "); outDir = getDirectory("Choose Directory for JPG Output ");
> setBatchMode(true); processFiles(inDir, outDir, "");
> print("-- Done --");
>
> function processFiles(inBase, outBase, sub) {
> flattenFolders = true; // this flag controls output directory structure
> print("-- Processing folder: " + sub + " --");
> list = getFileList(inBase + sub);
> if (!flattenFolders) File.makeDirectory(outBase + sub);
> for (i=0; i<list.length; i++) {
> path = sub + list[i];
> //upath = toUpperCase(path);
> upath = path; // should not be upper-cased as line above does
> if (endsWith(path, "/")) {
> // recurse into subdirectories
> processFiles(inBase, outBase, path);
> }
> else if (endsWith(upath, "." + ext)) {
> print("-- Processing file: " + path + " --");
> run("Bio-Formats Importer", "open='" + inBase + path + "'
> color_mode=Default view=[Standard ImageJ] stack_order=Default
> use_virtual_stack");
> outFile = outBase + path + ".jpg";
> if (flattenFolders) outFile = replace(outFile, "/", "_");
> run("Bio-Formats Exporter", "save=[" + outFile + "]
> compression=Uncompressed");
> close();
> run("Collect Garbage");
> }
> }
> }
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
> Curtis Rueden
> Sent: 18. april 2013 21:49
> To:
[hidden email]
> Subject: Re: problems with Batch Converter
>
> Hi Lars,
>
> > In the end, no matter if I OK or cancel any of the dialogs, some
> > open files are created in ImageJ, but my output folder is empty.
>
> You have run into a limitation of the way ImageJ's image I/O works. In
> this case, the symptom is that Batch Converter will not work when
> reading files using Bio-Formats.
>
> ImageJ2 will make image I/O more extensible, but in the meantime, the
> easiest solution is to convert your files using a macro.
>
> Here is a template you can adapt to do what you want:
>
>
https://github.com/openmicroscopy/bioformats/blob/v4.4.6/components/lo> ci-plugins/utils/macros/recursiveTiffConvert.txt
>
> Change the "DM3" extension to "ZVI" and then change the ".ome.tif"
> extension on line 38 to ".jpg" instead.
>
> Let us know if you have any trouble with it!
>
> Regards,
> Curtis
>
>
> On Thu, Apr 18, 2013 at 3:17 AM, Lars Damgaard <
[hidden email]> wrote:
>
> > Hi all,
> >
> > I hope someone can help me understand this:
> > I have a folder with 40 zvi files that I want to convert to jpg files.
> > I figure from searching documentation that I should use Batch
> > Converter. When I select Batch Converter, I get a Batch Convert
> > dialog as expected that allows me to select input and output folder,
> > Output format, Interpolation, and Scale factor.
> > However, when I press the Convert button, I get a Bio-Formats Import
> > Options dialog, which has a lot of options.
> > If I try to choose options and press OK, this dialog is followed by
> > a Bio-Formats File Stitching dialog.
> > If I OK this File Stitching dialog, I can see in the status bar that
> > ImageJ apparently is working its way through all files, but then the
> > Bio-Format Import Options dialog re-appears, followed by the
> > Bio-Formats File Stitching dialog. Depending on my choices I also
> > get an Import Data dialog. For each file, I get a log window that writes:
> > IJ.openImage() returned null:
> > C:\Users\lrd\Desktop\zvi-files\Position(1).zvi
> > IJ.openImage() returned null:
> > C:\Users\lrd\Desktop\zvi-files\Position(10).zvi
> > ...
> > etc.
> > In the end, no matter if I OK or cancel any of the dialogs, some
> > open files are created in ImageJ, but my output folder is empty. I
> > have not managed to make my selections so that the open created
> > files are the simple jpg files I want, rather they are separated out
> > in color channels or other advanced views, but in any case I was
> > expecting that the zvi files were batch converted and the resulting
> > jpgs would go to
> the output folder.
> > Any suggestions as to how to achieve this?
> >
> > Lars
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>