LCHDF5Mask.h

Go to the documentation of this file.
00001 //# LCHDF5Mask.h: Class to define a rectangular mask of interest
00002 //# Copyright (C) 2008
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 LATTICES_LCHDF5MASK_H
00029 #define LATTICES_LCHDF5MASK_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/lattices/LRegions/LCBox.h>
00034 #include <casacore/lattices/Lattices/HDF5Lattice.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038   // <summary>
00039   // Class to define a rectangular mask as a region
00040   // </summary>
00041 
00042   // <use visibility=local>
00043 
00044   // <reviewed reviewer="" date="" tests="">
00045   // </reviewed>
00046 
00047   // <prerequisite>
00048   //   <li> <linkto class=LCRegionSingle>LCRegionSingle</linkto>
00049   // </prerequisite>
00050 
00051   // <synopsis> 
00052   // The LCHDF5Mask class is a specialization of class
00053   // <linkto class=LCRegionSingle>LCRegionSingle</linkto>.
00054   // It holds a mask for an HDF5Image in an HDF5Lattice<Bool> object.
00055   // </synopsis> 
00056 
00057   class LCHDF5Mask: public LCRegionSingle
00058   {
00059   public:
00060     LCHDF5Mask();
00061 
00062     // Construct an HDF5Mask object for (part of) a lattice.
00063     // It is put in group Masks of the HDF5 file.
00064     // The group is created if not existing yet.
00065     // The box defines the position of the mask.
00066     // The default mask shape is the lattice shape.
00067     // <group>
00068     LCHDF5Mask (const TiledShape& latticeShape,
00069                 const CountedPtr<HDF5File>& file, const String& maskName);
00070     LCHDF5Mask (const TiledShape& maskShape, const LCBox& box,
00071                 const CountedPtr<HDF5File>& file, const String& maskName);
00072     LCHDF5Mask (HDF5Lattice<Bool>& mask, const LCBox& box);
00073     // </group>
00074 
00075     // Copy constructor (copy semantics).
00076     LCHDF5Mask (const LCHDF5Mask& other);
00077 
00078     // Destructor
00079     virtual ~LCHDF5Mask();
00080 
00081     // Assignment (reference semantics).
00082     LCHDF5Mask& operator= (const LCHDF5Mask& other);
00083 
00084     // Comparison
00085     virtual Bool operator==(const LCRegion& other) const;
00086 
00087     // Make a copy of the derived object.
00088     virtual LCRegion* cloneRegion() const;
00089 
00090     // This function is used by the LatticeIterator class to generate an
00091     // iterator of the correct type for this Lattice. Not recommended
00092     // for general use. 
00093     virtual LatticeIterInterface<Bool>* makeIter
00094                                    (const LatticeNavigator& navigator,
00095                                     Bool useRef) const;
00096 
00097     // Returns the maximum recommended number of pixels for a cursor.
00098     // This is the number of pixels in a tile. 
00099     virtual uInt advisedMaxPixels() const;
00100 
00101     // Help the user pick a cursor for most efficient access.
00102     virtual IPosition doNiceCursorShape (uInt maxPixels) const;
00103 
00104     // Flush the data (but do not unlock).
00105     virtual void flush();
00106 
00107     // Get the class name (to store in the record).
00108     static String className();
00109 
00110     // Region type. Returns class name.
00111     virtual String type() const;
00112 
00113     // Convert the (derived) object to a record.
00114     virtual TableRecord toRecord (const String& tableName) const;
00115 
00116     // Convert correct object from a record.
00117     static LCHDF5Mask* fromRecord (const TableRecord&,
00118                                    const String& tablename);
00119 
00120     // An LCHDF5Mask is writable if the underlying HDF5Lattice is.
00121     virtual Bool isWritable() const;
00122 
00123   protected:
00124     // Construct another LCHDF5Mask (for e.g. another lattice) by moving
00125     // this one. It recalculates the bounding mask.
00126     // A positive translation value indicates "to right".
00127     virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
00128                                    const IPosition& newLatticeShape) const;
00129 
00130   private:
00131     // Create the object from a record (for an existing mask).
00132     LCHDF5Mask (HDF5Lattice<Bool>& mask,
00133                 const IPosition& blc,
00134                 const IPosition& latticeShape);
00135 
00136 
00137     LCBox             itsBox;
00138     HDF5Lattice<Bool> itsMask;
00139   };
00140 
00141 
00142 
00143 } //# NAMESPACE CASACORE - END
00144 
00145 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1