casa
$Rev:20696$
|
00001 //# LCLELMask.h: Class to define a mask as a LEL expression 00002 //# Copyright (C) 2000 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 //# $Id: LCLELMask.h 18093 2004-11-30 17:51:10Z ddebonis $ 00026 00027 00028 00029 #ifndef LATTICES_LCLELMASK_H 00030 #define LATTICES_LCLELMASK_H 00031 00032 //# Includes 00033 #include <lattices/Lattices/LCRegionSingle.h> 00034 #include <lattices/Lattices/LCBox.h> 00035 #include <lattices/Lattices/LatticeExpr.h> 00036 00037 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 00040 //# Forward Declarations 00041 class TableRecord; 00042 class IPosition; 00043 00044 00045 // <summary> 00046 // Class to define a mask as a LEL expression 00047 // </summary> 00048 00049 // <use visibility=export> 00050 00051 // <reviewed reviewer="" date="" tests=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 // <li> <linkto class=LCRegion>LCRegion</linkto> 00056 // <li> <linkto class=ImageExpr>ImageExpr</linkto> 00057 // </prerequisite> 00058 00059 // <synopsis> 00060 // The LCLELMask class is a specialization of class 00061 // <linkto class=LCRegion>LCRegion</linkto>. 00062 // <br> 00063 // It can be used to define an on-the-fly mask for a lattice 00064 // using a boolean <linkto class=LatticeExpr>LatticeExpr</linkto>. 00065 // The contents of the mask are calculated on the fly from the expression. 00066 // Thus the mask may change if the data in the lattice(s) used in the 00067 // expression change. 00068 // <note role=caution> 00069 // This mask is not persistent, thus it cannot be saved with an image. 00070 // Use class <linkto class=WCLELMask>WCLELMask</linkto> to have a 00071 // persistent on-the-fly mask. It means that normally a WCLELMask should 00072 // be used (which gets converted to an LCLELMask when applied to an image). 00073 // </note> 00074 // </synopsis> 00075 00076 // <example> 00077 // </example> 00078 00079 // <motivation> 00080 // LCLELMask is needed to make 00081 // </motivation> 00082 00083 //# <todo asof="1998/05/20"> 00084 //# <li> 00085 //# </todo> 00086 00087 class LCLELMask : public LCRegionSingle 00088 { 00089 public: 00090 LCLELMask(); 00091 00092 // Construct from vectors of world coordinates 00093 // defining the box corners. It is assumed that the 00094 // order of the values is in the order of the pixel axes. 00095 explicit LCLELMask (const LatticeExpr<Bool>& expr); 00096 00097 // Copy constructor (copy semantics). 00098 LCLELMask (const LCLELMask& other); 00099 00100 // Destructor 00101 virtual ~LCLELMask(); 00102 00103 // Assignment (copy semantics) 00104 LCLELMask& operator= (const LCLELMask& other); 00105 00106 // Comparison 00107 virtual Bool operator== (const LCRegion& other) const; 00108 00109 // Clone a LCLELMask object. 00110 virtual LCRegion* cloneRegion() const; 00111 00112 // Handle the (un)locking. 00113 // <group> 00114 virtual Bool lock (FileLocker::LockType, uInt nattempts); 00115 virtual void unlock(); 00116 virtual Bool hasLock (FileLocker::LockType) const; 00117 // </group> 00118 00119 // Resynchronize the PagedArray object with the lattice file. 00120 // This function is only useful if no read-locking is used, ie. 00121 // if the table lock option is UserNoReadLocking or AutoNoReadLocking. 00122 // In that cases the table system does not acquire a read-lock, thus 00123 // does not synchronize itself automatically. 00124 virtual void resync(); 00125 00126 // Temporarily close the lattice. 00127 // It will be reopened automatically on the next access. 00128 virtual void tempClose(); 00129 00130 // Explicitly reopen the temporarily closed lattice. 00131 virtual void reopen(); 00132 00133 // Returns LCLELMask 00134 static String className(); 00135 00136 // Return region type. Returns the class name 00137 virtual String type() const; 00138 00139 // Convert the LCLELMask object to a record. 00140 // This cannot be done as a Lattice expression cannot be made persistent 00141 // (only Image expressions can, thus only WCLELMask is persistent). 00142 // <br>So this function throws an exception. 00143 virtual TableRecord toRecord (const String& tableName) const; 00144 00145 00146 protected: 00147 // Translating an LCLELMask is not possible, so it throws an exception. 00148 virtual LCRegion* doTranslate (const Vector<Float>& translateVector, 00149 const IPosition& newLatticeShape) const; 00150 00151 private: 00152 LCBox itsBox; 00153 LatticeExpr<Bool> itsExpr; 00154 }; 00155 00156 00157 00158 } //# NAMESPACE CASA - END 00159 00160 #endif