casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeUtilities.h
Go to the documentation of this file.
1 //# LatticeUtilities.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$
27 
28 #ifndef LATTICES_LATTICEUTILITIES_H
29 #define LATTICES_LATTICEUTILITIES_H
30 
31 #include <casacore/casa/aips.h>
32 
33 namespace casacore { //# NAMESPACE CASACORE - BEGIN
34 
35 template <class T> class Array;
36 template <class T> class Lattice;
37 template <class T> class MaskedLattice;
38 template <class T> class MaskedArray;
39 class IPosition;
40 class LogIO;
41 class Slicer;
42 
43 // <summary>Static functions for Lattices</summary>
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeUtilities.cc" demos="">
47 // </reviewed>
48 //
49 // <prerequisite>
50 // <li> <linkto class="Lattice">Lattice</linkto>
51 // </prerequisite>
52 //
53 // <synopsis>
54 // Some static helper 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 // Copy data and mask from input to output. If the input has no mask,
72 // that means all True (good), and these values will be transferred
73 // to the output. Mask transfer only occurs if the output has
74 // a writeable mask.
75  template <class T>
76  static void copyDataAndMask (LogIO& os, MaskedLattice<T>& out,
77  const MaskedLattice<T>& in, Bool zeroMasked=False);
78 
79 // Replicate array through lattice in the specified region.
80 // The shape of <src>pixels</src> has to fit exactly into the shape of
81 // the selected region for each axis of <src>pixels</src>. Otherwise
82 // and exception will be thrown. For example,
83 // if the shape of the region is [10,20], the shape of pixels could
84 // be [10] and it will be replicated 20 times. Another example would
85 // be that the shape of pixels could be [5,10] and it would be
86 // replicated 4 times fitting into the Lattice
87  template <class T>
88  static void replicate (Lattice<T>& lat,
89  const Slicer& region,
90  const Array<T>& pixels);
91 
92 // Bin up one axis of MaskedArray (uses Lattices in implementation)
93  template <class T>
94  static void bin (MaskedArray<T>& out, const MaskedArray<T>& in, uInt axis, uInt bin);
95 
96 // Add degenerate axes to the lattice if needed (nDim is the desired number of dimensions
97 // for the output lattice). If the shapes are the same, the returned
98 // pointer holds a SubLattice. If a reshape was necessary, the pointer
99 // holds an ExtendLattice. The pointer is the callers responsibility to delete.
100  template <class T>
101  static void addDegenerateAxes (Lattice<T>*& pLatOut, const Lattice<T>& latIn, uInt nDim);
102 };
103 
104 
105 } //# NAMESPACE CASACORE - END
106 
107 #ifndef CASACORE_NO_AUTO_TEMPLATES
108 #include <casacore/lattices/Lattices/LatticeUtilities.tcc>
109 #endif //# CASACORE_NO_AUTO_TEMPLATES
110 #endif
111 
112 
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
static void bin(MaskedArray< T > &out, const MaskedArray< T > &in, uInt axis, uInt bin)
Bin up one axis of MaskedArray (uses Lattices in implementation)
A templated, abstract base class for array-like objects with masks.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
static void replicate(Lattice< T > &lat, const Slicer &region, const Array< T > &pixels)
Replicate array through lattice in the specified region.
Class for masking an Array for operations on that Array.
A templated, abstract base class for array-like objects.
Static functions for Lattices.
static void addDegenerateAxes(Lattice< T > *&pLatOut, const Lattice< T > &latIn, uInt nDim)
Add degenerate axes to the lattice if needed (nDim is the desired number of dimensions for the output...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
static void copyDataAndMask(LogIO &os, MaskedLattice< T > &out, const MaskedLattice< T > &in, Bool zeroMasked=False)
Copy data and mask from input to output.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42