Package javax.media.jai

Examples of javax.media.jai.PlanarImage


    /**
     * Return the number of bits per pixel in the source image.
     * Floating point images are denoted by -32 for float, or -64 for double.
     */
    public int getBitsPerPixel() {
        PlanarImage im = imageProcessor.getSourceImage();
        if (im != null) {
            SampleModel sm = im.getSampleModel();
            int dataType = sm.getDataType();
            int bitpix = sm.getSampleSize(0);
            if (dataType == DataBuffer.TYPE_FLOAT || dataType == DataBuffer.TYPE_DOUBLE) {
                return -bitpix;
            }
View Full Code Here


            // try to extract the pixel value under the mouse and display it
            p = new Point2D.Double(e.getX(), e.getY());
            imageDisplay.getCoordinateConverter().screenToUserCoords(p, false);
            float pixel = imageDisplay.getPixelValue(p, 0);

            PlanarImage im = imageProcessor.getRescaledSourceImage();
            if (im != null) {
                SampleModel sampleModel = im.getSampleModel();
                if (sampleModel != null) {
//                    int dataType = sampleModel.getDataType();
                    if (pixel == imageProcessor.getBlank()) {
                        valueValue.setText("blank");
                    } else {
View Full Code Here

    public int getImageWidth() {
        if (_fitsImage != null) {
            return _fitsImage.getRealWidth();
        }

        PlanarImage image = getImage();
        if (image != null) {
            return image.getWidth();
        }
        return 0;
    }
View Full Code Here

    public int getImageHeight() {
        if (_fitsImage != null) {
            return _fitsImage.getRealHeight();
        }

        PlanarImage image = getImage();
        if (image != null) {
            return image.getHeight();
        }
        return 0;
    }
View Full Code Here

            if (!_noInitWCS) {
                _wcs = null;
            }
        } else {            // after loading image
            _affineTransform = getAffineTransform();
            PlanarImage im = getImage();
            if (im != null) {
                // Check if it is a FITS image, and if so, get the FITSImage object,
                // which is needed to initialize WCS and check for FITS extensions.
                Object o = im.getProperty("#fits_image");
                if (o != null && (o instanceof FITSImage)) {
                    _fitsImage = (FITSImage) o;
                    // Check for WCS
                    if (!_noInitWCS) {
                        initWCS();
View Full Code Here

     * @param band the bad of the image (0 for FITS files)
     */
    public float getPixelValue(Point2D.Double p, int band) {
        // get the "rescaled" image, so the values displayed are after applying
        // BSCALE and BZERO, if applicable
        PlanarImage im = _imageProcessor.getRescaledSourceImage();
        if (im != null) {
            return _getPixelValue(im, (int) p.getX(), (int) p.getY(),
                    getImageWidth(), getImageHeight(),
                    band);
        }
View Full Code Here

     * @param band the band of the image to get
     */
    public float[] getPixelValues(Rectangle region, int band) {
        // get the "rescaled" image, so the values displayed are after applying
        // BSCALE and BZERO, if applicable
        PlanarImage im = _imageProcessor.getRescaledSourceImage();
        if (im != null) {
            float[] ar = new float[region.width * region.height];
            int w = im.getWidth(), h = im.getHeight();
            int n = 0;
            int minX = region.x,
                    minY = region.y,
                    maxX = minX + region.width - 1,
                    maxY = minY + region.height - 1;
View Full Code Here

    /**
     * Transform the graphics in the foreground layer according to the current
     * image transformations.
     */
    protected void transformGraphics() {
        PlanarImage im = _imageProcessor.getSourceImage();
        if (im == null) {
            return;
        }

        // need to first reverse previous transform, so that we can move the
View Full Code Here

                ri = new RawImage(f);
            } catch (PhotovaultException ex) {
                fail( ex.getMessage() );
            }

            PlanarImage thumbImage = new RenderedImageAdapter( ri.getRenderedImage( 200, 200, true ) );

            JPEGEncodeParam encodeParam = new JPEGEncodeParam();
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", os,
                    encodeParam);
            try {
                encoder.encode( thumbImage );
                os.close();
                // origImage.dispose();
                thumbImage.dispose();
            } catch (Exception e) {
                fail( "Error writing thumbnail: " + e.getMessage() );
            }
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
View Full Code Here

    public void processFile(File file, File newFile) {
        try {
            log("Processing File: " + file.getAbsolutePath());

            FileSeekableStream input = null;
            PlanarImage image = null;
            try {
                input = new FileSeekableStream(file);
                image = JAI.create("stream", input);
                final int size = instructions.size();
                for (int i = 0; i < size; i++) {
View Full Code Here

TOP

Related Classes of javax.media.jai.PlanarImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.