LCLELMask.h

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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1