casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LELImageCoord.h
Go to the documentation of this file.
00001 //# LELImageCoord.h: The letter class for image coordinates
00002 //# Copyright (C) 1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: LELImageCoord.h 18093 2004-11-30 17:51:10Z ddebonis $
00027 
00028 #ifndef IMAGES_LELIMAGECOORD_H
00029 #define IMAGES_LELIMAGECOORD_H
00030 
00031 //# Includes
00032 #include <lattices/Lattices/LELLattCoord.h>
00033 #include <coordinates/Coordinates/CoordinateSystem.h>
00034 #include <images/Images/ImageInfo.h>
00035 #include <tables/Tables/TableRecord.h>
00036 #include <casa/Quanta/Unit.h>
00037 #include <casa/Utilities/CountedPtr.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 //# Forward Declarations
00042 class LatticeExprNode;
00043 class LattRegionHolder;
00044 
00045 
00046 // <summary>
00047 // The letter class for image coordinates.
00048 // </summary>
00049 
00050 // <use visibility=local>
00051 
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 
00055 // <prerequisite>
00056 //   <li> <linkto class=LELLattCoord>LELLattCoord</linkto>
00057 // </prerequisite>
00058 
00059 // <synopsis>
00060 // This class is a letter class for the envelope class
00061 // <linkto class=LELCoordinates>LELCoordinates</linkto>.
00062 // It acts as the coordinates class for Lattice objects with
00063 // proper coordinates (like PagedImage).
00064 // </synopsis> 
00065 
00066 // <motivation>
00067 // It must be possible to handle image coordinates in a lattice.
00068 // expression.
00069 // </motivation>
00070 
00071 //# <todo asof="1996/07/01">
00072 //#   <li>
00073 //# </todo>
00074 
00075 
00076 class LELImageCoord : public LELLattCoord
00077 {
00078 public:
00079   LELImageCoord();
00080 
00081   LELImageCoord (const CoordinateSystem& coords, const ImageInfo& imageInfo,
00082                  const Unit& unit, const RecordInterface& miscInfo);
00083 
00084   virtual ~LELImageCoord();
00085 
00086   // Get the coordinates.
00087   const CoordinateSystem& coordinates() const;
00088 
00089   // Get the ImageInfo.
00090   const ImageInfo& imageInfo() const;
00091 
00092   // Get the brightness unit.
00093   const Unit& unit() const;
00094 
00095   // Get the MiscInfo.
00096   const TableRecord& miscInfo() const;
00097 
00098   // Create a SubLattice for an expression node.
00099   virtual LatticeExprNode makeSubLattice
00100                                     (const LatticeExprNode& expr,
00101                                      const LattRegionHolder& region) const;
00102 
00103   // Create an extension for an expression node.
00104   virtual LatticeExprNode makeExtendLattice
00105                                     (const LatticeExprNode& expr,
00106                                      const IPosition& newShape,
00107                                      const LELLattCoordBase& newCoord) const;
00108 
00109   // Create a rebinning for an expression node.
00110   virtual LatticeExprNode makeRebinLattice
00111                                     (const LatticeExprNode& expr,
00112                                      const IPosition& binning) const;
00113 
00114   // The class has true coordinates (thus returns True).
00115   virtual Bool hasCoordinates() const;
00116 
00117   // Get the coordinates of the spectral axis for the given shape.
00118   // It returns the pixel axis number of the spectral coordinates.
00119   // -1 indicates that there is no pixel spectral axis.
00120   // An exception is thrown if there are no world spectral coordinates.
00121   virtual uInt getSpectralInfo (Vector<Double>& worldCoordinates,
00122                                 const IPosition& shape) const;
00123 
00124   // The name of the class.
00125   virtual String classname() const;
00126 
00127   // Check how the coordinates of this and that compare.
00128   // The return value tells how they compare.
00129   // <br>-1: this is subset
00130   // <br>0: equal 
00131   // <br>1: this is superset
00132   // <br>9: invalid (mismatch)
00133   virtual Int compare (const LELLattCoordBase& other) const;
00134 
00135   // Check how the coordinates of this and that image compare.
00136   // This function is used by <src>conform</src> to make a
00137   // double virtual dispatch possible.
00138   virtual Int doCompare (const LELImageCoord& other) const;
00139 
00140 private:
00141   CountedPtr<CoordinateSystem> coords_p;
00142   ImageInfo   imageInfo_p;
00143   Unit        unit_p;
00144   TableRecord miscInfo_p;
00145 };
00146 
00147 
00148 inline const CoordinateSystem& LELImageCoord::coordinates() const
00149 {
00150   return *coords_p;
00151 }
00152 
00153 inline const ImageInfo& LELImageCoord::imageInfo() const
00154 {
00155   return imageInfo_p;
00156 }
00157 
00158 inline const Unit& LELImageCoord::unit() const
00159 {
00160   return unit_p;
00161 }
00162 
00163 inline const TableRecord& LELImageCoord::miscInfo() const
00164 {
00165   return miscInfo_p;
00166 }
00167 
00168 
00169 
00170 } //# NAMESPACE CASA - END
00171 
00172 #endif