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