casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::QualityCoordinate Class Reference

Interconvert between pixel and Quality value. More...

#include <QualityCoordinate.h>

Inheritance diagram for casacore::QualityCoordinate:
casacore::Coordinate

Public Member Functions

 QualityCoordinate (const Vector< Int > &whichQuality)
 The length of whichQuality is the length of the axis, and the values define which quality are in which axis value. More...
 
 QualityCoordinate (const QualityCoordinate &other)
 Copy constructor (copy semantics) More...
 
QualityCoordinateoperator= (const QualityCoordinate &other)
 Assignment (copy semantics) More...
 
virtual ~QualityCoordinate ()
 Destructor. More...
 
virtual Coordinate::Type type () const
 Returns Coordinates::QUALITY. More...
 
virtual String showType () const
 Always returns the String "Quality". More...
 
virtual uInt nPixelAxes () const
 Always returns 1. More...
 
virtual uInt nWorldAxes () const
 
virtual Bool toWorld (Vector< Double > &world, const Vector< Double > &pixel, Bool=True) const
 Convert a pixel to a world coordinate or vice versa. More...
 
virtual Bool toPixel (Vector< Double > &pixel, const Vector< Double > &world) const
 
Bool toPixel (Int &pixel, Quality::QualityTypes quality) const
 Interconvert between pixel and world as a Quality type. More...
 
Bool toWorld (Quality::QualityTypes &quality, Int pixel) const
 
virtual void makePixelRelative (Vector< Double > &pixel) const
 Make absolute coordinates relative and vice-versa. More...
 
virtual void makePixelAbsolute (Vector< Double > &pixel) const
 
virtual void makeWorldRelative (Vector< Double > &world) const
 
virtual void makeWorldAbsolute (Vector< Double > &world) const
 
Vector< Intquality () const
 Get the Quality values (Quality::QualityType) that we constructed with into a vector. More...
 
void setQuality (const Vector< Int > &whichQuality)
 Set a new vector of Quality values (a vector of Quality::QualityType) More...
 
virtual Vector< StringworldAxisNames () const
 Report the value of the requested attribute. More...
 
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 value of the requested attribute. More...
 
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)
 The set function has no effect as the units must be empty for a QualityCoordinate Always returns True. More...
 
virtual Vector< StringworldAxisUnits () const
 
virtual Bool setWorldMixRanges (const IPosition &shape)
 Set the world min and max ranges, for use in function toMix, for a lattice of the given shape (for this coordinate). More...
 
virtual void setDefaultWorldMixRanges ()
 
