casa::CoordinateSystem Class Reference
[Coordinates]

#include <CoordinateSystem.h>

Inheritance diagram for casa::CoordinateSystem:

Inheritance graph
[legend]
Collaboration diagram for casa::CoordinateSystem:

Collaboration graph
[legend]
List of all members.

Detailed Description

Interconvert pixel and world coordinates.

Intended use:

Part of API

Review Status

Reviewed By:
Peter Barnes
Date Reviewed:
1999/12/24
Test programs:
tCoordinateSystem

Prerequisite

Synopsis

CoordinateSystem is the normal interface to coordinate systems, typically attached to an ImageInterface , however the coordinate system can be manipulated on its own. CoordinateSystem is in turn composed from various classes derived from the base class Coordinate .

The fundamental operations available to the user of a CoordinateSystem are:

  1. Transform a world (physical) coordinate to a pixel coordinate or vice versa via the methods toWorld and toPixel.
  2. Compose a CoordinateSystem from one or more independent groups, typically the sky-plane transformation will be one group, and the spectral axis will be another group. Each group consists of a linear transformation (in FITS terms, apply CRPIX, PC, CDELT) to turn the pixel coordinates into relative world coordinates, followed by a (possibly) nonlinear projection to world coordinates (i.e. apply CTYPE and CRVAL), typically a sky projection or a frequency to velocity conversion. Note that an arbitrary rotation or linear transformation can be applied by changing the matrix.
  3. Transpose the world and/or pixel axes.
  4. One or more pixel or world axes may be removed. You are encouraged to leave all the world axes if you remove a pixel axis. Removing a world axis also removes the corresponding pixel axis.
  5. Calculate the CoordinateSystem that results from a subimage operation.

Note that all the knowledge to do with removing and transposing axes is maintained by the CoordinateSystem. The individual Coordinates, of which it is made, know nothing about this.

Although the CoordinateSystem exists in the absence of an image, the usual place you will find one is attached to an object derived from ImageInterface such as PagedImage. When you do so, the physical (or pixel) axes in the image map one to one with the pixel axes contained in the CoordinateSystem. It cannot be any other way as when you create a PagedImage, it is checked that there are equal numbers of image and CoordinateSystem pixel axes. It is up to the creator of the PagedImage to make sure that they are in the correct order.

However, the CoordinateSystem may have more world axes than pixel axes because it is possible to remove a pixel axis but not its associated world axis (for example for a moment image). Now, if you use the CoordinateSystem functions referencePixel and referenceValue, you will find the vector of reference values will have more values than the vector of reference pixels, if a pixel axis has been removed but not the world axis. You must use the ancilliary functions provided to find out what is where.

Let's consider an example where a CoordinateSystem consisted of a DirectionCoordinate and a SpectralCoordinate. Let us say that the first two pixel axes of the image associate (roughly of course because lines of constant RA and DEC are not parallel with the pixel coordinates) with the DirectionCoordinate (RA and DEC say) and the third pixel axis is the SpectralCoordinate. Now imagine we collapse the image along the second pixel axis (roughly, the DEC axis). For the output image, we remove the second pixel axis from the CoordinateSystem, but leave the world axis intact. This enables us to still be able to make coordinate conversions for the first (roughly RA) pixel axis. Thus, CoordinateSystem::referenceValue would return a Vector of length 3 (for RA, DEC and spectral), but CoordinateSystem::referencePixel would return a vector length 2 (for RA and spectral).

Now this CoordinateSystem has two Coordinates, a DirectionCoordinate and a SpectralCoordinate, and let us state that that is the order in which they exist in the CoordinateSystem (you can change them about if you wish); they are coordinates number 0 and 1. The DirectionCoordinate has two axes (RA and DEC) and the SpectralCoordinate has one axis. Only the CoordinateSystem knows about removed axes, the DirectionCoordinate itself is ignorant that it has been bisected. If you want to find out what axis in the Coordinate system is where, you can use the functions findPixelAxis or findWorldAxis.

