Hi all, I have got a question:
In my project I need to display data from a reconstruction in the form of some
images. The data is in a big array (Unsigned Shorts)

I thought that I could just create a big Raster containing all of the data (a
N*(M*N) image), where N is the size of an individual image, and M is the number
of images. And than create subimages by calling
.createChild(0,index*N,N,N,0,0,null) to get the image numbered index.

Here is a piece of the code :
WriteableRaster wr,w1,w2,w3,w4;
wr=Raster.createInterleavedRaster(short_db,w,4*h,w,1,bandOffsets,null);
w1=(wr.createChild(0,0,w,h,0,0,null)).createWritableRaster(wr.getSampleModel(),null);
w2=(wr.createChild(0,0,w,h,0,0,null)).createWritableRaster(wr.getSampleModel(),null);
w3=(wr.createChild(0,0,w,h,0,0,null)).createWritableRaster(wr.getSampleModel(),null);
w4=(wr.createChild(0,0,w,h,0,0,null)).createWritableRaster(wr.getSampleModel(),null);

ColorSpace cs=ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] bits={16};
ComponentColorModel cm=new 
ComponentColorModel(cs,bits,false,false,Transparency.OPAQUE,DataBuffer.TYPE_USHORT);
BufferedImage one=new BufferedImage(cm,w1,cm.isAlphaPremultiplied(),null);
BufferedImage two=new BufferedImage(cm,w2,cm.isAlphaPremultiplied(),null);
BufferedImage three=new BufferedImage(cm,w3,cm.isAlphaPremultiplied(),null);
BufferedImage four=new BufferedImage(cm,w4,cm.isAlphaPremultiplied(),null);


But now all four images are just black..
Does anybody know what I am doing wrong ???

Reply via email to