casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WCSimpleResampleHandler.h
Go to the documentation of this file.
00001 //# WCSimpleResampleHandler.h: Simple (nearest,linear,cubic) resampling for the WorldCanvas
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_WCSIMPLERESAMPLEHANDLER_H
00029 #define TRIALDISPLAY_WCSIMPLERESAMPLEHANDLER_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/DisplayCanvas/WCResampleHandler.h>
00033 #include <scimath/Mathematics/Interpolate2D.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Class which implements simple resampling for the WorldCanvas.
00039 // </summary>
00040 //  
00041 // <prerequisite>
00042 // <li> <linkto class="WCResampleHandler>WCResampleHandler</linkto>
00043 // </prerequisite>
00044 //
00045 // <etymology> 
00046 // The name "WCSimpleResampleHandler" is a contraction of the terms
00047 // "WorldCanvas," "Simple," "Resample" and "Handler."  
00048 // </etymology>
00049 //
00050 // <synopsis>
00051 // This class implements the interface defined in WCResampleHandler
00052 // to provide pixel interpolation (resampling) of data pixels to screen pixels.
00053 // It offers simple nearest, linear and cubic interpolation.
00054 // </synopsis>
00055 //
00056 // <motivation>
00057 // The provision of raster images which are smooth in appearance.
00058 // </motivation>
00059 
00060 class WCSimpleResampleHandler : public WCResampleHandler {
00061 
00062  public:
00063 
00064   // Default constructor (Provides NEAREST)
00065   WCSimpleResampleHandler();
00066 
00067   // Constructor 
00068   WCSimpleResampleHandler(Interpolate2D::Method type=Interpolate2D::NEAREST);
00069 
00070   // Copy Constructor (copy semantics)
00071   WCSimpleResampleHandler (const WCSimpleResampleHandler& other);
00072 
00073   // Assignment operator (copy semantics)
00074   WCSimpleResampleHandler& operator=(const WCSimpleResampleHandler& other);
00075 
00076   // Destructor
00077   virtual ~WCSimpleResampleHandler();
00078 
00079   // Reset interpolation method
00080   void setInterpolationType (Interpolate2D::Method type);  
00081 
00082   // The output array is presized by the caller to the correct size.  It will
00083   // be filled using information in the input array combined with other
00084   // resample-specific information.  Here again the interface is type expanded
00085   // rather than templated because C++ doesn't yet handle templated member
00086   // functions in a non-templated class.
00087   // <group>
00088   virtual void operator()(Matrix<Bool> & out, const Matrix<Bool> & in);
00089   virtual void operator()(Matrix<uChar> & out, const Matrix<uChar> & in);
00090   virtual void operator()(Matrix<Char> & out, const Matrix<Char> & in);
00091   virtual void operator()(Matrix<uShort> & out, const Matrix<uShort> & in);
00092   virtual void operator()(Matrix<Short> & out, const Matrix<Short> & in);
00093   virtual void operator()(Matrix<uInt> & out, const Matrix<uInt> & in);
00094   virtual void operator()(Matrix<Int> & out, const Matrix<Int> & in);
00095   virtual void operator()(Matrix<uLong> & out, const Matrix<uLong> & in);
00096   virtual void operator()(Matrix<Long> & out, const Matrix<Long> & in);
00097   virtual void operator()(Matrix<Float> & out, const Matrix<Float> & in);
00098   virtual void operator()(Matrix<Double> & out, const Matrix<Double> & in);
00099   virtual void operator()(Matrix<Complex> & out, const Matrix<Complex> & in);
00100   virtual void operator()(Matrix<DComplex> & out, const Matrix<DComplex> & in);
00101   // </group>
00102 
00103   // This function resamples the input matrix to the output.
00104   // pixblc is the location relative to the input matrix of the
00105   // bottom-left pixel of the output (sim. for pixtrc); blank is
00106   // the output value where none of the input data is useful.
00107   // The output matrix must be presized to the required size.
00108   // <group>
00109   virtual void operator()(Matrix<Float> &out, const Matrix<Float> &in,
00110                           const Vector<Float> &pixblc, 
00111                           const Vector<Float> &pixtrc,
00112                           const Float blank = 0.0);
00113   virtual void operator()(Matrix<Float> &out, Matrix<Bool>& outMask,
00114                           const Matrix<Float> &in, const Matrix<Bool> &inMask,
00115                           const Vector<Float> &inblc,   
00116                           const Vector<Float> &intrc,  
00117                           const Float blank = 0.0);
00118   virtual void operator()(Matrix<Bool> &out, const Matrix<Bool> &in,
00119                           const Vector<Float> &pixblc, 
00120                           const Vector<Float> &pixtrc,
00121                           const Bool blank = False);
00122   // </group>
00123 
00124 
00125 private:
00126   Interpolate2D itsInterp;
00127 };
00128 
00129 
00130 } //# NAMESPACE CASA - END
00131 
00132 #endif
00133