uk.ac.starlink.ast
Class PcdMap

java.lang.Object
  extended by uk.ac.starlink.ast.AstObject
      extended by uk.ac.starlink.ast.Mapping
          extended by uk.ac.starlink.ast.PcdMap

public class PcdMap
extends Mapping

Java interface to the AST PcdMap class - apply 2-dimensional pincushion/barrel distortion. A PcdMap is a non-linear Mapping which transforms 2-dimensional positions to correct for the radial distortion introduced by some cameras and telescopes. This can take the form either of pincushion or barrel distortion, and is characterized by a single distortion coefficient.

A PcdMap is specified by giving this distortion coefficient and the coordinates of the centre of the radial distortion. The forward transformation of a PcdMap applies the distortion:

RD = R * ( 1 + C * R * R )

where R is the undistorted radial distance from the distortion centre (specified by attribute PcdCen), RD is the radial distance from the same centre in the presence of distortion, and C is the distortion coefficient (given by attribute Disco).

The inverse transformation of a PcdMap removes the distortion produced by the forward transformation. The expression used to derive R from RD is an approximate inverse of the expression above.

Licence

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

This program 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 General Public Licence for more details.

You should have received a copy of the GNU General Public Licence along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA 02110-1301, USA

See Also:
AST PcdMap

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.starlink.ast.Mapping
Mapping.Interpolator, Mapping.Spreader
 
Field Summary
 
Fields inherited from class uk.ac.starlink.ast.Mapping
LINEAR_INTERPOLATOR, LINEAR_SPREADER, NEAREST_INTERPOLATOR, NEAREST_SPREADER
 
Fields inherited from class uk.ac.starlink.ast.AstObject
AST__BAD, AST__TUNULL, pointer
 
Constructor Summary
PcdMap(double disco, double[] pcdcen)
          Creates a PcdMap.
 
Method Summary
 double getDisco()
          Get pcdMap pincushion/barrel distortion coefficient.
 double getPcdCen(int axis)
          Get centre coordinates of pincushion/barrel distortion by axis.
 void setDisco(double disco)
          Set pcdMap pincushion/barrel distortion coefficient.
 void setPcdCen(int axis, double pcdCen)
          Set centre coordinates of pincushion/barrel distortion by axis.
 
Methods inherited from class uk.ac.starlink.ast.Mapping
decompose, getInvert, getNin, getNout, getReport, getTranForward, getTranInverse, invert, linearApprox, mapBox, mapSplit, rate, rebin, rebinD, rebinF, rebinI, resample, resampleB, resampleD, resampleF, resampleI, resampleL, resampleS, setInvert, setReport, simplify, tran1, tran2, tranGrid, tranN, tranP
 
Methods inherited from class uk.ac.starlink.ast.AstObject
annul, clear, copy, delete, equals, finalize, getAstConstantI, getB, getC, getD, getF, getI, getID, getIdent, getL, getNobject, getObjSize, getRefCount, hashCode, isThreaded, reportVersions, sameObject, set, setB, setC, setD, setF, setI, setID, setIdent, setL, show, test, tune
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PcdMap

public PcdMap(double disco,
              double[] pcdcen)
Creates a PcdMap.

Parameters:
disco - The distortion coefficient. Negative values give barrel distortion, positive values give pincushion distortion, and zero gives no distortion.
pcdcen - A 2-element array containing the coordinates of the centre of the distortion.
Throws:
AstException - if an error occurred in the AST library
Method Detail

getDisco

public double getDisco()
Get pcdMap pincushion/barrel distortion coefficient. This attribute specifies the pincushion/barrel distortion coefficient used by a PcdMap. This coefficient is set when the PcdMap is created, but may later be modified. If the attribute is cleared, its default value is zero, which gives no distortion. For pincushion distortion, the value should be positive. For barrel distortion, it should be negative.

Note that the forward transformation of a PcdMap applies the distortion specified by this attribute and the inverse transformation removes this distortion. If the PcdMap is inverted (e.g. using astInvert), then the forward transformation will remove the distortion and the inverse transformation will apply it. The distortion itself will still be given by the same value of Disco.

Returns:
this object's Disco attribute

setDisco

public void setDisco(double disco)
Set pcdMap pincushion/barrel distortion coefficient. This attribute specifies the pincushion/barrel distortion coefficient used by a PcdMap. This coefficient is set when the PcdMap is created, but may later be modified. If the attribute is cleared, its default value is zero, which gives no distortion. For pincushion distortion, the value should be positive. For barrel distortion, it should be negative.

Note that the forward transformation of a PcdMap applies the distortion specified by this attribute and the inverse transformation removes this distortion. If the PcdMap is inverted (e.g. using astInvert), then the forward transformation will remove the distortion and the inverse transformation will apply it. The distortion itself will still be given by the same value of Disco.

Parameters:
disco - the Disco attribute of this object

getPcdCen

public double getPcdCen(int axis)
Get centre coordinates of pincushion/barrel distortion by axis. This attribute specifies the centre of the pincushion/barrel distortion implemented by a PcdMap. It takes a separate value for each axis of the PcdMap so that, for instance, the settings "PcdCen(1)=345.0,PcdCen(2)=-104.4" specify that the pincushion distortion is centred at positions of 345.0 and -104.4 on axes 1 and 2 respectively. This attribute is set when a PcdMap is created, but may later be modified. If the attribute is cleared, the default value for both axes is zero.

Notes


- If no axis is specified, (e.g. "PcdCen" instead of "PcdCen(2)"), then a "set" or "clear" operation will affect the attribute value of both axes, while a "get" or "test" operation will use just the PcdCen(1) value.

Parameters:
axis - the index of the axis to get the value for (1 or 2)
Returns:
the PcdCen attribute for the indicated axis of this mapping
Throws:
IndexOutOfBoundsException - if axis is not in the range 1..2.

setPcdCen

public void setPcdCen(int axis,
                      double pcdCen)
Set centre coordinates of pincushion/barrel distortion by axis. This attribute specifies the centre of the pincushion/barrel distortion implemented by a PcdMap. It takes a separate value for each axis of the PcdMap so that, for instance, the settings "PcdCen(1)=345.0,PcdCen(2)=-104.4" specify that the pincushion distortion is centred at positions of 345.0 and -104.4 on axes 1 and 2 respectively. This attribute is set when a PcdMap is created, but may later be modified. If the attribute is cleared, the default value for both axes is zero.

Notes


- If no axis is specified, (e.g. "PcdCen" instead of "PcdCen(2)"), then a "set" or "clear" operation will affect the attribute value of both axes, while a "get" or "test" operation will use just the PcdCen(1) value.

Parameters:
axis - the index of the axis to set the value for (1 or 2)
pcdCen - the PcdCen attribute for the indicated axis of this mapping
Throws:
IndexOutOfBoundsException - if axis is not in the range 1..2.


Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.