casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeMathUtil.h
Go to the documentation of this file.
1 //# LatticeMathUtil.h: useful global functions for Lattices
2 //# Copyright (C) 1995,1996,1997,1999,2000,2001,2002,2004
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: LatticeUtilities.h 21538 2015-01-07 09:08:57Z gervandiepen $
27 
28 #ifndef LATTICES_LATTICEMATHUTIL_H
29 #define LATTICES_LATTICEMATHUTIL_H
30 
31 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 template <class T> class Lattice;
38 template <class T> class MaskedLattice;
39 class IPosition;
40 class LogIO;
41 class Slicer;
42 
43 // <summary>Static math functions for Lattices</summary>
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
47 // </reviewed>
48 //
49 // <prerequisite>
50 // <li> <linkto class="Lattice">Lattice</linkto>
51 // </prerequisite>
52 //
53 // <synopsis>
54 // Some static helper math functions for Lattices
55 // </synopsis>
56 //
57 // <motivation>
58 // Common functionality not appropriate for Lattice member functions
59 // </motivation>
60 //
61 // <todo asof="2001/08/27">
62 // <li> nothing I know of
63 // </todo>
64 //
65 
66 
68 {
69  public:
70 
71 // Collapse the specified axes by averaging and recover the
72 // pixel values. If axes is empty, then the data just contains
73 // all of the lattice (i.e. no collapse),
74 // but dropDegenerateAxes is stil honoured
75  template <class T>
76  static void collapse (Array<T>& data, const IPosition& axes,
77  const MaskedLattice<T>& in,
78  Bool dropDegenerateAxes);
79 //
80 // Collapse the specified axes by averaging and recover either/and
81 // the pixel values and mask. If axes is empty, then the data and mask just contains
82 // all of the lattice (i.e. no collapse)
83 // but dropDegenerateAxes is stil honoured
84  template <class T>
85  static void collapse (
86  Array<T>& data, Array<Bool>& mask,
87  const IPosition& axes,
88  const MaskedLattice<T>& lat,
89  Bool dropDegenerateAxes,
90  Bool getPixels=True, Bool getMask=True,
92  );
93 
94 };
95 
96 // <summary>Global functions on Lattices</summary>
97 // <use visibility=export>
98 
99 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
100 // </reviewed>
101 //
102 // <prerequisite>
103 // <li> <linkto class="Lattice">Lattice</linkto>
104 // </prerequisite>
105 //
106 // <synopsis>
107 // Global functions using Lattices
108 // </synopsis>
109 //
110 // <example>
111 // <h4>Example 1:</h4>
112 // Copy the lattice-type data between two Images.// <srcblock>
113 //
114 // PagedImage<Float> myImg ("myimagefile");
115 // Float lmin;
116 // Float lmax;
117 // IPosition posMin = myImg.shape();
118 // IPosition posMax = myImg.shape();
119 // minMax( lmin, lmax, posMin, posMax, myImg );
120 //
121 // </srcblock>
122 // </example>
123 //
124 //
125 // <motivation>
126 // Algorithms like CLEAN need to know the position of the MIN and MAX
127 // of an image, but easy things like LEL's min and max don't tell you
128 // the location of the min and max. It seems there may be other global
129 // functions involving lattices.
130 // </motivation>
131 //
132 // <todo asof="1999/10/27">
133 // <li> nothing I know of
134 // </todo>
135 //
136 // <group name=LatticeMathUtil>
138 // This global function finds the max of a Lattice, and also
139 // the IPositions of the max. (LEL does not get you the IPositions of the
140 // min and max)
141 
142  template <class T>
143  void minMax(T & min, T & max,
144  IPosition & posMin, IPosition & posMax,
145  const Lattice<T>& lat);
146 
147 // </group>
148 
149 
150 } //# NAMESPACE CASACORE - END
151 
152 #ifndef CASACORE_NO_AUTO_TEMPLATES
153 #include <casacore/lattices/LatticeMath/LatticeMathUtil.tcc>
154 #endif //# CASACORE_NO_AUTO_TEMPLATES
155 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
A templated, abstract base class for array-like objects with masks.
Definition: ImageConcat.h:46
A templated, abstract base class for array-like objects.
Definition: Functional.h:37
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void minMax(T &min, T &max, const TableVector< T > &tv)
Definition: TabVecMath.h:390
StatisticsTypes
This enum StatisticTypes is provided for use with the LatticeStatistics&lt;T&gt;::setPlotting function...
static void collapse(Array< T > &data, const IPosition &axes, const MaskedLattice< T > &in, Bool dropDegenerateAxes)
Collapse the specified axes by averaging and recover the pixel values.
const Bool True
Definition: aipstype.h:43
Static math functions for Lattices.