casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WCResampleHandler.h
Go to the documentation of this file.
1 //# WCResampleHandler.h: base class for resampling data pixels to the screen
2 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000
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 TRIALDISPLAY_WCRESAMPLEHANDLER_H
29 #define TRIALDISPLAY_WCRESAMPLEHANDLER_H
30 
31 #include <casa/aips.h>
32 #include <casa/Arrays/Vector.h>
33 
34 namespace casacore{
35 
36  template <class T> class Matrix;
37 }
38 
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41 
42 // <summary>
43 // Base class for resampling data pixels to World/PixelCanvas pixels.
44 // </summary>
45 //
46 // <prerequisite>
47 // <li> Display library image drawing process
48 // </prerequisite>
49 //
50 // <etymology>
51 // The name of WCResampleHandler comes from
52 // WorldCanvas + Resample + Handler
53 // </etymology>
54 //
55 // <synopsis>
56 // WCResampleHandler is the tool used to extract a rectangular
57 // subregion of an image for purposes of display. This class is
58 // abstract and defines the interface the
59 // <linkto class="WorldCanvas">WorldCanvas</linkto> sees.
60 //
61 // When the resample handler fires, it extracts a rectangular subregion
62 // of its input matrix and stores it in its output matrix. If
63 // the default subregion is the whole image and the output image is
64 // the same size as the input image, then the output image is
65 // a copy of the input image.
66 //
67 // If not, the subregion of the image is resampled to fit the output
68 // matrix size.
69 // </synopsis>
70 //
71 // <motivation>
72 // Objectify the concept of resampling to allow programmers
73 // to write their own, more complicated versions and register
74 // them with the WorldCanvas.
75 // </motivation>
76 
78 
79  public:
80 
81  // (Required) default constructor.
83 
84  // Copy Constructor (copy semantics)
85  WCResampleHandler (const WCResampleHandler& other);
86 
87  // Assignment operator (copy semantics)
89 
90  // Destructor.
91  virtual ~WCResampleHandler();
92 
93 
94  // The output array is presized by the caller to the correct size. It will
95  // be filled using information in the input array combined with other
96  // resample-specific information. Here again the interface is type expanded
97  // rather than templated because C++ doesn't yet handle templated member
98  // functions in a non-templated class.
99  // <group>
113  // </group>
114 
115  // These functions resample the input matrix to the output.
116  // inblc is the location 'within' the input matrix for the
117  // bottom-left pixel of the output (sim. for intrc); blank is
118  // the output value where none of the input data is useful.
119  // The output matrix must be presized to the required size.
120  // <group>
124  const casacore::Float blank = 0.0) = 0;
129  const casacore::Float blank = 0.0) = 0;
133  const casacore::Bool blank = false) = 0;
134  // </group>
135 
136  // These functions manipulate which subregion in "in" gets expanded
137  // to "out" Coordinates are the fraction of the image to use, with
138  // <0.0, 0.0> representing the bottom-left corner of the first pixel
139  // and <1.0, 1.0> representing the top-right corner of the last
140  // pixel. These parameters are interpreted according to the derived
141  // class.
142  // <group>
145  itsBlc = blc;
146  itsTrc = trc;
147  }
150  blc = itsBlc;
151  trc = itsTrc;
152  }
153  // </group>
154 
155 
156  protected:
157 
158  // Get the bottom left corner (range <0-1,0-1>) of the subregion
160  return itsBlc;
161  }
162 
163  // Get the top right corner (range <0-1,0-1>) of the subregion
165  return itsTrc;
166  }
167 
168  private:
169 
170  // Current subregion
173 
174  };
175 
176 
177 } //# NAMESPACE CASA - END
178 
179 #endif
const casacore::Vector< casacore::Double > & trc() const
Get the top right corner (range &lt;0-1,0-1&gt;) of the subregion.
casacore::Vector< casacore::Double > itsBlc
Current subregion.
void setSubregion(const casacore::Vector< casacore::Double > &blc, const casacore::Vector< casacore::Double > &trc)
These functions manipulate which subregion in &quot;in&quot; gets expanded to &quot;out&quot; Coordinates are the fractio...
const casacore::Vector< casacore::Double > & blc() const
Get the bottom left corner (range &lt;0-1,0-1&gt;) of the subregion.
casacore::Vector< casacore::Double > itsTrc
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void getSubregion(casacore::Vector< casacore::Double > &blc, casacore::Vector< casacore::Double > &trc) const
float Float
Definition: aipstype.h:54
Base class for resampling data pixels to World/PixelCanvas pixels.
WCResampleHandler()
(Required) default constructor.
WCResampleHandler & operator=(const WCResampleHandler &other)
Assignment operator (copy semantics)
virtual void operator()(casacore::Matrix< casacore::Bool > &out, const casacore::Matrix< casacore::Bool > &in)=0
The output array is presized by the caller to the correct size.
virtual ~WCResampleHandler()
Destructor.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42