    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class FITSWCS.LinearTransform

    java.lang.Object
       |
       +----FITSWCS.LinearTransform

public class LinearTransform
extends Object

This class provides support for linear coordinate transformations used by the FITS "World Coordinate System" (WCS) convention.

The FITSWCS package was translated from the WCSLIB C library This original library was written in support for coordinate systems used by astronomical data stored in FITS format. For more information on these coordinate systems, refer to the paper by Greisen and Calabretta at:

> ftp://fits.cv.nrao.edu/fits/documents/wcs/wcs.all.ps.Z

Note that the functionality the linprm data structrue in the WCSLIB C library has been incorporated into the data portion of this class; similarly the functionality of linset() has been put into the constructor. Nomenclature

In WCSLIB the "forward" direction is from (lng,lat) celestial coordinates to (x,y) coordinates in the plane of projection. This accords with the notion that spherical projections are a projection of the sphere onto a plane, the "reverse" direction is therefore that of deprojection from plane to sphere.

Unfortunately, this is opposite to what is generally understood to be the forward direction for FITS, namely that of transforming pixel coordinates to world coordinates. However, the ordering of function argument lists should make it clear what is intended.

COPYRIGHT NOTICE

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Correspondence concerning WCSLIB may be directed to:

         Internet email: mcalabre@atnf.csiro.au
         Postal address: Dr. Mark Calabretta,
                         Australia Telescope National Facility,
                         P.O. Box 76,
                         Epping, NSW, 2121,
                         AUSTRALIA

Correspondence concerning the Java implementation may be directed to Raymond L. Plante (rplante@ncsa.uiuc.edu).

##

cdelt
crpix
imgpix
naxis
pc
piximg

##

LinearTransform(int, double[], double[])
  create a LinearTransform object given the matrices describing the coordinate system.
LinearTransform(int, double[], double[], double[])
  create a LinearTransform object given the matrices describing the coordinate system.
LinearTransform(int, double[], double[][], double[])
  create a LinearTransform object given the matrices describing the coordinate system.

##

fwd(double[])
  Compute pixel coordinates from image coordinates.
matinv(int, double[])
  An auxiliary matrix inversion routine, matinv().
rev(double[])
  Compute image coordinates from pixel coordinates.

##

naxis

      protected int naxis

crpix

      protected double crpix[]

pc

      protected double pc[]

cdelt

      protected double cdelt[]

piximg

      protected double piximg[]

imgpix

      protected double imgpix[]

##

LinearTransform

      public LinearTransform(int naxis,
                             double crpix[],
                             double pc[][],
                             double cdelt[]) throws ArrayIndexOutOfBoundsException, SingularMatrixException

  create a LinearTransform object given the matrices describing the coordinate system.
  Parameters:
    naxis - Number of image axes
    crpix - naxis-length array containing the coordinate reference pixel (CRPIXn).
    pc - (naxis*naxis)-length array containing the elements of the PC (pixel coordinate) transformation matrix; the elements should be arranged such that the first axis is the most rapidly varying.
    cdelt - naxis-length array containing the coordinate increments (CDELTn).

  Throws: ArrayIndexOutOfBoundsException
    if naxis < 1, crpix.length < naxis, cdelt.length < naxis, or pc is not an naxis by naxis 2D array
  Throws: SingularMatrixException
    if pc represents a singular matrix.

LinearTransform

      public LinearTransform(int naxis,
                             double crpix[],
                             double pc[],
                             double cdelt[]) throws ArrayIndexOutOfBoundsException, SingularMatrixException

  create a LinearTransform object given the matrices describing the coordinate system.
  Parameters:
    naxis - Number of image axes
    crpix - naxis-length array containing the coordinate reference pixel (CRPIXn).
    pc - (naxis*naxis)-length array containing the elements of the PC (pixel coordinate) transformation matrix; the elements should be arranged such that the first axis is the most rapidly varying.
    cdelt - naxis-length array containing the coordinate increments (CDELTn).

  Throws: ArrayIndexOutOfBoundsException
    if naxis < 1, crpix.length < naxis, cdelt.length < naxis, or pc.lenght < naxis*naxis.
  Throws: SingularMatrixException
    if pc represents a singular matrix.

LinearTransform

      public LinearTransform(int naxis,
                             double crpix[],
                             double cdelt[]) throws ArrayIndexOutOfBoundsException, SingularMatrixException

  create a LinearTransform object given the matrices describing the coordinate system.
  Parameters:
    naxis - Number of image axes
    crpix - naxis-length array containing the coordinate reference pixel (CRPIXn).
    cdelt - naxis-length array containing the coordinate increments (CDELTn).

  Throws: ArrayIndexOutOfBoundsException
    if naxis < 1, crpix.length < naxis, cdelt.length < naxis, or pc.lenght < naxis*naxis.
  Throws: SingularMatrixException
    if pc represents a singular matrix.

##

matinv

      public final static double[] matinv(int n,
                                          double mat[]) throws ArrayIndexOutOfBoundsException, SingularMatrixException

  An auxiliary matrix inversion routine, matinv(). It uses LU-triangular factorization with scaled partial pivoting.
  Parameters:
    n - number of dimensions of the input matrix
    mat - (naxis*naxis)-length array containing the input matrix
  Returns:
    double[] (naxis*naxis)-length array containing the inversion of mat
  Throws: ArrayIndexOutOfBoundsException
    if n < 1 or mat.length < naxis*naxis.
  Throws: SingularMatrixException
    if mat represents a singular matrix.

fwd

      public double[] fwd(double imgcoord[])

  Compute pixel coordinates from image coordinates. Note that where celestial coordinate systems are concerned the image coordinates correspond to (x,y) in the plane of projection, not celestial (lng,lat).
  Parameters:
    imgcoord - array representing the input position; missing elements will default to 1.0;
  Returns:
    double[] array representing the transformed position

rev

      public double[] rev(double pixcoord[])

  Compute image coordinates from pixel coordinates. Note that where celestial coordinate systems are concerned the image coordinates correspond to (x,y) in the plane of projection, not celestial (lng,lat).
  Parameters:
    pixcoord - array representing the input position; missing elements will default to 1.0;
  Returns:
    double[] array representing the transformed position

    All Packages  Class Hierarchy  This Package  Previous  Next  Index