casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WCPowerScaleHandler.h
Go to the documentation of this file.
00001 //# WCPowerScaleHandler.h: lin, log and exp scaling of data for WorldCanvas
00002 //# Copyright (C) 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_WCPOWERSCALEHANDLER_H
00029 #define TRIALDISPLAY_WCPOWERSCALEHANDLER_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Containers/Record.h>
00033 #include <display/DisplayCanvas/WCDataScaleHandler.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Linear, logarithmic and exponential scaling of data for the WorldCanvas
00039 // </summary>
00040 //
00041 // <prerequisite>
00042 // <li> <linkto class="WCDataScaleHandler">WCDataScaleHandler</linkto>
00043 // </prerequisite>
00044 //
00045 // <etymology>
00046 // WCPowerScaleHandler : WorldCanvas Power Scale Handler
00047 // </etymology>
00048 //
00049 // <synopsis>
00050 // The WCPowerScaleHandler is an implementation of the
00051 // <linkto class="WCDataScaleHandler">WCDataScaleHandler</linkto> that
00052 // uses linear, logarithmic or exponential scaling to transform 
00053 // (probably non-discrete) input data into discrete output values
00054 // in the range 0 to a settable maximum.  Typically, this maximum would
00055 // be set to the available number of colorcells minus one, for indexed
00056 // raster drawing, or to a large integer (say 1000000) for use in color
00057 // cube raster drawing.  In the latter case, the output is then divided 
00058 // by the chosen large number in order to provide values in the range 
00059 // 0 to 1.
00060 // </synopsis>
00061 //
00062 // <motivation>
00063 // This class is motivated by the need to provide the most common 
00064 // data scaling requirements to the user.
00065 // </motivation>
00066 //
00067 // <example>
00068 // ...
00069 // </example>
00070 //
00071 // <todo>
00072 // <li> stream ops
00073 // </todo>
00074 //
00075 
00076 class WCPowerScaleHandler  : public WCDataScaleHandler {
00077 
00078  public:
00079 
00080   // Default Constructor Required
00081   WCPowerScaleHandler();
00082 
00083   // Destructor
00084   virtual ~WCPowerScaleHandler();
00085 
00086   // set/get the number of log cycles into which to compress the data
00087   // <group>
00088   void setCycles(Float cyc) { itsOptionsPowerCycles = cyc; }
00089   Float cycles() { return itsOptionsPowerCycles; }
00090   // </group>
00091 
00092   // install the default options for this DisplayData
00093   virtual void setDefaultOptions();
00094 
00095   // apply options stored in val to the DisplayData; return value
00096   // True means a refresh is needed...
00097   virtual Bool setOptions(Record &rec, Record &recOut);
00098 
00099   // retrieve the current and default options and parameter types.
00100   virtual Record getOptions();
00101 
00102   // apply returns True if the array in was converted to the array out
00103   // successfully the last parameter sets the output range
00104   // <group>
00105   virtual Bool operator()(Array<uInt> & out, const Array<Bool> & in);
00106   virtual Bool operator()(Array<uInt> & out, const Array<uChar> & in);
00107   virtual Bool operator()(Array<uInt> & out, const Array<Char> & in);
00108   virtual Bool operator()(Array<uInt> & out, const Array<uShort> & in);
00109   virtual Bool operator()(Array<uInt> & out, const Array<Short> & in);
00110   virtual Bool operator()(Array<uInt> & out, const Array<uInt> & in);
00111   virtual Bool operator()(Array<uInt> & out, const Array<Int> & in);
00112   virtual Bool operator()(Array<uInt> & out, const Array<uLong> & in);
00113   virtual Bool operator()(Array<uInt> & out, const Array<Long> & in);
00114   virtual Bool operator()(Array<uInt> & out, const Array<Float> & in);
00115   virtual Bool operator()(Array<uInt> & out, const Array<Double> & in);
00116   virtual Bool operator()(Array<uInt> & out, const Array<Complex> & in);
00117   virtual Bool operator()(Array<uInt> & out, const Array<DComplex> & in);
00118   // </group>
00119 
00120   Bool histoEqualise(Array<Float> &out, const Array<Float> &in);
00121   static const String POWER_CYCLES;
00122 private:
00123 
00124   // Scaling power cycles: < 0 => log scaling, > 0 => exp scaling, 
00125   // == 0 => linear scaling
00126   Float itsOptionsPowerCycles;
00127 
00128   // Is histogram equalisation required?
00129   Bool itsOptionsHistoEqualisation;
00130 
00131 };
00132 
00133 
00134 } //# NAMESPACE CASA - END
00135 
00136 #endif