Recreate Image from DCT coefficients

Does anyone know how to recreate the image from its dct coefficients (dctData)?

rgbImage = JAI.create("fileload", filename);

rgbWidth = rgbImage.getWidth();

rgbHeight = rgbImage.getHeight();

//dct

ParameterBlock pbDCT = (new ParameterBlock()).addSource(rgbImage);

PlanarImage dct;

dct = JAI.create("dct", pbDCT,null);

double[] dctData = dct.getData().getPixels(0, 0, rgbWidth, rgbHeight, (double[])null);

[716 byte] By [axelinux@hotmail.coma] at [2007-11-26 12:21:50]
# 1

I found out that i can recreate the image from its pixels by using this

[CODE]MemoryImageSource imSource = new MemoryImageSource(rgbWidth, rgbHeight, dctData, 0, rgbWidth);[/CODE]

However i get the following error

The method createImage(MemoryImageSource) is undefined for the type ImageProcessingJAIDCT

I have changed dctData to int[] and imported everything from http://www.cs.cmu.edu/~illah/HOWTO/javaimage.txt

axelinux@hotmail.coma at 2007-7-7 15:14:13 > top of Java-index,Archived Forums,Socket Programming...
# 2

I also tried the following codes but the image i gain is just grayscale spots..

DataBuffer buffer = new DataBufferInt(dctData, dctData.length);

int[] bitMasks = {0xff0000, 0xff00, 0xff, 0xff000000}; //r, g, b, a

SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, rgbWidth, rgbHeight, bitMasks);

WritableRaster raster = Raster.createWritableRaster(sm, buffer, null);

ColorModel cm = ColorModel.getRGBdefault();

BufferedImage bi = new BufferedImage(cm, raster, false, null);

//idct

ParameterBlock pbIDCT = (new ParameterBlock()).addSource(bi);

PlanarImage idct = JAI.create("idct", pbIDCT, null);

and

BufferedImage outImage = new BufferedImage(rgbWidth, rgbHeight, BufferedImage.TYPE_BYTE_GRAY );

outImage.setRGB(0, 0, rgbWidth, rgbHeight, dctData, 0, rgbWidth);

ParameterBlock pbIDCT = (new ParameterBlock()).addSource(outImage);

PlanarImage idct = JAI.create("idct", pbIDCT, null);

axelinux@hotmail.coma at 2007-7-7 15:14:13 > top of Java-index,Archived Forums,Socket Programming...