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$ 00027 00028 #ifndef IMAGES_LELIMAGECOORD_H 00029 #define IMAGES_LELIMAGECOORD_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/lattices/LEL/LELLattCoord.h> 00034 #include <casacore/coordinates/Coordinates/CoordinateSystem.h> 00035 #include <casacore/images/Images/ImageInfo.h> 00036 #include <casacore/tables/Tables/TableRecord.h> 00037 #include <casacore/casa/Quanta/Unit.h> 00038 #include <casacore/casa/Utilities/CountedPtr.h> 00039 00040 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00041 00042 //# Forward Declarations 00043 class LatticeExprNode; 00044 class LattRegionHolder; 00045 00046 00047 // <summary> 00048 // The letter class for image coordinates. 00049 // </summary> 00050 00051 // <use visibility=local> 00052 00053 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00054 // </reviewed> 00055 00056 // <prerequisite> 00057 // <li> <linkto class=LELLattCoord>LELLattCoord</linkto> 00058 // </prerequisite> 00059 00060 // <synopsis> 00061 // This class is a letter class for the envelope class 00062 // <linkto class=LELCoordinates>LELCoordinates</linkto>. 00063 // It acts as the coordinates class for Lattice objects with 00064 // proper coordinates (like PagedImage). 00065 // </synopsis> 00066 00067 // <motivation> 00068 // It must be possible to handle image coordinates in a lattice. 00069 // expression. 00070 // </motivation> 00071 00072 //# <todo asof="1996/07/01"> 00073 //# <li> 00074 //# </todo> 00075 00076 00077 class LELImageCoord : public LELLattCoord 00078 { 00079 public: 00080 LELImageCoord(); 00081 00082 LELImageCoord (const CoordinateSystem& coords, const ImageInfo& imageInfo, 00083 const Unit& unit, const RecordInterface& miscInfo); 00084 00085 virtual ~LELImageCoord(); 00086 00087 // Get the coordinates. 00088 const CoordinateSystem& coordinates() const; 00089 00090 // Get the ImageInfo. 00091 const ImageInfo& imageInfo() const; 00092 00093 // Get the brightness unit. 00094 const Unit& unit() const; 00095 00096 // Get the MiscInfo. 00097 const TableRecord& miscInfo() const; 00098 00099 // Create a SubLattice for an expression node. 00100 virtual LatticeExprNode makeSubLattice 00101 (const LatticeExprNode& expr, 00102 const LattRegionHolder& region) const; 00103 00104 // Create an extension for an expression node. 00105 virtual LatticeExprNode makeExtendLattice 00106 (const LatticeExprNode& expr, 00107 const IPosition& newShape, 00108 const LELLattCoordBase& newCoord) const; 00109 00110 // Create a rebinning for an expression node. 00111 virtual LatticeExprNode makeRebinLattice 00112 (const LatticeExprNode& expr, 00113 const IPosition& binning) const; 00114 00115 // The class has true coordinates (thus returns True). 00116 virtual Bool hasCoordinates() const; 00117 00118 // Get the coordinates of the spectral axis for the given shape. 00119 // It returns the pixel axis number of the spectral coordinates. 00120 // -1 indicates that there is no pixel spectral axis. 00121 // An exception is thrown if there are no world spectral coordinates. 00122 virtual uInt getSpectralInfo (Vector<Double>& worldCoordinates, 00123 const IPosition& shape) const; 00124 00125 // The name of the class. 00126 virtual String classname() const; 00127 00128 // Check how the coordinates of this and that compare. 00129 // The return value tells how they compare. 00130 // <br>-1: this is subset 00131 // <br>0: equal 00132 // <br>1: this is superset 00133 // <br>9: invalid (mismatch) 00134 virtual Int compare (const LELLattCoordBase& other) const; 00135 00136 // Check how the coordinates of this and that image compare. 00137 // This function is used by <src>conform</src> to make a 00138 // double virtual dispatch possible. 00139 virtual Int doCompare (const LELImageCoord& other) const; 00140 00141 private: 00142 CountedPtr<CoordinateSystem> coords_p; 00143 ImageInfo imageInfo_p; 00144 Unit unit_p; 00145 TableRecord miscInfo_p; 00146 }; 00147 00148 00149 inline const CoordinateSystem& LELImageCoord::coordinates() const 00150 { 00151 return *coords_p; 00152 } 00153 00154 inline const ImageInfo& LELImageCoord::imageInfo() const 00155 { 00156 return imageInfo_p; 00157 } 00158 00159 inline const Unit& LELImageCoord::unit() const 00160 { 00161 return unit_p; 00162 } 00163 00164 inline const TableRecord& LELImageCoord::miscInfo() const 00165 { 00166 return miscInfo_p; 00167 } 00168 00169 00170 00171 } //# NAMESPACE CASACORE - END 00172 00173 #endif