If we asked the former to find pixel axis 0, it would tell us that the Coordinate number was 0 (the DirectionCoordinate) and that the axis in that coordinate was 0 (the first axis in a DirectionCoordinate is always longitude, the second always latitude). If we asked it to find pixel axis 1, it would tell us that the coordinate number was 1 (the SpectralCoordinate) and that the axis in that coordinate was 0 (there is only one axis in a SpectralCoordinate). If we asked for pixelAxis 2 that would generate an error because our squashed image only has 2 pixel axes.

Now, if we asked findWorldAxis similar questions, it would tell us that worldAxis 0 in the CoordinateSystem can be found in coordinate 0 (the DirectionCoordinate) in axis 0 of that DirectionCoordinate. Similarly, worldAxis 1 in the CoordinateSystem (which has not been removed) is in coordinate 0 (the DirectionCoordinate) in axis 1 of that Finally, worldAxis 2 in the CoordinateSystem is in coordinate 1 (the SpectralCoordinate) in axis 0 of that SpectralCoordinate.

Other handy functions are pixelAxes and worldAxes. These list the pixel and world axes in the CoordinateSystem for the specified coordinate. Thus, if we asked pixelAxes to find the pixel axes for coordinate 0 (the DirectionCoordinate) in the CoordinateSystem it would return a vector [0, -1] indicating the second axis of the DirectionCoordinate has been removed. However, the worldAxes function would return [0,1] as no world axis has been removed. Similarly, if operated on coordinate 1 (the SpectralCoordinate), pixelAxes would return [1] and worldAxes would return [2].

Because you can transpose the CoordinateSystem about, you should NEVER ASSUME ANYTHING except that the pixel axes of the CoordinateSystem map to the pixel axes of the image when you first construct the image.

SpectralCoordinate and DirectionCoordinate both have a (non-virtual) function called setReferenceConversion. This enables an extra conversion layer so that conversion between pixel and world can go to a reference frame other than the construction reference. When you use the function convert, these layers are active, but ONLY if the requested conversion is purely between pixel and world. For a SpectralCoordinate this must always be true (only has one axis) but for the DirectionCoordinate you might request a mixed pixel/world conversion. In this case, the extra conversion layer is ill-defined and not active (for the DirectionCoordinate part of it).

Caution: All pixels coordinates are zero relative.

Example

See the example in Coordinates.h and tCoordinateSystem.cc

Motivation

Coordinate systems for images.

Thrown Exceptions

To Do

Definition at line 215 of file CoordinateSystem.h.

Public Member Functions

 CoordinateSystem ()
 Default constructor.
 CoordinateSystem (const CoordinateSystem &other)
 Copying constructor (copy semantics).
CoordinateSystemoperator= (const CoordinateSystem &other)
 Assignment (copy semantics).
virtual ~CoordinateSystem ()
 Destructor.
void addCoordinate (const Coordinate &coord)
 Add another Coordinate to this CoordinateSystem.
void transpose (const Vector< Int > &newWorldOrder, const Vector< Int > &newPixelOrder)
 Transpose the CoordinateSystem so that world axis 0 is newWorldOrder(0) and so on for all the other axes.
void restoreOriginal ()
 Untranspose and undelete all axes.
uInt nCoordinates () const
 Returns the number of Coordinates that this CoordinateSystem contains.
Coordinate::Type type (uInt whichCoordinate) const
 Return the type of the given Coordinate.
String showType (uInt whichCoordinate) const
 Returns the type of the given Coordinate as a string.
const Coordinatecoordinate (uInt which) const
 Return the given Coordinate as a reference to the base class object.
Bool replaceCoordinate (const Coordinate &newCoordinate, uInt whichCoordinate)
 Replace one Coordinate with another.
Int findCoordinate (Coordinate::Type type, Int afterCoord=-1) const
 Find the Coordinate number that corresponds to the given type.
Int pixelAxisToWorldAxis (uInt pixelAxis) const
 Find the world axis for the given pixel axis in a CoordinateSystem.
