org.eso.fits
Class FitsMatrix

java.lang.Object
  extended by org.eso.fits.FitsData
      extended by org.eso.fits.FitsMatrix

public class FitsMatrix
extends FitsData

FitsMatrix class represents a FITS data matrix either as a prime HD unit or as an image extension.


Field Summary
 
Fields inherited from class org.eso.fits.FitsData
bitpix, changeData, dataArray, dataFile, dataOffset, isRAFile, naxis, noGroup, noParm, size, type
 
Constructor Summary
FitsMatrix(FitsHeader header, java.io.DataInput file, boolean sflag)
          Constructor for FitsMatrix class given a FITS prime matrix or an image extension header with associated data unit as a file.
FitsMatrix(int bitpix, int[] nax)
          Constructor for FitsMatrix class given definition of the matrix size and dimensions.
 
Method Summary
 double[] getCdelt()
          Gets step size for the axes (see CDELTn).
 double[] getCrpix()
          Gets reference pixel for the axes (see CRPIXn).
 double[] getCrval()
          Gets coordinate value for the reference pixel of the axes (see CRVALn).
 float[] getFloatValues(int offset, int size, float[] data)
          Read set of data values from the matrix as a float array.
 FitsHeader getHeader()
          Create and return a minimum FITS header for data Matrix.
 int[] getIntValues(int offset, int size, int[] data)
          Gets set of data points from the matrix as a int values.
 int getNoValues()
          Gets the total number of data values in the data matrix.
 short[] getShortValues(int offset, int size, short[] data)
          Gets set of data points from the matrix as a short values.
 FitsWCS getWCS()
          Gets the WCS object for the image.
 void setCdelt(double[] cd)
          Sets step size for the axes (see CDELTn).
 void setCrpix(double[] crp)
          Sets reference pixel for the axes (see CRPIXn).
 void setCrval(double[] crv)
          Sets coordinate value for the reference pixel of the axes (see CRVALn).
 void setFloatValues(int offset, float[] data)
          Store set of data values from a float array into the data matrix.
 void setIntValues(int offset, int[] idata)
          Store set of data values from an int array into the data matrix.
 void setShortValues(int offset, short[] sdata)
          Store set of data values from a short array into the data matrix.
 double[] toPixel(double[] wc)
          Compute pixel coordinates from a set of World Coordinates.
 double[] toWCS(double[] pix)
          Compute World Coordinates from pixel coordinates.
 
Methods inherited from class org.eso.fits.FitsData
closeFile, getNaxis, getNoAxes, getType, writeFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FitsMatrix

public FitsMatrix(FitsHeader header,
                  java.io.DataInput file,
                  boolean sflag)
           throws FitsException
Constructor for FitsMatrix class given a FITS prime matrix or an image extension header with associated data unit as a file.

Parameters:
header - FitsHeader object with the image header
file - RandomAccess file positioned at the start of the associated data unit
sflag - Flag for storing data matrix internally
Throws:
FitsException

FitsMatrix

public FitsMatrix(int bitpix,
                  int[] nax)
           throws FitsException
Constructor for FitsMatrix class given definition of the matrix size and dimensions.

Parameters:
bitpix - Bits per pixel for data values in matrix
nax - Array with dimensions of data matrix
Throws:
FitsException
Method Detail

getHeader

public FitsHeader getHeader()
Create and return a minimum FITS header for data Matrix.

Overrides:
getHeader in class FitsData

getShortValues

public short[] getShortValues(int offset,
                              int size,
                              short[] data)
                       throws FitsException
Gets set of data points from the matrix as a short values. Only FITS file with BITPIX 8, 16 and 32 are read.

Parameters:
offset - pixel offset within hte data matrix
size - no. of pixel values to be read
data - array which will hold the return values. If null an array of size is created.
Returns:
data[] array updated with pixel values
Throws:
FitsException

getIntValues

public int[] getIntValues(int offset,
                          int size,
                          int[] data)
                   throws FitsException
Gets set of data points from the matrix as a int values. Only FITS file with BITPIX 8, 16 and 32 are read.

Parameters:
offset - pixel offset within hte data matrix
size - no. of pixel values to be read
data - array which will hold the return values. If null an array of size is created.
Returns:
data[] array updated with pixel values
Throws:
FitsException

getFloatValues

public float[] getFloatValues(int offset,
                              int size,
                              float[] data)
                       throws FitsException
Read set of data values from the matrix as a float array. The values are returned as a float array.

Parameters:
offset - pixel offset within hte data matrix
size - no. of pixel values to be read
data - array which will hold the return values. If null an array of size is created.
Returns:
data[] array updated with pixel values
Throws:
FitsException

setShortValues

public void setShortValues(int offset,
                           short[] sdata)
                    throws FitsException
Store set of data values from a short array into the data matrix.

Parameters:
offset - pixel offset within the data matrix
sdata - array with values.
Throws:
FitsException

setIntValues

public void setIntValues(int offset,
                         int[] idata)
                  throws FitsException
Store set of data values from an int array into the data matrix.

Parameters:
offset - pixel offset within the data matrix
idata - array with data values.
Throws:
FitsException

setFloatValues

public void setFloatValues(int offset,
                           float[] data)
                    throws FitsException
Store set of data values from a float array into the data matrix.

Parameters:
offset - pixel offset within the data matrix
data - array with data values.
Throws:
FitsException

getNoValues

public int getNoValues()
Gets the total number of data values in the data matrix.


setCrpix

public void setCrpix(double[] crp)
Sets reference pixel for the axes (see CRPIXn).


getCrpix

public double[] getCrpix()
Gets reference pixel for the axes (see CRPIXn).


setCrval

public void setCrval(double[] crv)
Sets coordinate value for the reference pixel of the axes (see CRVALn).


getCrval

public double[] getCrval()
Gets coordinate value for the reference pixel of the axes (see CRVALn).


setCdelt

public void setCdelt(double[] cd)
Sets step size for the axes (see CDELTn).


getCdelt

public double[] getCdelt()
Gets step size for the axes (see CDELTn).


getWCS

public FitsWCS getWCS()
Gets the WCS object for the image.


toWCS

public double[] toWCS(double[] pix)
Compute World Coordinates from pixel coordinates.

Parameters:
pix - Array with pixel coordinates

toPixel

public double[] toPixel(double[] wc)
Compute pixel coordinates from a set of World Coordinates.

Parameters:
wc - Array with World Coordinates