public static WritableRaster RGBToCIEXYZ(Raster src,
                                             int[] srcComponentSize,
                                             WritableRaster dest,
                                             int[] destComponentSize) {

        checkParameters(src, srcComponentSize, dest,destComponentSize) ;

        SampleModel srcSampleModel = src.getSampleModel() ;

	// if the srcComponentSize is not provided, use the sample sizes
	// from the source's sample model
        if (srcComponentSize == null)
            srcComponentSize = srcSampleModel.getSampleSize() ;

	// if the destination raster is not provided, create a new one
        if (dest == null) {
            Point origin = new Point(src.getMinX(), src.getMinY()) ;
            dest = RasterFactory.createWritableRaster(srcSampleModel,
                                        	      origin) ;
        }

        SampleModel dstSampleModel = dest.getSampleModel() ;

	//if the destComponentSize is not provided, use the sample sizes
	//from the destination's sample model
        if (destComponentSize == null)
            destComponentSize = dstSampleModel.getSampleSize() ;

        PixelAccessor srcAcc = new PixelAccessor(srcSampleModel, null) ;
        UnpackedImageData srcUid = srcAcc.getPixels(src, src.getBounds(),
                                    srcSampleModel.getDataType(),
                                    false) ;

        switch (srcSampleModel.getDataType()) {

        case DataBuffer.TYPE_BYTE:
             RGBToCIEXYZByte(srcUid, srcComponentSize, dest, destComponentSize) ;
             break ;
        case DataBuffer.TYPE_USHORT:
        case DataBuffer.TYPE_SHORT:
             RGBToCIEXYZShort(srcUid, srcComponentSize, dest, destComponentSize) ;
             break ;
        case DataBuffer.TYPE_INT:
             RGBToCIEXYZInt(srcUid, srcComponentSize, dest, destComponentSize) ;
             break ;
        case DataBuffer.TYPE_FLOAT:
             RGBToCIEXYZFloat(srcUid, srcComponentSize, dest, destComponentSize) ;
             break ;
        case DataBuffer.TYPE_DOUBLE:
             RGBToCIEXYZDouble(srcUid, srcComponentSize, dest, destComponentSize) ;
             break ;
        }

	return dest ;
    }