LatticeMathUtil.h

Go to the documentation of this file.
00001 //# LatticeMathUtil.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: LatticeUtilities.h 21538 2015-01-07 09:08:57Z gervandiepen $
00027 
00028 #ifndef LATTICES_LATTICEMATHUTIL_H
00029 #define LATTICES_LATTICEMATHUTIL_H
00030 
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/lattices/LatticeMath/LatticeStatsBase.h>
00033 
00034 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00035 
00036 template <class T> class Array;
00037 template <class T> class Lattice;
00038 template <class T> class MaskedLattice;
00039 template <class T> class MaskedArray;
00040 class IPosition;
00041 class LogIO;
00042 class Slicer;
00043 
00044 // <summary>Static math functions for Lattices</summary>
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
00048 // </reviewed>
00049 //
00050 // <prerequisite>
00051 //   <li> <linkto class="Lattice">Lattice</linkto>
00052 // </prerequisite>
00053 //
00054 // <synopsis>
00055 // Some static helper math functions for Lattices
00056 // </synopsis>
00057 //
00058 // <motivation>
00059 // Common functionality not appropriate for Lattice member functions
00060 // </motivation>
00061 //
00062 // <todo asof="2001/08/27">
00063 //   <li> nothing I know of
00064 // </todo>
00065 //
00066 
00067 
00068 class LatticeMathUtil
00069 {
00070    public:
00071 
00072 // Collapse the specified axes by averaging and recover the
00073 // pixel values.  If axes is empty, then the data just contains
00074 // all of the lattice (i.e. no collapse), 
00075 // but dropDegenerateAxes is stil honoured
00076    template <class T>
00077    static void collapse (Array<T>& data, const IPosition& axes,
00078                          const MaskedLattice<T>& in,
00079                          Bool dropDegenerateAxes);
00080 //
00081 // Collapse the specified axes by averaging and recover either/and
00082 // the pixel values and mask. If axes is empty, then the data and mask just contains
00083 // all of the lattice (i.e. no collapse)
00084 // but dropDegenerateAxes is stil honoured
00085    template <class T>
00086    static void collapse (
00087         Array<T>& data, Array<Bool>& mask,
00088     const IPosition& axes,
00089     const MaskedLattice<T>& lat,
00090     Bool dropDegenerateAxes,
00091     Bool getPixels=True, Bool getMask=True,
00092     const LatticeStatsBase::StatisticsTypes stat=LatticeStatsBase::MEAN
00093    );
00094 
00095 };
00096 
00097 // <summary>Global functions on Lattices</summary>
00098 // <use visibility=export>
00099 
00100 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
00101 // </reviewed>
00102 //
00103 // <prerequisite>
00104 //   <li> <linkto class="Lattice">Lattice</linkto>
00105 // </prerequisite>
00106 //
00107 // <synopsis>
00108 // Global functions using Lattices
00109 // </synopsis>
00110 //
00111 // <example>
00112 // <h4>Example 1:</h4>
00113 // Copy the lattice-type data between two Images.// <srcblock>
00114 //
00115 // PagedImage<Float> myImg ("myimagefile");
00116 // Float lmin;
00117 // Float lmax;
00118 // IPosition posMin = myImg.shape();
00119 // IPosition posMax = myImg.shape();
00120 // minMax( lmin, lmax, posMin, posMax, myImg );
00121 //
00122 // </srcblock>
00123 // </example>
00124 //
00125 //
00126 // <motivation>
00127 // Algorithms like CLEAN need to know the position of the MIN and MAX
00128 // of an image, but easy things like LEL's min and max don't tell you
00129 // the location of the min and max.  It seems there may be other global
00130 // functions involving lattices.
00131 // </motivation>
00132 //
00133 // <todo asof="1999/10/27">
00134 //   <li> nothing I know of
00135 // </todo>
00136 //
00137 // <group name=LatticeMathUtil>
00138 
00139 // This global function finds the max of a Lattice, and also
00140 // the IPositions of the max.  (LEL does not get you the IPositions of the
00141 // min and max)
00142 
00143    template <class T>
00144    void minMax(T & min, T & max, 
00145                IPosition & posMin, IPosition & posMax, 
00146                const Lattice<T>& lat);
00147 
00148 // </group>
00149 
00150 
00151 } //# NAMESPACE CASACORE - END
00152 
00153 #ifndef CASACORE_NO_AUTO_TEMPLATES
00154 #include <casacore/lattices/LatticeMath/LatticeMathUtil.tcc>
00155 #endif //# CASACORE_NO_AUTO_TEMPLATES
00156 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1