casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef LATTICES_LATTICEMATHUTIL_H
27#define LATTICES_LATTICEMATHUTIL_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/lattices/LatticeMath/LatticeStatsBase.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35template <class T> class Lattice;
36template <class T> class MaskedLattice;
37class IPosition;
38class LogIO;
39class Slicer;
40
41// <summary>Static math functions for Lattices</summary>
42// <use visibility=export>
43
44// <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
45// </reviewed>
46//
47// <prerequisite>
48// <li> <linkto class="Lattice">Lattice</linkto>
49// </prerequisite>
50//
51// <synopsis>
52// Some static helper math functions for Lattices
53// </synopsis>
54//
55// <motivation>
56// Common functionality not appropriate for Lattice member functions
57// </motivation>
58//
59// <todo asof="2001/08/27">
60// <li> nothing I know of
61// </todo>
62//
63
64
66{
67 public:
68
69// Collapse the specified axes by averaging and recover the
70// pixel values. If axes is empty, then the data just contains
71// all of the lattice (i.e. no collapse),
72// but dropDegenerateAxes is stil honoured
73 template <class T>
74 static void collapse (Array<T>& data, const IPosition& axes,
75 const MaskedLattice<T>& in,
76 Bool dropDegenerateAxes);
77//
78// Collapse the specified axes by averaging and recover either/and
79// the pixel values and mask. If axes is empty, then the data and mask just contains
80// all of the lattice (i.e. no collapse)
81// but dropDegenerateAxes is stil honoured
82 template <class T>
83 static void collapse (
85 const IPosition& axes,
86 const MaskedLattice<T>& lat,
87 Bool dropDegenerateAxes,
88 Bool getPixels=True, Bool getMask=True,
90 );
91
92};
93
94// <summary>Global functions on Lattices</summary>
95// <use visibility=export>
96
97// <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeMathUtil.cc" demos="">
98// </reviewed>
99//
100// <prerequisite>
101// <li> <linkto class="Lattice">Lattice</linkto>
102// </prerequisite>
103//
104// <synopsis>
105// Global functions using Lattices
106// </synopsis>
107//
108// <example>
109// <h4>Example 1:</h4>
110// Copy the lattice-type data between two Images.// <srcblock>
111//
112// PagedImage<Float> myImg ("myimagefile");
113// Float lmin;
114// Float lmax;
115// IPosition posMin = myImg.shape();
116// IPosition posMax = myImg.shape();
117// minMax( lmin, lmax, posMin, posMax, myImg );
118//
119// </srcblock>
120// </example>
121//
122//
123// <motivation>
124// Algorithms like CLEAN need to know the position of the MIN and MAX
125// of an image, but easy things like LEL's min and max don't tell you
126// the location of the min and max. It seems there may be other global
127// functions involving lattices.
128// </motivation>
129//
130// <todo asof="1999/10/27">
131// <li> nothing I know of
132// </todo>
133//
134// <group name=LatticeMathUtil>
136// This global function finds the max of a Lattice, and also
137// the IPositions of the max. (LEL does not get you the IPositions of the
138// min and max)
139
140 template <class T>
141 void minMax(T & min, T & max,
142 IPosition & posMin, IPosition & posMax,
143 const Lattice<T>& lat);
144
145// </group>
146
147
148} //# NAMESPACE CASACORE - END
149
150#ifndef CASACORE_NO_AUTO_TEMPLATES
151#include <casacore/lattices/LatticeMath/LatticeMathUtil.tcc>
152#endif //# CASACORE_NO_AUTO_TEMPLATES
153#endif
static void collapse(Array< T > &data, Array< Bool > &mask, const IPosition &axes, const MaskedLattice< T > &lat, Bool dropDegenerateAxes, Bool getPixels=True, Bool getMask=True, const LatticeStatsBase::StatisticsTypes stat=LatticeStatsBase::MEAN)
Collapse the specified axes by averaging and recover either/and the pixel values and mask.
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.
StatisticsTypes
This enum StatisticTypes is provided for use with the LatticeStatistics<T>::setPlotting function.
this file contains all the compiler specific defines
Definition mainpage.dox:28
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
void minMax(T &min, T &max, IPosition &posMin, IPosition &posMax, const Lattice< T > &lat)
This global function finds the max of a Lattice, and also the IPositions of the max.