Re: Problem with PlugIn
Posted by
Michael Schmid on
Apr 23, 2008; 2:36pm
URL: http://imagej.273.s1.nabble.com/Problem-with-PlugIn-tp3696466p3696467.html
Hi Sebastian,
the pixels array is never double[].
For 8-bit images it is byte[], for 16-bit short[], for RGB int[]
and for 32-bit float[].
Michael
________________________________________________________________
On 23 Apr 2008, at 16:29, Sebastian Rhode wrote:
> Hi all,
>
> I am pretty new to Java and may need your help (so my problem may be a
> simple one). Here is part of the code
>
> ...
> ImagePlus imp_dst = WindowManager.getImage(wList[file0]);
> ImageStack imst_dst = imp_dst.getStack();
> double[] pixels;
> ...
> // get the pixels of each slice in the stack
> for (int i=1; i<=imst_dst.getSize(); i++) {
> pixels = (double[]) imst_dst.getPixels(i);
> ...
>
> The PlugIn compiles without any Problem. The stack which is open
> contains
> four 16bit pictures (512x512). I get the follwong error meassage:
>
> java.lang.ClassCastException: [S cannot be cast to [D
> at calcCCD_noise3.run(calcCCD_noise3.java:73)
> at ij.IJ.runUserPlugIn(IJ.java:158)
> at ij.ImageJ.runUserPlugIn(ImageJ.java:232)
> at ij.plugin.PlugInExecuter.run(Compiler.java:239)
> at java.lang.Thread.run(Unknown Source)
>
> I am using ImageJ 1.40g and Java 1.6.0_04. Any ideas?
>
> Thanks,
>
> Sebastian