Int worldAxisToPixelAxis (uInt worldAxis) const
 Find the pixel axis for the given world axis in a CoordinateSystem.
virtual Coordinate::Type type () const
 Returns Coordinate::COORDSYS.
virtual String showType () const
 Always returns "System".
Bool toWorld (Vector< Double > &world, const IPosition &pixel) const
 This is provided as a convenience since it is a very commonly desired operation through CoordinateSystem.
virtual Bool toMix (Vector< Double > &worldOut, Vector< Double > &pixelOut, const Vector< Double > &worldIn, const Vector< Double > &pixelIn, const Vector< Bool > &worldAxes, const Vector< Bool > &pixelAxes, const Vector< Double > &worldMin, const Vector< Double > &worldMax) const
 Mixed pixel/world coordinate conversion.
Bool nearPixel (const CoordinateSystem &other, Double tol=1e-6) const
 This function compares this and the other coordinate system, but ONLY for the non-removed pixel axes.
virtual String format (String &units, Coordinate::formatType format, Double worldValue, uInt worldAxis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
 Format a world value nicely through the common format interface.
virtual CoordinatemakeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const
 Find the CoordinateSystem (you can safely caste the pointer to a CoordinateSystem) for when we Fourier Transform ourselves.
virtual Bool save (RecordInterface &container, const String &fieldName) const
 Save the CoordinateSystem into the supplied record using the supplied field name.
virtual Coordinateclone () const
 Make a copy of the CoordinateSystem using new.
Bool toFITSHeader (RecordInterface &header, IPosition &shape, Bool oneRelative, Char prefix= 'c', Bool writeWCS=False, Bool preferVelocity=True, Bool opticalVelocity=True) const
 Convert a CoordinateSystem to FITS, i.e.
Vector< Stringlist (LogIO &os, MDoppler::Types doppler, const IPosition &latticeShape, const IPosition &tileShape, Bool postLocally=False) const
 List all header information.
Bool worldMap (Vector< Int > &worldAxisMap, Vector< Int > &worldAxisTranspose, Vector< Bool > &refChange, const CoordinateSystem &cSys) const
 Find the world and pixel axis mappings to the supplied CoordinateSystem from the current coordinate system.
Bool pixelMap (Vector< Int > &pixelAxisMap, Vector< Int > &pixelAxisTranspose, const CoordinateSystem &cSys) const
Bool removeWorldAxis (uInt axis, Double replacement)
 Remove a world or pixel axis.
Bool removePixelAxis (uInt axis, Double replacement)
Bool worldReplacementValue (Double &replacement, uInt axis) const
Bool pixelReplacementValue (Double &replacement, uInt axis) const
Bool setWorldReplacementValue (uInt axis, Double replacement)
 You can set the replacement values with these functions.
Bool setPixelReplacementValue (uInt axis, Double replacement)
*CoordinateSystem subImage (const Vector< Float > &originShift, const Vector< Float > &incrFac, const Vector< Int > &newShape) const
 Return a CoordinateSystem appropriate for a shift of origin (the shift is subtracted from the reference pixel) and change of increment (the increments are multipled by the factor).
void subImageInSitu (const Vector< Float > &originShift, const Vector< Float > &incrFac, const Vector< Int > &newShape)
Vector< IntworldAxes (uInt whichCoord) const
 For a given Coordinate say where its world and pixel axes are in this CoordinateSystem.
Vector< IntpixelAxes (uInt whichCoord) const
const LinearCoordinatelinearCoordinate (uInt which) const
 Return the given Coordinate.
const DirectionCoordinatedirectionCoordinate (uInt which) const
const SpectralCoordinatespectralCoordinate (uInt which) const
const StokesCoordinatestokesCoordinate (uInt which) const
const TabularCoordinatetabularCoordinate (uInt which) const
void findWorldAxis (Int &coordinate, Int &axisInCoordinate, uInt axisInCoordinateSystem) const
 Given an axis number (pixel or world) in the CoordinateSystem, find the corresponding coordinate number and axis in that Coordinate.
void findPixelAxis (Int &coordinate, Int &axisInCoordinate, uInt axisInCoordinateSystem) const
virtual uInt nPixelAxes () const
 Sums the number of axes in the Coordinates that the CoordinateSystem contains, allowing for removed axes.
virtual uInt nWorldAxes () const
virtual Bool toWorld (Vector< Double > &world, const Vector< Double > &pixel) const
 Convert a pixel position to a world position or vice versa.
virtual Bool toPixel (Vector< Double > &pixel, const Vector< Double > &world) const
virtual Bool toWorldMany (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
 Batch up a lot of transformations.
virtual Bool toPixelMany (Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
virtual Bool setWorldMixRanges (const IPosition &shape)
 Compute and recover the world min and max ranges, for use in function toMix, for a lattice of the given shape (must be of length nPixelAxes()).
virtual void setDefaultWorldMixRanges ()
virtual Vector< DoubleworldMixMin () const
virtual Vector< DoubleworldMixMax () const
virtual void makePixelRelative (Vector< Double > &pixel) const
 Make absolute coordinates relative and vice-versa (relative to the reference pixel/value).
virtual void makePixelAbsolute (Vector< Double > &pixel) const
virtual void makeWorldRelative (Vector< Double > &world) const
virtual void makeWorldAbsolute (Vector< Double > &world) const
virtual void makeWorldAbsoluteRef (Vector< Double > &world, const Vector< Double > &refVal) const
 Make absolute coordinates relative and vice versa with respect to the given reference value.
virtual void makePixelRelativeMany (Matrix< Double > &pixel) const
 Batch up a lot of absolute/relative transformations.
virtual void makePixelAbsoluteMany (Matrix< Double > &pixel) const
virtual void makeWorldRelativeMany (Matrix< Double > &world) const
virtual void makeWorldAbsoluteMany (Matrix< Double > &world) const
Bool convert (Vector< Double > &coordOut, const Vector< Double > &coordin, const Vector< Bool > &absIn, const Vector< String > &unitsIn, MDoppler::Types dopplerIn, const Vector< Bool > &absOut, const Vector< String > &unitsOut, MDoppler::Types dopplerOut, Double pixInOffset=0.0, Double pixOutOffset=0.0)
 General coordinate conversion.
Bool convert (Matrix< Double > &coordOut, const Matrix< Double > &coordIn, const Vector< Bool > &absIn, const Vector< String > &unitsIn, MDoppler::Types dopplerIn, const Vector< Bool > &absOut, const Vector< String > &unitsOut, MDoppler::Types dopplerOut, Double pixInOffset=0.0, Double pixOutOffset=0.0)
virtual Vector< StringworldAxisNames () const
 Return the requested attribute.
virtual Vector< DoublereferencePixel () const
virtual Matrix< DoublelinearTransform () const
virtual Vector< Doubleincrement () const
virtual Vector< DoublereferenceValue () const
virtual Bool setWorldAxisNames (const Vector< String > &names)
 Set the requested attribute.
virtual Bool setReferencePixel (const Vector< Double > &refPix)
virtual Bool setLinearTransform (const Matrix< Double > &xform)
virtual Bool setIncrement (const Vector< Double > &inc)
virtual Bool setReferenceValue (const Vector< Double > &refval)
virtual Bool setWorldAxisUnits (const Vector< String > &units)
 Set/get the units.
virtual Vector< StringworldAxisUnits () const
virtual Bool near (const Coordinate &other, Double tol=1e-6) const
 Comparison function.
virtual Bool near (const Coordinate &other, const Vector< Int > &excludePixelAxes, Double tol=1e-6) const
ObsInfo obsInfo () const
 Miscellaneous information related to an observation, for example the observation date.
void setObsInfo (const ObsInfo &obsinfo)

Static Public Member Functions

static CoordinateSystemrestore (const RecordInterface &container, const String &fieldName)
 Restore the CoordinateSystem from a record.
static Bool fromFITSHeader (Int &stokesFITSValue, CoordinateSystem &coordsys, RecordInterface &recHeader, const Vector< String > &header, const IPosition &shape, uInt which=0)
 Probably even if we return False we should set up the best linear coordinate that we can.
static Bool fromFITSHeaderOld (Int &stokesFITSValue, CoordinateSystem &coordsys, const RecordInterface &header, const IPosition &shape, Bool oneRelative, Char prefix= 'c')
 Old version.

Private Member Functions

Bool mapOne (Vector< Int > &worldAxisMap, Vector< Int > &worldAxisTranspose, Vector< Bool > &refChange, const CoordinateSystem &cSys, const CoordinateSystem &cSys2, const uInt coord, const uInt coord2) const
 Helper functions to group common code.
void copy (const CoordinateSystem &other)
void clear ()
Bool checkAxesInThisCoordinate (const Vector< Bool > &axes, uInt which) const
Bool checkWorldReplacementAxis (Int &coordinate, Int &axisInCoordinate, uInt axis) const
Bool checkPixelReplacementAxis (Int &coordinate, Int &axisInCoordinate, uInt axis) const
 Check pixel replacement axis is legal and find it.
*void cleanUpSpecCoord (PtrBlock< SpectralCoordinate * > &in, PtrBlock< SpectralCoordinate * > &out)
 Delete some pointer blocks.
void deleteTemps (const uInt which)
 Delete temporary maps.
StokesCoordinate stokesSubImage (const StokesCoordinate &sc, Int originShift, Int pixincFac, Int newShape) const
 Do subImage for Stokes.
CoordinateSystem stripRemovedAxes (const CoordinateSystem &cSys) const
 Strip out coordinates with all world and pixel axes removed.
void makeWorldAbsRelMany (Matrix< Double > &value, Bool toAbs) const
 Many abs/rel conversions.
void makePixelAbsRelMany (Matrix< Double > &value, Bool toAbs) const
void listDirectionSystem (LogIO &os) const
 All these functions are in support of the list function.
void listFrequencySystem (LogIO &os, MDoppler::Types velocityType) const
void listPointingCenter (LogIO &os) const
void getFieldWidths (LogIO &os, uInt &widthAxis, uInt &widthCoordType, uInt &widthCoordNumber, uInt &widthName, uInt &widthProj, uInt &widthShape, uInt &widthTile, uInt &widthRefValue, uInt &widthRefPixel, uInt &widthInc, uInt &widthUnits, Int &precRefValSci, Int &precRefValFloat, Int &precRefValRADEC, Int &precRefPixFloat, Int &precIncSci, String &nameAxis, String &nameCoordType, String &nameCoordNumber, String &nameName, String &nameProj, String &nameShape, String &nameTile, String &nameRefValue, String &nameRefPixel, String &nameInc, String &nameUnits, MDoppler::Types velocityType, const IPosition &latticeShape, const IPosition &tileShape) const
void listHeader (LogIO &os, Coordinate *pc, uInt &widthAxis, uInt &widthCoordType, uInt &widthCoordNumber, uInt &widthName, uInt &widthProj, uInt &widthShape, uInt &widthTile, uInt &widthRefValue, uInt &widthRefPixel, uInt &widthInc, uInt &widthUnits, Bool findWidths, Int coordinate, Int axisInCoordinate, Int pixelAxis, Int precRefValSci, Int precRefValFloat, Int precRefValRADEC, Int precRefPixFloat, Int precIncSci, const IPosition &latticeShape, const IPosition &tileShape) const
void listVelocity (LogIO &os, Coordinate *pc, uInt widthAxis, uInt widthCoordType, uInt widthCoordNumber, uInt &widthName, uInt widthProj, uInt widthShape, uInt widthTile, uInt &widthRefValue, uInt widthRefPixel, uInt &widthInc, uInt &widthUnits, Bool findWidths, Int axisInCoordinate, Int pixelAxis, MDoppler::Types velocityType, Int precRefValSci, Int precRefValFloat, Int precRefValRADEC, Int precRefPixFloat, Int precIncSci) const
void clearFlags (LogIO &os) const
Bool velocityIncrement (Double &velocityInc, SpectralCoordinate &sc, MDoppler::Types velocityType, const String &velUnits) const

Private Attributes

PtrBlock< Coordinate * > coordinates_p
 Where we store copies of the coordinates we are created with.
PtrBlock< Block< Int > * > world_maps_p
 For coordinate[i] axis[j], world_maps_p[i][j], if >=0 gives the location in the input vector that maps to this coord/axis, <0 means that the axis has been removed world_tmp_p[i] a temporary vector length coord[i]->nworldAxes() replacement_values_p[i][j] value to use for this axis if removed.
PtrBlock< Vector< Double > * > world_tmps_p
PtrBlock< Vector< Double > * > world_replacement_values_p
PtrBlock< Block< Int > * > pixel_maps_p
 Same meanings as for the world*'s above.
PtrBlock< Vector< Double > * > pixel_tmps_p
PtrBlock< Vector< Double > * > pixel_replacement_values_p
PtrBlock< Vector< Bool > * > worldAxes_tmps_p
 These temporaries all needed for the toMix function.
PtrBlock< Vector< Bool > * > pixelAxes_tmps_p
PtrBlock< Vector< Double > * > worldOut_tmps_p
PtrBlock< Vector< Double > * > pixelOut_tmps_p
PtrBlock< Vector< Double > * > worldMin_tmps_p
PtrBlock< Vector< Double > * > worldMax_tmps_p
ObsInfo obsinfo_p
 Miscellaneous information about the observation associated with this Coordinate System.


Constructor & Destructor Documentation

casa::CoordinateSystem::CoordinateSystem (  ) 

Default constructor.

This is an empty CoordinateSystem.

casa::CoordinateSystem::CoordinateSystem ( const CoordinateSystem other  ) 

Copying constructor (copy semantics).

virtual casa::CoordinateSystem::~CoordinateSystem (  )  [virtual]

Destructor.


Member Function Documentation

CoordinateSystem& casa::CoordinateSystem::operator= ( const CoordinateSystem other  ) 

Assignment (copy semantics).

void casa::CoordinateSystem::addCoordinate ( const Coordinate coord  ) 

Add another Coordinate to this CoordinateSystem.

This addition is done by copying, so that if coord changes the change is NOT reflected in the CoordinateSystem.

void casa::CoordinateSystem::transpose ( const Vector< Int > &  newWorldOrder,
const Vector< Int > &  newPixelOrder 
)

Transpose the CoordinateSystem so that world axis 0 is newWorldOrder(0) and so on for all the other axes.

newPixelOrder works similarly. Normally you will give the same transformation vector for both the world and pixel transformations, however this is not required.

Bool casa::CoordinateSystem::worldMap ( Vector< Int > &  worldAxisMap,
Vector< Int > &  worldAxisTranspose,
Vector< Bool > &  refChange,
const CoordinateSystem cSys 
) const

Find the world and pixel axis mappings to the supplied CoordinateSystem from the current coordinate system.

False is returned if either the supplied or current coordinate system, has no world axes (and a message recoverable with function errorMessage indicating why). Otherwise True is returned. worldAxisMap(i) is the location of world axis i (from the supplied CoordinateSystem, cSys, in the current CoordinateSystem. worldAxisTranspose(i) is the location of world axis i (from the current CoordinateSystem) in the supplied CoordinateSystem, cSys. The output vectors are resized appropriately by this function. A value of -1 in either vector means that the axis could not be found in the other CoordinateSystem. The vector refChange says if the types are the same, is there a reference type change (e.g. TOPO versus LSR for the SpectralCoordinate, or J2000 versus GALACTIC for DirectionCoordinate). Thus if refChange(i) is True, it means world axis i in the current CoordinateSystem was matched, but has a different reference type to that of the supplied CoordinateSystem.

Bool casa::CoordinateSystem::pixelMap ( Vector< Int > &  pixelAxisMap,
Vector< Int > &  pixelAxisTranspose,
const CoordinateSystem cSys 
) const

Bool casa::CoordinateSystem::removeWorldAxis ( uInt  axis,
Double  replacement 
)

Remove a world or pixel axis.

When its value is required for forward or backwards transformations, use replacement
When a world axis is removed, the corresponding pixel axis is removed too, because it makes no sense having a pixel axis without world coordinates.
Removing a pixel axis without removing the corresponding world axis is, however, possible and meaningful. It can be used when e.g. a frequency plane is taken from a cube. The plane has 2 pixel axes, but the 3rd world axis can still describe the frequency coordinate. See also the functions in CoordinateUtil for removing lists of pixel/world axes (tricky because they shift down)

False is returned (an error in errorMessage() will be set) if the axis is illegal, else returns True.

Bool casa::CoordinateSystem::removePixelAxis ( uInt  axis,
Double  replacement 
)

Bool casa::CoordinateSystem::worldReplacementValue ( Double replacement,
uInt  axis 
) const

Bool casa::CoordinateSystem::pixelReplacementValue ( Double replacement,
uInt  axis 
) const

Bool casa::CoordinateSystem::setWorldReplacementValue ( uInt  axis,
Double  replacement 
)

You can set the replacement values with these functions.

You can only do this after you have removed an axis or False will be returned (and an error in errorMessage()) will be set. Use the same axis number as in the removePixelAxis and removeWorldAxis calls.

False is returned (an error in errorMessage() will be set) if the axis is illegal, else returns True.

Bool casa::CoordinateSystem::setPixelReplacementValue ( uInt  axis,
Double  replacement 
)

* CoordinateSystem casa::CoordinateSystem::subImage ( const Vector< Float > &  originShift,
const Vector< Float > &  incrFac,
const Vector< Int > &  newShape 
) const

Return a CoordinateSystem appropriate for a shift of origin (the shift is subtracted from the reference pixel) and change of increment (the increments are multipled by the factor).

Both vectors should be of length nPixelAxes().

The newShape vector is only needed for the StokesCoordinate, if any. If this vector is of length zero, the new StokesCoordinate is formed from all of the available input Stokes after application of the shift and increment factor. Otherwise, the new Stokes axis length is equal to that specified after appliction of the shift and increment and excess values discarded. In addition, for any StokesCoordinate, the shift and factor must be integer. So Int(value+0.5) is taken before they are used.

void casa::CoordinateSystem::subImageInSitu ( const Vector< Float > &  originShift,
const Vector< Float > &  incrFac,
const Vector< Int > &  newShape 
)

void casa::CoordinateSystem::restoreOriginal (  ) 

Untranspose and undelete all axes.

Does not undo the effects of subimaging.

uInt casa::CoordinateSystem::nCoordinates (  )  const

Returns the number of Coordinates that this CoordinateSystem contains.

The order might be unrelated to the axis order through the results of transposing and removing axes.

Vector<Int> casa::CoordinateSystem::worldAxes ( uInt  whichCoord  )  const

For a given Coordinate say where its world and pixel axes are in this CoordinateSystem.

The position in the returned Vector is its axis number in the Coordinate, and its value is the axis number in the CoordinateSystem. If the value is less than zero the axis has been removed from this CoordinateSystem.

Vector<Int> casa::CoordinateSystem::pixelAxes ( uInt  whichCoord  )  const

Coordinate::Type casa::CoordinateSystem::type ( uInt  whichCoordinate  )  const

Return the type of the given Coordinate.

String casa::CoordinateSystem::showType ( uInt  whichCoordinate  )  const

Returns the type of the given Coordinate as a string.

const Coordinate& casa::CoordinateSystem::coordinate ( uInt  which  )  const

Return the given Coordinate as a reference to the base class object.

const LinearCoordinate& casa::CoordinateSystem::linearCoordinate ( uInt  which  )  const

Return the given Coordinate.

Throws an exception if retrieved as the wrong type.