Hi Denis:

   It seems like what you really want to create is a BandedRaster,
   by using Raster.createBandedRaster().

   Your code now is creating a Raster with a PixelInterleavedSampleModel,
   one where the data is organized as ABCDABCDABCD....., where A,B,C,D are the
   samples of each band. A BandedSampleModel organizes the data as
   all samples of band A, followed by all samples of band B, etc, which
   I think is what you were trying to do. The data can be in a single
   bank, with band indices indicating the starting points of each band,
   or in multiple banks, with band indices most likely to all be zero.

   Also, all your createChild() calls in you example were identical,
   (maybe a typo for this email ?).
   They need to indicate where each child is located in the parent
   raster.

Hope this helps,
Link Perry
__________________________________________________________________________
Lincoln Perry                    Computer Systems Imaging Technology Group
Sun Microsytems, Inc             Phone: (650) 786-0117 (80117 internal)
901 San Antonio Rd. UMPK27-302   Fax:   (650) 786-5852
Palo Alto, CA 94303-4900         [EMAIL PROTECTED]



>Date: Thu, 17 Jun 1999 15:06:03 +0200
>From: Denis Riedijk <[EMAIL PROTECTED]>
>Subject: BufferedImage and WriteableRaster problems
>To: [EMAIL PROTECTED]
>
>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_USHO
RT);
>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