当前位置: 首页>>代码示例>>Java>>正文


Java Header.getIntValue方法代码示例

本文整理汇总了Java中nom.tam.fits.Header.getIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java Header.getIntValue方法的具体用法?Java Header.getIntValue怎么用?Java Header.getIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nom.tam.fits.Header的用法示例。


在下文中一共展示了Header.getIntValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isImageGood

import nom.tam.fits.Header; //导入方法依赖的package包/类
private static boolean isImageGood(Header aHeader) {

        int naxis = aHeader.getIntValue("NAXIS", -1);
        boolean goodImage = true;
        if (naxis == 0) {
            goodImage = false;
        } else {
            for (int i = 1; i <= naxis; i++) {
                int naxisValue = aHeader.getIntValue("NAXIS" + i, -1);

                if (naxisValue == 0) {
                    goodImage = false;
                    break;
                }
            }
        }
        return goodImage;
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:19,代码来源:FitsRead.java

示例2: splitFitsCube

import nom.tam.fits.Header; //导入方法依赖的package包/类
private static BasicHDU[] splitFitsCube(ImageHDU hdu)
        throws FitsException {

    Header header = hdu.getHeader();
    int bitpix = header.getIntValue("BITPIX", -1);

    if (!SUPPORTED_BIT_PIXS.contains(new Integer(bitpix))) {
        System.out.println("Unimplemented bitpix = " + bitpix);
    }


    int naxis3 = header.getIntValue("NAXIS3", 0);
    float[][][] data32 = (float[][][]) ArrayFuncs.convertArray(hdu.getData().getData(), Float.TYPE, true);

    BasicHDU[] hduList = new BasicHDU[naxis3];
    for (int i = 0; i < naxis3; i++) {
        hduList[i] = makeHDU(hdu,data32[i] );
        hdu.addValue("SPOT_PL", i + 1, "PLANE OF FITS CUBE (IN SPOT)");
        hdu.getHeader().resetOriginalSize();
     }

    return hduList;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:24,代码来源:FitsRead.java

示例3: updateForWrite

import nom.tam.fits.Header; //导入方法依赖的package包/类
public void updateForWrite(Header hdr, Map<String, String> parameters)
        throws FitsException {

    int bitpix = hdr.getIntValue("ZBITPIX", -1);

    int block;
    if (!parameters.containsKey("block")) {
        parameters.put("block", "" + 32);
        block = 32;
    } else {
        block = Integer.parseInt(parameters.get("block"));
    }

    hdr.addValue("ZNAME1", "BLOCKSIZE", "Compression region size");
    hdr.addValue("ZVAL1", block, "Compression region size");

    hdr.addValue("ZNAME2", "BYTEPIX", "Bytes in pixel");
    if (bitpix > 0) {
        parameters.put("bitpix", "" + bitpix);
        hdr.addValue("ZVAL2", bitpix / 8, "Bytes in pixel");
    } else {
        parameters.put("bitpix", "32");
        hdr.addValue("ZVAL2", 4, "Bytes in pixel");
    }
}
 
开发者ID:jankotek,项目名称:asterope,代码行数:26,代码来源:Rice.java

示例4: backgroundWork

import nom.tam.fits.Header; //导入方法依赖的package包/类
@Override
protected PfssData backgroundWork() {
    try (NetClient nc = NetClient.of(url); Fits fits = new Fits(nc.getStream())) {
        BasicHDU<?> hdus[] = fits.read();
        if (hdus == null || hdus.length < 2 || !(hdus[1] instanceof BinaryTableHDU))
            throw new Exception("Could not read FITS: " + url);

        BinaryTableHDU bhdu = (BinaryTableHDU) hdus[1];
        Header header = bhdu.getHeader();

        String dateFits = header.getStringValue("DATE-OBS");
        if (dateFits == null)
            throw new Exception("DATE-OBS not found: " + url);
        JHVDate date = new JHVDate(dateFits);
        if (time != date.milli)
            throw new Exception("Inconsistent DATE-OBS. Expected " + new JHVDate(time) + ", got " + date + ": " + url);

        int points = header.getIntValue("HIERARCH.POINTS_PER_LINE");
        if (points == 0)
            throw new Exception("POINTS_PER_LINE not found: " + url);

        short[] flinex = (short[]) bhdu.getColumn("FIELDLINEx");
        short[] fliney = (short[]) bhdu.getColumn("FIELDLINEy");
        short[] flinez = (short[]) bhdu.getColumn("FIELDLINEz");
        short[] flines = (short[]) bhdu.getColumn("FIELDLINEs");
        if (flinex.length != fliney.length || flinex.length != flinez.length || flinex.length != flines.length)
            throw new Exception("Fieldline arrays not equal " + flinex.length + " " + fliney.length + " " + flinez.length + " " + flinex.length + ": " + url);

        return new PfssData(date, flinex, fliney, flinez, flines, points);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:35,代码来源:PfssDataLoader.java

示例5: isCropable

import nom.tam.fits.Header; //导入方法依赖的package包/类
static public boolean isCropable(Fits fits)
   {
BasicHDU hdus[];
try
{
    hdus = fits.read();
}
catch (FitsException fe)
{
    return(false);
}
if (hdus.length > 1)
{
    return (false);
}
Header header = hdus[0].getHeader();
int naxis = header.getIntValue("NAXIS");
if (naxis < 3)
{
    return (true);
}
int naxis3 = header.getIntValue("NAXIS3");
if (naxis3 > 1)
{
    return (false);
}
else
{
    return (true);
}
   }
 
开发者ID:lsst,项目名称:firefly,代码行数:32,代码来源:CropFile.java

示例6: validateNaxis

import nom.tam.fits.Header; //导入方法依赖的package包/类
public static void validateNaxis(Header header) throws FitsException {
int naxis = header.getIntValue("NAXIS", 0);
int naxis1 = header.getIntValue("NAXIS1", 0);
if ((naxis <= 1) && (naxis1 <= 1))
{
    throw new FitsException(
	"degenerate image:  NAXIS = " + naxis + "  and NAXIS1 = " +
	naxis1);
}
   }
 
开发者ID:lsst,项目名称:firefly,代码行数:11,代码来源:FitsValidator.java

示例7: getImageData

import nom.tam.fits.Header; //导入方法依赖的package包/类
private ImageData getImageData(Header header, float[] float1d){
    int naxis1 = header.getIntValue("NAXIS1");
    int naxis2 = header.getIntValue("NAXIS2");
    int dims2[] = new int[]{naxis1, naxis2};
    float [][]  data =  (float[][]) ArrayFuncs.curl(float1d,dims2);
    ImageData imageData= new ImageData(data);
    return imageData;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:9,代码来源:FitsRead.java

示例8: WCS

import nom.tam.fits.Header; //导入方法依赖的package包/类
/**
 * Create the WCS using the definition given in the FITS header.
 */
public WCS(Header h) throws TransformationException {

    wcsKeys = new HashMap<String, Object>();

    this.h = h;
    headerNaxis = new int[2];
    if (checkDSS()) {
        headerNaxis[0] = h.getIntValue("NAXIS1");
        headerNaxis[1] = h.getIntValue("NAXIS2");
        if (headerNaxis[0] == 0) {
            headerNaxis[0] = h.getIntValue("XPIXELS");
            headerNaxis[1] = h.getIntValue("YPIXELS");
        }
        doDSSWCS();
        stdWCS = false;

    } else if (checkNeat()) {
        headerNaxis[0] = h.getIntValue("NAXIS1");
        headerNaxis[1] = h.getIntValue("NAXIS2");
        doNeatWCS();
        stdWCS = false;


    } else {  // More or less standard FITS WCS

        getAxes();
        if (lonAxis == -1 || latAxis == -1) {
            throw new TransformationException("Unable to find coordinate axes");
        }
        headerNaxis[0] = h.getIntValue("NAXIS" + lonAxis);
        headerNaxis[1] = h.getIntValue("NAXIS" + latAxis);
        extractCoordinateSystem();
        extractProjection();
        extractScaler();
    }
}
 
开发者ID:jankotek,项目名称:asterope,代码行数:40,代码来源:WCS.java

示例9: crop_extensions

import nom.tam.fits.Header; //导入方法依赖的package包/类
/**
   * Crop images from a FITS file with extensions, given image coordinates
   * Read the images directly from the FITS file on disk and write the
   * output to disk
   * @param in_filename FITS file on disk
   * @param out_filename output FITS file on disk
   * @param min_x first pixel of crop box
   * @param min_y first line of crop box
   * @param max_x last pixel of crop box
   * @param max_y last line of crop box
   */

   static public void crop_extensions(String in_filename, String out_filename,
int min_x, int min_y, int max_x, int max_y)
throws FitsException, IOException
   {
Fits in_fits = new Fits(in_filename);
Fits out_fits = new Fits();

int x_center = (min_x + max_x ) / 2;
int y_center = (min_y + max_y ) / 2;
int x_size = Math.abs(max_x - min_x);
int y_size = Math.abs(max_y - min_y);

int extension = 0;
while (true)
{
    BasicHDU hdu = in_fits.getHDU(extension);
    BasicHDU new_hdu;
    if (hdu == null)
	break;
    if (hdu instanceof ImageHDU)
    {
	ImageHDU h = (ImageHDU) hdu;
	Header old_header = h.getHeader();
	int naxis = old_header.getIntValue("NAXIS");
	if (naxis == 0)
	{
	    /* it's a null image - probably the primary image */
	    new_hdu = hdu;
	}
	else
	{
	    Fits temp_fits = common_crop(h, old_header, 
		x_center, y_center, x_size, y_size);
	    new_hdu = temp_fits.getHDU(0);
	}
    }
    else
    {
	/* not an ImageHDU - just copy input to output */
	new_hdu = hdu;
    }
    out_fits.addHDU(new_hdu);
    extension++;
}

FileOutputStream fo = new java.io.FileOutputStream(out_filename);
BufferedDataOutputStream o = new BufferedDataOutputStream(fo);
out_fits.write(o);
   }
 
开发者ID:lsst,项目名称:firefly,代码行数:62,代码来源:CropFile.java

示例10: validateOther

import nom.tam.fits.Header; //导入方法依赖的package包/类
public static void validateOther(Header header) throws FitsException {
int bitpix = header.getIntValue("BITPIX");
if ((bitpix < 0) && (header.containsKey("BLANK")))
    throw new FitsException(
	"illegal to have BLANK in a floating point image");
   }
 
开发者ID:lsst,项目名称:firefly,代码行数:7,代码来源:FitsValidator.java

示例11: getHDUList

import nom.tam.fits.Header; //导入方法依赖的package包/类
private static ArrayList<BasicHDU> getHDUList(BasicHDU[] HDUs) throws FitsException {
    ArrayList<BasicHDU> HDUList = new ArrayList<BasicHDU>();

    boolean hasExtension = HDUs.length > 1 ? true : false;
    for (int j = 0; j < HDUs.length; j++) {
        if (!(HDUs[j] instanceof ImageHDU)) {
            continue;   //ignor non-image extensions
        }
        //process image HDU
        Header header = HDUs[j].getHeader();
        if (header == null)
            throw new FitsException("Missing header in FITS file");



        int naxis = header.getIntValue("NAXIS", -1);
        boolean goodImage = isImageGood(header);

        if (goodImage) {
            if (hasExtension) { // update this hdu by adding keywords/values
                updateHeader(header, j, HDUs[j].getFileOffset());
            }

            int naxis3 = header.getIntValue("NAXIS3", -1);
            if ((naxis > 2) && (naxis3 > 1)) { //it is a cube data
                if (SUTDebug.isDebug())
                    System.out.println("GOT A FITS CUBE");
                BasicHDU[] splitHDUs = splitFitsCube( (ImageHDU) HDUs[j]);
                /* for each plane of cube */
                for (int jj = 0; jj < splitHDUs.length; jj++) {
                    HDUList.add(splitHDUs[jj]);
                }
            } else {
                HDUList.add(HDUs[j]);
            }
        }

        //when the header is added to the new fits file, the card number could be increased if the header is a primary
        //header.resetOriginalSize();

    } //end j loop
    return HDUList;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:44,代码来源:FitsRead.java

示例12: SIPDistorter

import nom.tam.fits.Header; //导入方法依赖的package包/类
/** Create a distorter from a FITS header.
 *  We will look for A_ORDER, B_ORDER, An_m and Bn_m
 *  keywords.  If AP_ORDER and BP_ORDER are found
 *  and the SIPUseInversion setting is set, then
 *  we will also look for APn_m and BPn_m for
 *  the inverse distortion.
 */
public SIPDistorter(Header h) {
    try {
        ncoefx = h.getIntValue("A_ORDER", -1);
        ncoefy = h.getIntValue("B_ORDER", -1);
        if (ncoefx < 0 || ncoefy < 0) {
            throw new IllegalArgumentException("No coefficients defined");
        }
        nicoefx = h.getIntValue("AP_ORDER", -1);
        nicoefy = h.getIntValue("BP_ORDER", -1);
        if (nicoefx < 0 || nicoefy < 0) {
            nicoefx = 0;
            nicoefy = 0;
            invert = false;
        } else {
            invert = Settings.has("SIPUseInversion");
        }
        coefx = new double[ncoefx-1][];  // Don't need 0 and first order
        coefy = new double[ncoefy-1][];
        for (int order = 2; order <= ncoefx; order += 1) {
            coefx[order-2] = getCoefs(h, "A", order);                
        }
        for (int order = 2; order <= ncoefy; order += 1) {
            coefy[order-2] = getCoefs(h, "B", order);
        }
        
        if (invert) {
            icoefx = new double[nicoefx][];  // Done need 0 order
            icoefx = new double[nicoefy][];
            for (int order=1; order<nicoefx; order += 1) {
                icoefx[order-1] = getCoefs(h, "AP", order);
            }
            for (int order=1; order<nicoefy; order += 1) {
                icoefy[order-1] = getCoefs(h, "BP", order);
            }
        } else {
            getDeriv();            
        }  
    } catch (Exception e) {
        throw new IllegalArgumentException("Invalid FITS header: "+e);
    }
}
 
开发者ID:jankotek,项目名称:asterope,代码行数:49,代码来源:SIPDistorter.java

示例13: TiledImageHDU

import nom.tam.fits.Header; //导入方法依赖的package包/类
/**
 * Create a tiled image HDU from an existing Image HDU.
 */
public TiledImageHDU(ImageHDU input, Map<String, String> parameters) throws FitsException,
        IOException {
    super(coreHeader(), nilData());

    hdr = getHeader();  // Get a local reference to the Header.
    String comp = parameters.get("compression");

    imageSize = input.getAxes();
    naxis = imageSize.length;
    if (naxis == 0 || imageSize[0] == 0) {
        throw new FitsException("Cannot compress nil image");
    }
    String tiling = parameters.get("tiling");
    if (tiling == null) {
        tiling = imageSize[0] + "";
        for (int i = 1; i < imageSize.length; i += 1) {
            tiling += ",1";
        }
    }
    String[] fields = tiling.split(",");
    if (fields.length != imageSize.length) {
        throw new FitsException("Tile dimensionality (" + fields.length + ") must match image (" + imageSize.length + ")");
    }
    tileSize = new int[imageSize.length];
    for (int i = 0; i < imageSize.length; i += 1) {
        tileSize[i] = Integer.parseInt(fields[i].trim());
    }

    Header old = input.getHeader();
    // Position the insertion pointer after the TFORM1.
    hdr.getStringValue("TFORM1");


    cs = getCompression(comp);
    insertTileKeywords(old, cs, parameters, imageSize, tileSize);

    Object kern = input.getKernel();

    int bitpix = old.getIntValue("BITPIX");
    zbitpix = bitpix;
    if (bitpix < 0) {
        RealStats rs = new RealStats(kern);
        double offset = rs.min;
        double scale = rs.noise3 / 16;
        double bits = Math.log((rs.max - rs.min) / scale) / Math.log(2);
        insertQuantizerKeywords(offset, scale);
        if (bits > 30) {
            throw new IllegalStateException("Cannot quantize image, noise too large");
        }

        quant = new Quantizer(scale, offset);
    }


    Cursor newPointer = hdr.iterator();
    newPointer.setKey("END");
    Cursor oldPointer = old.iterator();
    oldPointer.setKey("BITPIX");

    copyOldKeywords(oldPointer, newPointer);
    TileLooper tl = new TileLooper(imageSize, tileSize);
    cs.initialize(parameters);
    populateData(kern, bitpix, tl, cs);
}
 
开发者ID:jankotek,项目名称:asterope,代码行数:68,代码来源:TiledImageHDU.java


注:本文中的nom.tam.fits.Header.getIntValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。