casacore
Loading...
Searching...
No Matches
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: 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_LATTICEUTILITIES_H
27#define LATTICES_LATTICEUTILITIES_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/ArrayFwd.h>
31
32namespace casacore { //# NAMESPACE CASACORE - BEGIN
33
34template <class T> class Lattice;
35template <class T> class MaskedLattice;
36class IPosition;
37class LogIO;
38class Slicer;
39
40// <summary>Static functions for Lattices</summary>
41// <use visibility=export>
42
43// <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeUtilities.cc" demos="">
44// </reviewed>
45//
46// <prerequisite>
47// <li> <linkto class="Lattice">Lattice</linkto>
48// </prerequisite>
49//
50// <synopsis>
51// Some static helper functions for Lattices
52// </synopsis>
53//
54// <motivation>
55// Common functionality not appropriate for Lattice member functions
56// </motivation>
57//
58// <todo asof="2001/08/27">
59// <li> nothing I know of
60// </todo>
61//
62
63
65{
66 public:
67
68// Copy data and mask from input to output. If the input has no mask,
69// that means all True (good), and these values will be transferred
70// to the output. Mask transfer only occurs if the output has
71// a writeable mask.
72 template <class T>
73 static void copyDataAndMask (LogIO& os, MaskedLattice<T>& out,
74 const MaskedLattice<T>& in, Bool zeroMasked=False);
75
76// Replicate array through lattice in the specified region.
77// The shape of <src>pixels</src> has to fit exactly into the shape of
78// the selected region for each axis of <src>pixels</src>. Otherwise
79// and exception will be thrown. For example,
80// if the shape of the region is [10,20], the shape of pixels could
81// be [10] and it will be replicated 20 times. Another example would
82// be that the shape of pixels could be [5,10] and it would be
83// replicated 4 times fitting into the Lattice
84 template <class T>
85 static void replicate (Lattice<T>& lat,
86 const Slicer& region,
87 const Array<T>& pixels);
88
89// Bin up one axis of MaskedArray (uses Lattices in implementation)
90 template <class T>
91 static void bin (MaskedArray<T>& out, const MaskedArray<T>& in, uInt axis, uInt bin);
92
93// Add degenerate axes to the lattice if needed (nDim is the desired number of dimensions
94// for the output lattice). If the shapes are the same, the returned
95// pointer holds a SubLattice. If a reshape was necessary, the pointer
96// holds an ExtendLattice. The pointer is the callers responsibility to delete.
97 template <class T>
98 static void addDegenerateAxes (Lattice<T>*& pLatOut, const Lattice<T>& latIn, uInt nDim);
99};
100
101
102} //# NAMESPACE CASACORE - END
103
104#ifndef CASACORE_NO_AUTO_TEMPLATES
105#include <casacore/lattices/Lattices/LatticeUtilities.tcc>
106#endif //# CASACORE_NO_AUTO_TEMPLATES
107#endif
108
109
static void copyDataAndMask(LogIO &os, MaskedLattice< T > &out, const MaskedLattice< T > &in, Bool zeroMasked=False)
Copy data and mask from input to output.
static void bin(MaskedArray< T > &out, const MaskedArray< T > &in, uInt axis, uInt bin)
Bin up one axis of MaskedArray (uses Lattices in implementation)
static void replicate(Lattice< T > &lat, const Slicer &region, const Array< T > &pixels)
Replicate array through lattice in the specified region.
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...
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40