Examples of FITSImage


Examples of jsky.image.fits.codec.FITSImage

    /**
     * Delete the table HDU with the given name, if found.
     */
    public void deleteHDU(String extName) {
        FITSImage fitsImage = imageDisplay.getFitsImage();
        int n = fitsImage.getNumHDUs();
        for (int i = 0; i < n; i++) {
            BasicHDU hdu = fitsImage.getHDU(i);
            if (hdu instanceof TableHDU) {
                Header header = hdu.getHeader();
                String name = header.getStringValue("EXTNAME");
                if (name != null && name.equals(extName)) {
                    try {
                        fitsImage.getFits().deleteHDU(i);
                    } catch (Exception e) {
                        DialogUtil.error(e);
                    }
                    return;
                }
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

    /**
     * Display the FITS table at the given HDU index.
     */
    public void displayFITSTable(int hduIndex) {
        FITSImage fitsImage = getFitsImage();
        if (fitsImage != null && hduIndex > 0 && hduIndex < fitsImage.getNumHDUs()) {
            try {
                TableQueryResult table = NavigatorFITSTable.getTable(getFilename(), fitsImage.getFits(), hduIndex);
                showNavigatorFrame(null);
                openCatalogWindow(table.getCatalog());

                // update the FITS header display, if needed
                FITSKeywordsFrame fitsKeywordsFrame = getFitsKeywordsFrame();
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

    /**
     * Deletes the FITS table at the given HDU index.
     */
    public void deleteFITSTable(int hduIndex) {
        FITSImage fitsImage = getFitsImage();
        if (fitsImage != null && hduIndex > 0 && hduIndex < fitsImage.getNumHDUs()) {
            try {
                NavigatorFITSTable.deleteTable(fitsImage.getFits(), hduIndex);
                setSaveNeeded(true);
            } catch (Exception e) {
                DialogUtil.error(e);
            }
        }
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

     * Save (or update) the given table as a FITS table in the current FITS image.
     *
     * @param table the table to save in the FITS image in a FITS table HDU
     */
    public void saveFITSTable(TableQueryResult table) {
        FITSImage fitsImage = getFitsImage();
        if (fitsImage == null) {
            DialogUtil.error(this, "This operation is only supported on FITS files.");
            return;
        }

        try {
            TableQueryResult newTable = NavigatorFITSTable.saveWithImage(getFilename(), fitsImage.getFits(), table);
            if (newTable == null) {
                return;
            }

            setSaveNeeded(true);
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

                }

                // If this is the first time this image is being visited this session,
                // plot any catalog tables stored as FITS tables
                String filename = getFilename();
                FITSImage fitsImage = getFitsImage();
                if (fitsImage != null && filename != null) {
                    if (!_filesVisited.contains(filename)) {
                        _filesVisited.add(filename);
                        try {
                            NavigatorFITSTable.plotTables(filename, fitsImage.getFits(), _navigator);
                        } catch (Exception e) {
                            DialogUtil.error(this, e);
                        }
                    }
                }
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

        float w = im.getWidth(), h = im.getHeight();
        Object o = im.getProperty("#preview_image");
        if (o != null && o instanceof PlanarImage) {
            // The preview image is scaled down by an integer value, sich as 1/2x, 1/3x, ...
            PlanarImage preview = (PlanarImage) o;
            FITSImage fitsImage = (FITSImage) im.getProperty("#fits_image");
            if (fitsImage != null) {
                w = fitsImage.getRealWidth();
                h = fitsImage.getRealHeight();
            }
            scale = Math.min(preview.getWidth() / w, preview.getHeight() / h);
            _imageDisplay.setScale(scale);
            return preview;
        }
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

        Object o = _sourceImage.getProperty("#fits_image");

        _reverseY = false;
        _invertedYAxis = false;
        if (o instanceof FITSImage) {
            FITSImage fitsImage = (FITSImage) o;
            _invertedYAxis = fitsImage.isYFlipped();
            _reverseY = !_invertedYAxis;

            // check for BZERO and BSCALE keywords and, if needed, apply the values
            _bzero = fitsImage.getKeywordValue("BZERO", 0.);
            _bscale = fitsImage.getKeywordValue("BSCALE", 1.);
            _bitpix = fitsImage.getKeywordValue("BITPIX", 0);
            _rescaledSourceImage = rescaleImage(_sourceImage);

            // check for grayscale images
            // (Note: GIF images can have _numBands == 1 and IndexColorModel, which is already color)
            if (_numBands == 1 && ! (_sourceImage.getColorModel() instanceof IndexColorModel)) {
                // get value of blank or bad pixels
                _blank = fitsImage.getKeywordValue("BLANK", Float.NaN);
                if (Float.isNaN(_blank))
                    _blank = fitsImage.getKeywordValue("BADPIXEL", Float.NaN);
                if (!Float.isNaN(_blank)) {
                    // assume blank value needs to be rescaled in the same way as the image
                    // (the resulting image is float data, so make sure the "blank" value is treated the same)
                    _blank = _blank * (float) _bscale + (float) _bzero;
                }

                // min/max pixel values, if specified in image properties
                _dataMin = fitsImage.getKeywordValue("DATAMIN", 0.);
                _dataMax = fitsImage.getKeywordValue("DATAMAX", 0.);
                _dataMean = fitsImage.getKeywordValue("DATAMEAN", Double.NaN);
            }
        } else {
            _bzero = 0.;
            _bscale = 1.;
            _bitpix = 0;
View Full Code Here

Examples of jsky.image.fits.codec.FITSImage

    /**
     * Return the name of the source image, if known, otherwise an empty string.
     * (XXX or the file name, or URL, ... ?)
     */
    public String getObjectName() {
        FITSImage fitsImage = imageDisplay.getFitsImage();
        if (fitsImage != null) {
            Object prop = fitsImage.getProperty("OBJECT");
            if (prop instanceof String)
                return (String) prop;
        }
        return "";
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.