virtual String format (String &units, Coordinate::formatType format, Double worldValue, uInt worldAxis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1, Bool usePrecForMixed=False) const
 Format a QualityCoordinate world value with the common format interface (refer to the base class Coordinate for basics. More...
 
virtual Bool near (const Coordinate &other, Double tol=1e-6) const
 Comparison function. More...
 
virtual Bool near (const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1e-6) const
 
virtual Bool save (RecordInterface &container, const String &fieldName) const
 Save the QualityCoordinate into the supplied record using the supplied field name. More...
 
virtual Coordinateclone () const
 Make a copy of the QualityCoordinate using new. More...
 
virtual Bool doNearPixel (const Coordinate &other, const Vector< Bool > &thisAxes, const Vector< Bool > &otherAxes, Double tol=1.0e-6) const
 Comparison only made for specified axes in this and other Coordinate. More...
 
- Public Member Functions inherited from casacore::Coordinate
virtual ~Coordinate ()
 Destructor. More...
 
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 absolute pixel/world coordinate conversion. More...
 
Vector< DoubleworldMixMin () const
 
Vector< DoubleworldMixMax () const
 
virtual Bool toWorldMany (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
 Batch up a lot of transformations. More...
 
virtual Bool toPixelMany (Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) 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. More...
 
virtual void makePixelRelativeMany (Matrix< Double > &pixel) const
 Batch up a lot of absolute/relative transformations. More...
 
virtual void makePixelAbsoluteMany (Matrix< Double > &pixel) const
 
virtual void makeWorldRelativeMany (Matrix< Double > &world) const
 
virtual void makeWorldAbsoluteMany (Matrix< Double > &world) const
 
virtual CoordinatemakeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const
 Find the Coordinate for when we Fourier Transform ourselves. More...
 
const StringerrorMessage () const
 If the last conversion to world or pixel coordinates resulted in an error, report that error. More...
 
virtual void getPrecision (Int &precision, Coordinate::formatType &format, Bool showAsAbsolute, Int defPrecScientific, Int defPrecFixed, Int defPrecTime) const
 Provide a common interface to getting formatted representations of coordinate values. More...
 
String formatQuantity (String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
 
virtual Coordinaterotate (const Quantum< Double > &angle) const
 return the result of rotating the coordinate clockwise through the specified angle. More...
 

Static Public Member Functions

static Double toWorld (Quality::QualityTypes quality)
 Interconvert between world stored as a Double and world stored as a Quality type. More...
 
static Quality::QualityTypes toWorld (Double world)
 
static QualityCoordinaterestore (const RecordInterface &container, const String &fieldName)
 Recover the QualityCoordinate from a record. More...
 
- Static Public Member Functions inherited from casacore::Coordinate
static String typeToString (Coordinate::Type type)
 
static void set_wcs (::wcsprm &wcs)
 Call wcsset on the wcs structure. More...
 
static void init_wcs (::wcsprm &wcs, int naxis)
 Call wcsini on the wcs structure. More...
 
static void sub_wcs (const ::wcsprm &src, int &nsub, int axes[],::wcsprm &dst)
 Call wcssub on the src/dst pair. More...
 
static void copy_wcs (const ::wcsprm &src,::wcsprm &dst)
 Call wcssub on the src/dst pair with null nsub/axes. More...
 

Private Member Functions

Bool toWorld (Double &world, const Double pixel) const
 
Bool toPixel (Double &pixel, const Double world) const
 
 QualityCoordinate ()
 Undefined and inaccessible. More...
 

Private Attributes

Block< Intvalues_p
 
Double crval_p
 Keep these for subimaging purposes. More...
 
Double crpix_p
 
Double matrix_p
 
Double cdelt_p
 
String name_p
 
String unit_p
 
Int nValues_p
 

Additional Inherited Members

- Public Types inherited from casacore::Coordinate
enum  Type {
  LINEAR,
  DIRECTION,
  SPECTRAL,
  STOKES,
  TABULAR,
  QUALITY,
  COORDSYS
}
 This enum lists the types of the derived classes. More...
 
enum  formatType {
  DEFAULT,
  SCIENTIFIC,
  FIXED,
  MIXED,
  TIME
}
 This enum is used for formatting world values into Strings. More...
 
- Protected Member Functions inherited from casacore::Coordinate
 Coordinate ()
 Default constructor. More...
 
 Coordinate (const Coordinate &other)
 Copy constructor (copy semantics) More...
 
Coordinateoperator= (const Coordinate &other)
 Assignment (copy semantics) More...
 
void set_error (const String &errorMsg) const
 Set error message. More...
 
Bool find_scale_factor (String &error, Vector< Double > &factor, const Vector< String > &units, const Vector< String > &oldUnits)
 
void fourierUnits (String &nameOut, String &unitOut, String &unitInCanon, Coordinate::Type type, Int axis, const String &unitIn, const String &nameIn) const
 Tries to find a canonical unit for input unit (e.g. More...
 
Bool toWorldWCS (Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
 Functions to interconvert pixel<->world via wcs. More...
 
Bool toPixelWCS (Vector< Double > &pixel, const Vector< Double > &world, wcsprm &wcs) const
 
Bool toWorldManyWCS (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures, wcsprm &wcs) const
 
Bool toPixelManyWCS (Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures, wcsprm &wcs) const
 
void toCurrentMany (Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
 Functions for handling conversion between the current units and the wcs units. More...
 
void fromCurrentMany (Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
 
virtual void convertTo (Vector< Double > &) const
 Functions for handling conversion between the current reference frame and the native one. More...
 
virtual void convertFrom (Vector< Double > &) const
 
void convertToMany (Matrix< Double > &world) const
 Functions for handling conversion between the current reference frame and the native one for many conversions. More...
 
void convertFromMany (Matrix< Double > &world) const
 
void pcToXform (Matrix< Double > &xForm, const wcsprm &wcs) const
 Interconvert between wcs PC cards and Matrix xForm format. More...
 
void xFormToPC (wcsprm &wcs, const Matrix< Double > &xForm) const
 
- Protected Attributes inherited from casacore::Coordinate
Vector< DoubleworldMin_p
 toMix ranges. More...
 
Vector< DoubleworldMax_p
 

Detailed Description

Interconvert between pixel and Quality value.

Intended use:

Public interface

Review Status

Test programs:
tQualityCoordinate

Prerequisite

Synopsis


Caution: All pixel coordinates are zero relative;

Example

In this example we create a QualityCoordinate containing 'DATA' and 'ERROR'

Vector<Int> newQuality(2);
newQuality(0) = Quality::DATA;
newQuality(1) = Quality::ERROR;
qual = QualityCoordinate(newQuality);

Motivation

Definition at line 79 of file QualityCoordinate.h.

Constructor & Destructor Documentation

casacore::QualityCoordinate::QualityCoordinate ( const Vector< Int > &  whichQuality)
explicit

The length of whichQuality is the length of the axis, and the values define which quality are in which axis value.

Often the vector will be of length 2 and will contain Quality::DATA, and ERROR.

casacore::QualityCoordinate::QualityCoordinate ( const QualityCoordinate other)

Copy constructor (copy semantics)

virtual casacore::QualityCoordinate::~QualityCoordinate ( )
virtual

Destructor.

casacore::QualityCoordinate::QualityCoordinate ( )
private

Undefined and inaccessible.

Member Function Documentation

virtual Coordinate* casacore::QualityCoordinate::clone ( ) const
virtual

Make a copy of the QualityCoordinate using new.

The caller is responsible for calling delete.

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::doNearPixel ( const Coordinate other,
const Vector< Bool > &  thisAxes,
const Vector< Bool > &  otherAxes,
Double  tol = 1.0e-6 
) const
virtual

Comparison only made for specified axes in this and other Coordinate.

Reimplemented from casacore::Coordinate.

virtual String casacore::QualityCoordinate::format ( String units,
Coordinate::formatType  format,
Double  worldValue,
uInt  worldAxis,
Bool  isAbsolute = True,
Bool  showAsAbsolute = True,
Int  precision = -1,
Bool  usePrecForMixed = False 
) const
virtual

Format a QualityCoordinate world value with the common format interface (refer to the base class Coordinate for basics.

A QualityCoordinate is formatted differently from other Coordinate types. The world value is converted to the character representation as defined by the enum QualityTypes in the class Quality.

Thus, all other arguments to do with formatting and precision are ignored.

Reimplemented from casacore::Coordinate.

virtual Vector<Double> casacore::QualityCoordinate::increment ( ) const
virtual

Implements casacore::Coordinate.

virtual Matrix<Double> casacore::QualityCoordinate::linearTransform ( ) const
virtual

Implements casacore::Coordinate.

virtual void casacore::QualityCoordinate::makePixelAbsolute ( Vector< Double > &  pixel) const
virtual

Reimplemented from casacore::Coordinate.

virtual void casacore::QualityCoordinate::makePixelRelative ( Vector< Double > &  pixel) const
virtual

Make absolute coordinates relative and vice-versa.

For the QualityCoordinate relative world coordinates are defined to be the same as absolute world coordinates. Relative pixels do have meaning and are implemented (rel = abs - refPix)

Reimplemented from casacore::Coordinate.

virtual void casacore::QualityCoordinate::makeWorldAbsolute ( Vector< Double > &  world) const
virtual

Reimplemented from casacore::Coordinate.

virtual void casacore::QualityCoordinate::makeWorldRelative ( Vector< Double > &  world) const
virtual

Reimplemented from casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::near ( const Coordinate other,
Double  tol = 1e-6 
) const
virtual

Comparison function.

Any private Double data members are compared with the specified fractional tolerance. Don't compare on the specified axes in the Coordinate. If the comparison returns False, method errorMessage returns a message about why.

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::near ( const Coordinate other,
const Vector< Int > &  excludeAxes,
Double  tol = 1e-6 
) const
virtual

Implements casacore::Coordinate.

virtual uInt casacore::QualityCoordinate::nPixelAxes ( ) const
virtual

Always returns 1.

Implements casacore::Coordinate.

virtual uInt casacore::QualityCoordinate::nWorldAxes ( ) const
virtual

Implements casacore::Coordinate.

QualityCoordinate& casacore::QualityCoordinate::operator= ( const QualityCoordinate other)

Assignment (copy semantics)

Vector<Int> casacore::QualityCoordinate::quality ( ) const

Get the Quality values (Quality::QualityType) that we constructed with into a vector.

virtual Vector<Double> casacore::QualityCoordinate::referencePixel ( ) const
virtual

Implements casacore::Coordinate.

virtual Vector<Double> casacore::QualityCoordinate::referenceValue ( ) const
virtual

Implements casacore::Coordinate.

static QualityCoordinate* casacore::QualityCoordinate::restore ( const RecordInterface container,
const String fieldName 
)
static

Recover the QualityCoordinate from a record.

A null pointer means that the restoration did not succeed - probably because fieldName doesn't exist or doesn't contain a CoordinateSystem.

virtual Bool casacore::QualityCoordinate::save ( RecordInterface container,
const String fieldName 
) const
virtual

Save the QualityCoordinate into the supplied record using the supplied field name.

The field must not exist, otherwise False is returned.

Implements casacore::Coordinate.

virtual void casacore::QualityCoordinate::setDefaultWorldMixRanges ( )
virtual

Reimplemented from casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setIncrement ( const Vector< Double > &  inc)
virtual

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setLinearTransform ( const Matrix< Double > &  xform)
virtual

Implements casacore::Coordinate.

void casacore::QualityCoordinate::setQuality ( const Vector< Int > &  whichQuality)

Set a new vector of Quality values (a vector of Quality::QualityType)

virtual Bool casacore::QualityCoordinate::setReferencePixel ( const Vector< Double > &  refPix)
virtual

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setReferenceValue ( const Vector< Double > &  refval)
virtual

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setWorldAxisNames ( const Vector< String > &  names)
virtual

Set the value of the requested attribute.

For the QualityCoordinate, these have no effect (always return True) except for setWorldAxisNames.

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setWorldAxisUnits ( const Vector< String > &  units)
virtual

The set function has no effect as the units must be empty for a QualityCoordinate Always returns True.

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::setWorldMixRanges ( const IPosition shape)
virtual

Set the world min and max ranges, for use in function toMix, for a lattice of the given shape (for this coordinate).

The implementation here gives world coordinates at the start and end of the Quality axis. The output vectors are resized. Returns False if fails (and then setDefaultWorldMixRanges generates the ranges) with a reason in errorMessage(). The setDefaultWorldMixRanges function gives you [-1e99->1e99].

Reimplemented from casacore::Coordinate.

virtual String casacore::QualityCoordinate::showType ( ) const
virtual

Always returns the String "Quality".

Implements casacore::Coordinate.

virtual Bool casacore::QualityCoordinate::toPixel ( Vector< Double > &  pixel,
const Vector< Double > &  world 
) const
virtual

Implements casacore::Coordinate.

Bool casacore::QualityCoordinate::toPixel ( Int pixel,
Quality::QualityTypes  quality 
) const

Interconvert between pixel and world as a Quality type.

It returns False if no conversion could be done.

Bool casacore::QualityCoordinate::toPixel ( Double pixel,
const Double  world 
) const
private
virtual Bool casacore::QualityCoordinate::toWorld ( Vector< Double > &  world,
const Vector< Double > &  pixel,
Bool  = True 
) const
virtual

Convert a pixel to a world coordinate or vice versa.

Returns True if the conversion succeeds, otherwise it returns False and method errorMessage returns an error message. The output vectors are appropriately resized before use. The Bool parameter in toWorld() is ignored as this coordinate does not support a conversion layer frame.

Implements casacore::Coordinate.

Bool casacore::QualityCoordinate::toWorld ( Quality::QualityTypes quality,
Int  pixel 
) const
static Double casacore::QualityCoordinate::toWorld ( Quality::QualityTypes  quality)
static

Interconvert between world stored as a Double and world stored as a Quality type.

Since these functions are static, any valid Quality type can be used. The second function returns Quality::Undefined if world is illegal.

static Quality::QualityTypes casacore::QualityCoordinate::toWorld ( Double  world)
static
Bool casacore::QualityCoordinate::toWorld ( Double world,
const Double  pixel 
) const
private
virtual Coordinate::Type casacore::QualityCoordinate::type ( ) const
virtual

Returns Coordinates::QUALITY.

Implements casacore::Coordinate.

virtual Vector<String> casacore::QualityCoordinate::worldAxisNames ( ) const
virtual

Report the value of the requested attribute.

Implements casacore::Coordinate.

virtual Vector<String> casacore::QualityCoordinate::worldAxisUnits ( ) const
virtual

Implements casacore::Coordinate.

Member Data Documentation

Double casacore::QualityCoordinate::cdelt_p
private

Definition at line 257 of file QualityCoordinate.h.

Double casacore::QualityCoordinate::crpix_p
private

Definition at line 257 of file QualityCoordinate.h.

Double casacore::QualityCoordinate::crval_p
private

Keep these for subimaging purposes.

Definition at line 257 of file QualityCoordinate.h.

Double casacore::QualityCoordinate::matrix_p
private

Definition at line 257 of file QualityCoordinate.h.

String casacore::QualityCoordinate::name_p
private

Definition at line 258 of file QualityCoordinate.h.

Int casacore::QualityCoordinate::nValues_p
private

Definition at line 260 of file QualityCoordinate.h.

String casacore::QualityCoordinate::unit_p
private

Definition at line 259 of file QualityCoordinate.h.

Block<Int> casacore::QualityCoordinate::values_p
private

Definition at line 254 of file QualityCoordinate.h.


The documentation for this class was generated from the following file: