casacore
Loading...
Searching...
No Matches
FITSQualityMask.h
Go to the documentation of this file.
1 //# FITSMask.h: A Lattice that can be used for temporary storage
2//# Copyright (C) 1997,1998,1999,2000,2001,2002
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_FITSQUALMASK_H
27#define LATTICES_FITSQUALMASK_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Array.h>
32#include <casacore/lattices/Lattices/Lattice.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37class FITSImage;
38class FITSErrorImage;
39
40// <summary>
41// Provides an on-the-fly mask for FITS quality images
42// </summary>
43
44// <use visibility=export>
45
46// <reviewed reviewer="" date="" tests="" demos="">
47// </reviewed>
48
49// <prerequisite>
50// <li> <linkto class="Lattice">Lattice</linkto>
51// <li> <linkto class="FITSImage">FITSQualityImage</linkto>
52// </prerequisite>
53
54// <etymology>
55// This class provides a pixel mask for the FITSQualityImage class.
56// </etymology>
57
58// <synopsis>
59// Masked values are indicated in FITS images via magic
60// value blanking. This class provides an on-the-fly mask.
61// The doGetSlice function reads the data values and returns
62// an Array<Bool> which is True (good) or False (bad - blanked)
63//
64// Because FITSMask inherits from Lattice<Bool> it can be
65// used as the private pixel mask data member for FITSQualityImage
66// returned by the MaskedLattice::pixelMask() functions
67//
68// The FITSQualityMask object is constructed from the FITSImage objects
69// of the data and the error extension. These must be the same one that
70// the FITSQUalityImage object constructs internally. They shared by both
71// FITSImage and FITSMask.
72//
73// </synopsis>
74//
75// <example>
76// <srcblock>
77// </srcblock>
78// </example>
79
80// <motivation>
81// FITSQualityImage provides access to FITS images with a data and and error
82// extension. It needed an efficient way to handle the pixel mask
83// other than iterating all the way through the image
84// first to set a mask.
85// </motivation>
86
87//# <todo asof="yyyy/mm/dd">
88//# <li> add this feature
89//# <li> fix this bug
90//# <li> start discussion of this possible extension
91//# </todo>
92
93
94class FITSQualityMask : public Lattice<Bool>
95{
96public:
97
98 // The pointers are not cloned, just copied.
99 FITSQualityMask (FITSImage *fitsData, FITSErrorImage *fitsError);
100
101 // Copy constructor (reference semantics).
103
104 // Destructor
106
107 // The assignment operator with reference semantics.
109
110 // Make a copy of the object (reference semantics).
111 virtual Lattice<Bool>* clone() const;
112
113 // Is the FITSMask writable? Returns False. Although it is not hard
114 // to implement writing of the mask, data values would be lost
115 // because of magic blanking.
116 virtual Bool isWritable() const;
117
118 // Return the shape of the Lattice including all degenerate
119 // axes (ie. axes with a length of one)
121
122 // Do the actual getting of an array of values.
123 virtual Bool doGetSlice (Array<Bool>& buffer, const Slicer& section);
124
125 // Do the actual getting of an array of values. Throws an exception.
126 virtual void doPutSlice (const Array<Bool>& sourceBuffer,
127 const IPosition& where,
128 const IPosition& stride);
129
130 // Set the switch for filtering 0.0
131 virtual void setFilterZero(Bool filterZero);
132
133private:
135
136 // Mask out ONLY NaN's
137 Bool filterNaN(bool* pMask, const float* pData, const uInt nelems);
138
139 // Mask out NaN's and values 0.0
140 Bool filterZeroNaN(Bool* pMask, const Float* pData, const uInt nelems);
141
142 //
147};
148
149
150
151} //# NAMESPACE CASACORE - END
152
153#endif
Bool filterNaN(bool *pMask, const float *pData, const uInt nelems)
Mask out ONLY NaN's.
virtual void doPutSlice(const Array< Bool > &sourceBuffer, const IPosition &where, const IPosition &stride)
Do the actual getting of an array of values.
virtual ~FITSQualityMask()
Destructor.
virtual void setFilterZero(Bool filterZero)
Set the switch for filtering 0.0.
FITSQualityMask & operator=(const FITSQualityMask &other)
The assignment operator with reference semantics.
FITSQualityMask(FITSImage *fitsData, FITSErrorImage *fitsError)
The pointers are not cloned, just copied.
virtual Bool doGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of an array of values.
virtual Bool isWritable() const
Is the FITSMask writable? Returns False.
Bool filterZeroNaN(Bool *pMask, const Float *pData, const uInt nelems)
Mask out NaN's and values 0.0.
FITSQualityMask(const FITSQualityMask &other)
Copy constructor (reference semantics).
FITSErrorImage * itsFitsError
virtual Lattice< Bool > * clone() const
Make a copy of the object (reference semantics).
IPosition shape() const
Return the shape of the Lattice including all degenerate axes (ie.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
float Float
Definition aipstype.h:52
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40