LatticeUtilities.h

Go to the documentation of this file.
00001 //# LatticeUtilities.h: useful global functions for Lattices
00002 //# Copyright (C) 1995,1996,1997,1999,2000,2001,2002,2004
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_LATTICEUTILITIES_H
00029 #define LATTICES_LATTICEUTILITIES_H
00030 
00031 #include <casacore/casa/aips.h>
00032 
00033 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00034 
00035 template <class T> class Array;
00036 template <class T> class Lattice;
00037 template <class T> class MaskedLattice;
00038 template <class T> class MaskedArray;
00039 class IPosition;
00040 class LogIO;
00041 class Slicer;
00042 
00043 // <summary>Static functions for Lattices</summary>
00044 // <use visibility=export>
00045 
00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeUtilities.cc" demos="">
00047 // </reviewed>
00048 //
00049 // <prerequisite>
00050 //   <li> <linkto class="Lattice">Lattice</linkto>
00051 // </prerequisite>
00052 //
00053 // <synopsis>
00054 // Some static helper functions for Lattices
00055 // </synopsis>
00056 //
00057 // <motivation>
00058 // Common functionality not appropriate for Lattice member functions
00059 // </motivation>
00060 //
00061 // <todo asof="2001/08/27">
00062 //   <li> nothing I know of
00063 // </todo>
00064 //
00065 
00066 
00067 class LatticeUtilities 
00068 {
00069    public:
00070 
00071 // Copy data and mask from input to output.  If the input has no mask,
00072 // that means all True (good), and these values will be transferred
00073 // to the output.   Mask transfer only  occurs if the output has
00074 // a writeable mask.
00075    template <class T>
00076    static void copyDataAndMask (LogIO& os, MaskedLattice<T>& out,
00077                                 const MaskedLattice<T>& in, Bool zeroMasked=False);
00078 
00079 // Replicate array through lattice in the specified region.
00080 // The shape of <src>pixels</src> has to fit exactly into the shape of
00081 // the selected region for each axis of <src>pixels</src>. Otherwise
00082 // and exception will be thrown. For example,
00083 // if the shape of the region is [10,20], the shape of pixels could
00084 // be [10] and it will be replicated 20 times.  Another example would
00085 // be that the shape of pixels could be [5,10] and it would be
00086 // replicated 4 times fitting into the Lattice
00087    template <class T>
00088    static void replicate (Lattice<T>& lat,
00089                           const Slicer& region,
00090                           const Array<T>& pixels);
00091 
00092 // Bin up one axis of MaskedArray (uses Lattices in implementation)
00093    template <class T>
00094    static void bin (MaskedArray<T>& out, const MaskedArray<T>& in, uInt axis, uInt bin);
00095 
00096 // Add degenerate axes to the lattice if needed (nDim is the desired number of dimensions
00097 // for the output lattice).  If the shapes are the same, the returned
00098 // pointer holds a SubLattice.  If a reshape was necessary, the pointer
00099 // holds an ExtendLattice.  The pointer is the callers responsibility to delete.
00100    template <class T>
00101    static void addDegenerateAxes (Lattice<T>*& pLatOut, const Lattice<T>& latIn, uInt nDim);
00102 };
00103 
00104 
00105 } //# NAMESPACE CASACORE - END
00106 
00107 #ifndef CASACORE_NO_AUTO_TEMPLATES
00108 #include <casacore/lattices/Lattices/LatticeUtilities.tcc>
00109 #endif //# CASACORE_NO_AUTO_TEMPLATES
00110 #endif
00111 
00112 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1