Re: File Conversion bug and Batch Converter
Posted by
Wayne Rasband on
Feb 10, 2009; 3:51pm
URL: http://imagej.273.s1.nabble.com/12-and-14-bit-PNGs-in-imageJ-tp3693766p3693768.html
> Hello again listmates,
>
> If I try to convert 16bit color images into 8bit grayscale by doing
> "image>type>8bit" I get an RGB stack instead.
The Image>Type>8-bit command converts 16-bit composite color images
(e.g., 48-bit RGB TIFFs) into 8-bit composite color images. You can use
Image>Type>RGB Color followed by Image>Type>8-bit to convert a
composite color image into an 8-bit grayscale image.
> The way I found around that is doing "image, color, stack to rgb"
> followed by "image, type, 8bit".
>
> Shouldn't I be able to convert directly? Maybe its a bug...
>
> Also, I tried to apply the batch converter plugin to convert all the
> files from a folder to 8bit-TIFF and this is what I get:
There is an updated version of the Batch_Converter plugin at
http://rsb.info.nih.gov/ij/plugins/batch-converter.htmlthat fixed this bug.
-wayne
> java.lang.ClassCastException: [S cannot be cast to [B
> at ij.io.ImageWriter.write8BitStack(ImageWriter.java:38)
> at ij.io.ImageWriter.write(ImageWriter.java:214)
> at ij.io.TiffEncoder.write(TiffEncoder.java:118)
> at ij.io.TiffEncoder.write(TiffEncoder.java:138)
> at ij.io.FileSaver.saveAsTiffStack(FileSaver.java:126)
> at ij.io.FileSaver.saveAsTiff(FileSaver.java:79)
> at ij.plugin.filter.Writer.run(Writer.java:20)
> at
> ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.
> java:245)
> at
> ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
> at ij.IJ.runPlugIn(IJ.java:151)
> at ij.Executer.runCommand(Executer.java:119)
> at ij.Executer.run(Executer.java:58)
> at ij.IJ.run(IJ.java:241)
> at ij.IJ.run(IJ.java:284)
> at ij.IJ.saveAs(IJ.java:1312)
> at ij.IJ.saveAs(IJ.java:1249)
> at Batch_Converter.convert(Batch_Converter.java:59)
> at Batch_Converter.run(Batch_Converter.java:26)
> at ij.IJ.runUserPlugIn(IJ.java:176)
> at ij.IJ.runPlugIn(IJ.java:142)
> at ij.Executer.runCommand(Executer.java:119)
> at ij.Executer.run(Executer.java:58)
> at java.lang.Thread.run(Thread.java:619)
>