00001 //# ImageMoments.h: generate moments from images 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 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 IMAGES_IMAGEMOMENTS_H 00029 #define IMAGES_IMAGEMOMENTS_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <coordinates/Coordinates/CoordinateSystem.h> 00035 #include <casa/Quanta/QMath.h> 00036 #include <casa/Quanta/Quantum.h> 00037 #include <measures/Measures/MDoppler.h> 00038 #include <casa/System/PGPlotter.h> 00039 #include <casa/Logging/LogIO.h> 00040 #include <casa/Arrays/Vector.h> 00041 00042 namespace casa { //# NAMESPACE CASA - BEGIN 00043 00044 //# Forward Declarations 00045 template <class T> class Matrix; 00046 template <class T> class MomentCalcBase; 00047 template <class T> class SubImage; 00048 template <class T> class ImageInterface; 00049 template <class T> class MaskedLattice; 00050 template <class T> class Lattice; 00051 template <class T> class PtrHolder; 00052 class IPosition; 00053 class String; 00054 class Unit; 00055 #include <casa/iosfwd.h> 00056 00057 // <summary> 00058 // This class generates moments from an image. 00059 // </summary> 00060 00061 // <use visibility=export> 00062 00063 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00064 // </reviewed> 00065 00066 // <prerequisite> 00067 // <li> <linkto class="ImageInterface">ImageInterface</linkto> 00068 // <li> <linkto class="LatticeApply">LatticeApply</linkto> 00069 // <li> <linkto class="MomentCalcBase">MomentCalcBase</linkto> 00070 // </prerequisite> 00071 00072 // <etymology> 00073 // This class computes moments from images 00074 // </etymology> 00075 00076 // <synopsis> 00077 // The primary goal of this class is to help spectral-line astronomers analyze 00078 // their multi-dimensional images by generating moments of a specified axis. 00079 // The word "moment" is used loosely here. It refers to collapsing an axis 00080 // to one pixel and putting the value of that pixel (for all of the other 00081 // non-collapsed axes) to something computed from the data values along 00082 // the moment axis. For example, take an RA-DEC-Velocity cube, collapse 00083 // the velocity axis by computing the mean intensity at each RA-DEC 00084 // pixel. This class offers many different moments and a variety of 00085 // interactive and automatic ways to compute them. 00086 // 00087 // This class only accepts images of type <src>Float</src> and <src>Double</src>. 00088 // This restriction is because of the plotting capabilities which are a 00089 // bit awkward for other types. 00090 // 00091 // This class makes a distinction between a "moment" and a "method". This 00092 // boundary is a little blurred, but it claims to refer to the distinction 00093 // of what you are computing, as to how the pixels that were included in the 00094 // computation were selected. For example, a "moment" would be the average value 00095 // of some pixels. A method for selecting those pixels would be a simple range 00096 // specifying a range for which pixels should be included. 00097 // 00098 // The default state of this class is to do nothing. If you specify an image via 00099 // the <src>setImage</src> function then invoking the <src>createMoments</src> 00100 // function will cause it to compute the integrated itensity along the 00101 // spectral axis of the image (if it can find one). You can change the 00102 // computational state of the class from this basic form via the remaining 00103 // <src>set</src> functions. You can call any number of these functions to 00104 // suit your needs. 00105 // 00106 // Because there are a wide variety of methods available, if you specify an 00107 // invalid combination, a table showing the available methods is listed. It 00108 // is reproduced below for convenience. 00109 // 00110 // The basic method is to just compute moments directly from the pixel intensities. 00111 // This can be modified by applying pixel intensity inclusion or exclusion ranges. 00112 // You can then also smooth the image and compute a mask based on the inclusion or 00113 // exclusion ranges applied to the smoothed image. This mask is then applied to 00114 // the unsmoothed data for moment computation. 00115 // 00116 // The window method does no pixel intensity range selection. Instead a spectral 00117 // window is found (hopefully surrounding the spectral line feature) and only the 00118 // pixels in that window are used for computation. This window can be found from the 00119 // smoothed or unsmoothed data. The moments are always computed from the unsmoothed 00120 // data. For each spectrum, the window can be found interactively or automatically. 00121 // There are two interactive methods. Either you just mark the window with the 00122 // cursor, or you interactively fit a Gaussian to the profile and the +/- 3-sigma 00123 // window is returned. There are two automatic methods. Either Bosma's converging 00124 // mean algorithm is used, or an automatically fit Gaussian +/- 3-sigma window 00125 // is returned. 00126 // 00127 // The fitting method fits Gaussians to spectral features either automatically 00128 // or interactively. The moments are then computed from the Gaussian fits 00129 // (not the data themselves). 00130 // 00131 // When an output image is created, it will have N-1 axes, where the input image 00132 // has N axes. In the output image, the physical axis corresponding to the moment 00133 // axis will have been removed, but the coordinate information will be retained 00134 // for future coordinate transformations. For example, if you have a RA-DEC-VELOCITY 00135 // image and you collapsed axis 2 (the DEC axis) the output images would be 00136 // RA-VELOCITY with the coordinate information retained for the DEC axis so that 00137 // the coupled nature of RA/DEC coordinates is preserved. 00138 // 00139 // Output images are created with an all True (good) mask. If, for a given 00140 // pixel, the moment calculation fails, then the mask is set to F. 00141 // 00142 // When making plots, the order in which the spectra are displayed is determined 00143 // by the tiling sequence of the image (for optimum speed of access). 00144 // 00145 // 00146 // <srcblock> 00147 // Allowed Methods 00148 // --------------- 00149 // 00150 // Smooth Window Fit in/exclude Interactive 00151 // ----------------------------------------------------- 00152 // N N N N N 00153 // Y/N N N Y N 00154 // 00155 // Y/N Y N N Y 00156 // Y/N Y N N N 00157 // Y/N Y Y N Y/N 00158 // 00159 // N N Y N Y/N 00160 // ---------------------------------------------------- 00161 // </srcblock> 00162 // 00163 // <note role=caution> 00164 // Note that the <src>MEDIAN_COORDINATE</src> moment is not very robust. 00165 // It is very useful for generating quickly a velocity field in a way 00166 // that is not sensitive to noise. However, it will only give sensible 00167 // results under certain conditions. It treats the spectrum as a 00168 // probability distribution, generates the cumulative distribution for 00169 // the selected pixels (via an <src>include</src> or <src>exclude</src> 00170 // pixel range, and finds the (interpolated) coordinate coresponding to 00171 // the 50% value. The generation of the cumulative distribution and the 00172 // finding of the 50% level really only makes sense if the cumulative 00173 // distribution is monotonically increasing. This essentially means only 00174 // selecting pixels which are positive or negative. For this reason, this 00175 // moment type is *only* supported with the basic method (i.e. no smoothing, 00176 // no windowing, no fitting) with a pixel selection range that is either 00177 // all positive, or all negative. 00178 // </note> 00179 // 00180 // <note role=tip> 00181 // If you ignore return error statuses from the functions that set the 00182 // state of the class, the internal status of the class is set to bad. 00183 // This means it will just keep on returning error conditions until you 00184 // explicitly recover the situation. A message describing the last 00185 // error condition can be recovered with function errorMessage. 00186 // </note> 00187 // </synopsis> 00188 00189 // <example> 00190 // <srcBlock> 00192 // 00193 // Vector<Int> moments(2); 00194 // moments(0) = ImageMoments<Float>::AVERAGE; 00195 // moments(1) = ImageMoments<Float>::WEIGHTED_MEAN_COORDINATE; 00196 // Vector<int> methods(2); 00197 // methods(0) = ImageMoments<Float>::WINDOW; 00198 // methods(1) = ImageMoments<Float>::INTERACTIVE; 00199 // Vector<Int> nxy(2); 00200 // nxy(0) = 3; 00201 // nxy(1) = 3; 00202 // 00204 // 00205 // PagedImage<Float> inImage(inName); 00206 // 00208 // 00209 // LogOrigin or("myClass", "myFunction(...)", WHERE); 00210 // LogIO os(or); 00211 // ImageMoments<Float> moment(SubImage<Float>(inName), os); 00212 // 00214 // 00215 // if (!moment.setMoments(moments)) return 1; 00216 // if (!moment.setWinFitMethod(methods)) return 1; 00217 // if (!moment.setMomentAxis(3)) return 1; 00218 // if (!moment.setPlotting("/xs", nxy)) return 1; 00219 // 00221 // 00222 // if (!moment.createMoments()) return 1; 00223 // </srcBlock> 00224 // In this example, we generate two moments (average intensity and intensity 00225 // weighted mean coordinate -- usually the velocity field) of axis 3 by the 00226 // interactive window method. The interactive plotting is done on the PGPLOT 00227 // device called <src>/xs</src>. We put 9 subplots on each page. The output 00228 // file names are constructed by the class from the input file name plus some 00229 // internally generated suffixes. 00230 // </example> 00231 00232 // <motivation> 00233 // This is a fundamental and traditional piece of spectral-line image analysis. 00234 // </motivation> 00235 00236 // <todo asof="1996/11/26"> 00237 // <li> more control over histogram of image noise at start (pixel 00238 // range and number of bins) 00239 // <li> better algorithm for seeing if spectrum is pure noise 00240 // <li> Make this class extensible so users could add their own method. 00241 // </todo> 00242 00243 00244 template <class T> class ImageMoments 00245 { 00246 public: 00247 00248 // Note that if I don't put MomentCalcBase as a forward declaration 00249 // and use instead "friend class MomentCalcBase<T>" The gnu compiler 00250 // fails with a typedef problem. But I can't solve it with say 00251 // "typedef MomentCalcBase<T> gpp_type;" because you can only do a 00252 // typedef with an actual type, not a <T> ! 00253 friend class MomentCalcBase<T>; 00254 00255 // Constructor takes an image and a <src>LogIO</src> object for logging purposes. 00256 // You specify whether output images are automatically overwritten if pre-existing, 00257 // or whether an intercative choice dialog widget appears (overWriteOutput=F) 00258 // You may also determine whether a progress meter is displayed or not. 00259 ImageMoments (ImageInterface<T>& image, 00260 LogIO &os, 00261 Bool overWriteOutput=False, 00262 Bool showProgress=True); 00263 00264 // Copy constructor. Uses copy semantics. 00265 ImageMoments(const ImageMoments<T> &other); 00266 00267 // Copy constructor. Uses copy semantics. 00268 ImageMoments(ImageMoments<T> &other); 00269 00270 // Destructor 00271 ~ImageMoments(); 00272 00273 // Assignment operator. USes copy semantics. 00274 ImageMoments<T> &operator=(const ImageMoments<T> &other); 00275 00276 // This <src>enum MomentTypes</src> is provided for use with the 00277 // <src>setMoments</src> function. It gives the allowed moment 00278 // types that you can ask for. 00279 00280 enum MomentTypes { 00281 00282 // The average intensity 00283 AVERAGE, 00284 00285 // The integrated intensity 00286 INTEGRATED, 00287 00288 // The intensity weighted mean coordinate (usually velocity) 00289 WEIGHTED_MEAN_COORDINATE, 00290 00291 // The intensity weighted coordinate (usually velocity) dispersion 00292 WEIGHTED_DISPERSION_COORDINATE, 00293 00294 // The median intensity 00295 MEDIAN, 00296 00297 // The median coordinate (usually velocity). Treat the spectrum as 00298 // a probability distribution, generate the cumulative distribution, 00299 // and find the coordinate corresponding to the 50% value. 00300 MEDIAN_COORDINATE, 00301 00302 // The standard deviation about the mean of the intensity 00303 STANDARD_DEVIATION, 00304 00305 // The rms of the intensity 00306 RMS, 00307 00308 // The absolute mean deviation of the intensity 00309 ABS_MEAN_DEVIATION, 00310 00311 // The maximum value of the intensity 00312 MAXIMUM, 00313 00314 // The coordinate (usually velocity) of the maximum value of the intensity 00315 MAXIMUM_COORDINATE, 00316 00317 // The minimum value of the intensity 00318 MINIMUM, 00319 00320 // The coordinate (usually velocity) of the minimum value of the intensity 00321 MINIMUM_COORDINATE, 00322 00323 // Total number 00324 NMOMENTS, 00325 00326 // Default value is the integrated intensity 00327 DEFAULT = INTEGRATED}; 00328 00329 // Set the desired moments via an <src>Int</src> array. Each <src>Int</src> 00330 // specifies a different moment; the allowed values and their meanings 00331 // are given by the <src>enum MomentTypes</src>. A return value 00332 // of <src>False</src> indicates you asked for an out of range 00333 // moment. If you don't call this function, the default state of the 00334 // class is to request the integrated intensity. 00335 Bool setMoments (const Vector<Int>& moments); 00336 00337 // Set the moment axis (0 relative). A return value of <src>False</src> 00338 // indicates that the axis was not contained in the image. If you don't 00339 // call this function, the default state of the class is to set the 00340 // moment axis to the spectral axis if it can find one. Otherwise 00341 // an error will result. 00342 Bool setMomentAxis (const Int& momentAxis); 00343 00344 // The <src>enum MethodTypes</src> is provided for use with the 00345 // <src>setWinFitMethod</src> function. It gives the allowed moment 00346 // methods which are available with this function. The use of these 00347 // methods is described further with the description of this function 00348 // as well as in the general documentation earlier. 00349 enum MethodTypes { 00350 00351 // Invokes the spectral windowing method 00352 WINDOW, 00353 00354 // Invokes Gaussian fitting 00355 FIT, 00356 00357 // Invokes interactive methods 00358 INTERACTIVE, 00359 00360 NMETHODS}; 00361 00362 00363 // The method by which you compute the moments is specified by calling 00364 // (or not calling) the <src>setWinFitMethod</src> and 00365 // <src>setSmoothMethod</src> functions. The default state of the class 00366 // is to compute directly on all (or some according to <src>setInExClude</src>) 00367 // of the pixels in the spectrum. Calling these functions modifies the 00368 // computational state to something more complicated. 00369 // 00370 // The <src>setWinMethod</src> function requires an <src>Int</src> array 00371 // as its argument. Each <src>Int</src> specifies a different method 00372 // that you can invoke (either separately or in combination). The 00373 // allowed values and their meanings are given by the 00374 // <src>enum MethodTypes</src>. 00375 // 00376 // Both the windowing and fitting methods have interactive modes. The 00377 // windowing method also has a fitting flavour, so if you set both 00378 // ImageMoments::WINDOW and ImageMoments::FIT, you would be invoking the 00379 // windowing method but determining the window by fitting Gaussians 00380 // automatically (as ImageMoments::INTERACTIVE) was not given. 00381 // 00382 // If you don't call this function, then neither the windowing nor fitting 00383 // methods are invoked. A return value of <src>False</src> indicates 00384 // that you asked for an illegal method. 00385 Bool setWinFitMethod(const Vector<Int>& method); 00386 00387 00388 // This function invokes smoothing of the input image. Give <src>Int</src> 00389 // arrays for the axes (0 relative) to be smoothed and the smoothing kernel 00390 // types (use the <src>enum KernelTypes</src>) for each axis. Give a 00391 // <src>Double</src> array for the widths (full width for BOXCAR and full 00392 // width at half maximum for GAUSSIAN) in pixels of the smoothing kernels for 00393 // each axis. For HANNING smoothing, you always get the quarter-half-quarter 00394 // kernel (no matter what you might ask for). A return value of <src>False</src> 00395 // indicates that you have given an inconsistent or invalid set of smoothing 00396 // parameters. If you don't call this function the default state of the 00397 // class is to do no smoothing. The kernel types are specified with 00398 // the VectorKernel::KernelTypes enum 00399 // <group> 00400 Bool setSmoothMethod(const Vector<Int>& smoothAxes, 00401 const Vector<Int>& kernelTypes, 00402 const Vector<Quantum<Double> >& kernelWidths); 00403 Bool setSmoothMethod(const Vector<Int>& smoothAxes, 00404 const Vector<Int>& kernelTypes, 00405 const Vector<Double>& kernelWidths); 00406 // </group> 00407 00408 // You may specify a pixel intensity range as either one for which 00409 // all pixels in that range are included in the moment calculation, 00410 // or one for which all pixels in that range are excluded from the moment 00411 // calculations. One or the other of <src>include</src> and <src>exclude</src> 00412 // must therefore be a zero length vector if you call this function. 00413 // A return value of <src>False</src> indicates that you have given both 00414 // an <src>include</src> and an <src>exclude</src> range. If you don't call 00415 // this function, the default state of the class is to include all pixels. 00416 Bool setInExCludeRange(const Vector<T>& include, 00417 const Vector<T>& exclude); 00418 00419 // This function is used to help assess whether a spectrum along the moment 00420 // axis is all noise or not. If it is all noise, there is not a lot of point 00421 // to trying to computing the moment. This is only needed for the automatic 00422 // window or fit methods. If you are using an interactive nethod, you assess 00423 // yourself whether the spectrum contains signal or not. 00424 // 00425 // <src>peakSNR</src> is the signal-to-noise ratio of the peak value in the 00426 // spectrum below which the spectrum is considered pure noise. 00427 // <src>stdDeviation</src> is the standard deviation of the noise for the 00428 // input image. 00429 // 00430 // Default values for one or the other parameter are indicated by giving zero. 00431 // 00432 // The default state of the class then is to set <src>peakSNR=3</src> 00433 // and/or to work out the noise level from a Gaussian fit to a histogram 00434 // (above 25%) of the entire image (it is very hard to get an accurate 00435 // estimate of the noise a single spectrum). If you have specified a 00436 // plotting device (see <src>setPlotting</src>) then you get to interact with 00437 // the fitting procedure if you want to. A return value of <src>False</src> 00438 // indicates you have set invalid values. 00439 Bool setSnr(const T& peakSNR, 00440 const T& stdDeviation); 00441 00442 // This is the output file name for the smoothed image. It can be useful 00443 // to have access this to this image when trying to get the pixel 00444 // <src>include</src> or <src>exclude</src> range correct for the smooth-clip 00445 // method. The default state of the class is to not output the smoothed image. 00446 Bool setSmoothOutName(const String& smOut); 00447 00448 // This sets the name of the PGPLOT plotting device, the number of 00449 // subplots in x and y per page and whether each spectrum plot is 00450 // autoscaled individually (<src>yInd=False</src>) or they are 00451 // plotted with the same range automatically determined from the image. 00452 // Plotting is not invoked for all states of the class. It is only 00453 // needed for the interactive methods. If you ask for a method that 00454 // needs to determine the noise from the image, and you set the 00455 // plotting device, then this will be done interactively. Similarly, 00456 // if you invoke the automatic window or fit methods, but set the 00457 // plotting device, then you will see plots of the spectra and 00458 // the selected windows and fits, respectively. 00459 // 00460 // The default state of the class is that no plotting characteristics are set. 00461 // However, if you set <src>device</src> but offer a zero length array for 00462 // <src>nxy</src> then the latter is set to [1,1]. A return value 00463 // of <src>False</src> indicates that you gave roo many values in the 00464 // <src>nxy</src> vector. 00465 Bool setPlotting(PGPlotter& device, 00466 const Vector<Int>& nxy, 00467 const Bool yInd=False); 00468 00469 // Set Velocity type. This is used for moments for which the moment axis is 00470 // a spectral axis for which the coordinate is traditionally presented in 00471 // km/s You can select the velocity definition. The default state of the 00472 // class is to use the radio definition. 00473 void setVelocityType (MDoppler::Types type); 00474 00475 // CLose plotter 00476 void closePlotting(); 00477 00478 // Reset argument error condition. If you specify invalid arguments to 00479 // one of the above functions, an internal flag will be set which will 00480 // prevent the <src>createMoments</src> function from doing anything 00481 // (should you have chosen to igmore the Boolean return values of the functions). 00482 // This function allows you to reset that internal state to good. 00483 void resetError () {goodParameterStatus_p = True; error_p = "";}; 00484 00485 // Recover last error message 00486 String errorMessage() const {return error_p;}; 00487 00488 // This is the function that does all the computational work. It should be called 00489 // after the <src>set</src> functions. A return value of <src>False</src> 00490 // indicates that additional checking of the combined methods that you 00491 // have requested has shown that you have not given consistent state to the class. 00492 // If the axis being collapsed comes from a coordinate with one axis only, 00493 // the axis and its coordinate are physically removed from the output image. Otherwise, 00494 // if <src>removeAxes=True</src> then the output axis is logically removed from the 00495 // the output CoordinateSystem. If <src>removeAxes=False</src> then the axis 00496 // is retained with shape=1 and with its original coordinate information (which 00497 // is probably meaningless). 00498 // 00499 // The output PtrBlock will hold PagedImages or TempImages (doTemp=True). 00500 // It is your responsibility to delete the pointers. 00501 // If doTemp is True, the outFileName is irrelevant. 00502 // 00503 // If you create PagedImages, outFileName is the root name for 00504 // the output files. Suffixes will be made up internally to append 00505 // to this root. If you only ask for one moment, 00506 // this will be the actual name of the output file. If you don't set this 00507 // variable, the default state of the class is to set the output name root to 00508 // the name of the input file. 00509 Bool createMoments(PtrBlock<MaskedLattice<T>* >& images, 00510 Bool doTemp, const String& outFileName, 00511 Bool removeAxes=True); 00512 00513 // Set a new image. A return value of <src>False</src> indicates the 00514 // image had an invalid type (this class only accepts Float or Double images). 00515 Bool setNewImage (ImageInterface<T>& image); 00516 00517 // Get CoordinateSystem 00518 CoordinateSystem coordinates() const {return pInImage_p->coordinates();}; 00519 00520 // Helper function to convert a string containing a list of desired methods to 00521 // the correct <src>Vector<Int></src> required for the <src>setWinFitMethod</src> function. 00522 // This may be usful if your user interface involves strings rather than integers. 00523 // A new value is added to the output vector (which is resized appropriately) if any of the 00524 // substrings "window", "fit" or "interactive" (actually "win", "box" and 00525 // "inter" will do) is present. 00526 static Vector<Int> toMethodTypes (const String& methods); 00527 00528 00529 private: 00530 00531 LogIO os_p; 00532 ImageInterface<T>* pInImage_p; 00533 Bool showProgress_p; 00534 Int momentAxisDefault_p; 00535 T peakSNR_p; 00536 T stdDeviation_p; 00537 T yMin_p, yMax_p; 00538 String out_p; 00539 String smoothOut_p; 00540 Bool goodParameterStatus_p; 00541 Bool doWindow_p, doFit_p, doAuto_p, doSmooth_p, noInclude_p, noExclude_p; 00542 Bool fixedYLimits_p; 00543 00544 Int momentAxis_p; 00545 Int worldMomentAxis_p; 00546 Vector<Int> kernelTypes_p; 00547 Vector<Quantum<Double> > kernelWidths_p; 00548 Vector<Int> nxy_p; 00549 Vector<Int> moments_p; 00550 Vector<T> selectRange_p; 00551 Vector<Int> smoothAxes_p; 00552 PGPlotter plotter_p; 00553 Bool overWriteOutput_p; 00554 String error_p; 00555 Bool convertToVelocity_p; 00556 MDoppler::Types velocityType_p; 00557 00558 // Check that the combination of methods that the user has requested is valid 00559 // List a handy dandy table if not. 00560 Bool checkMethod(); 00561 00562 // Plot a histogram 00563 static void drawHistogram (const Vector<T>& values, 00564 const Vector<T>& counts, 00565 PGPlotter& plotter); 00566 00567 // Plot a line 00568 static void drawLine (const Vector<T>& x, 00569 const Vector<T>& y, 00570 PGPlotter& plotter); 00571 00572 // Draw a vertical line of the given length at a given abcissa 00573 static void drawVertical (const T& x, 00574 const T& yMin, 00575 const T& yMax, 00576 PGPlotter& plotter); 00577 00578 // Read the cursor and return its coordinates 00579 static Bool getLoc (T& x, 00580 T& y, 00581 PGPlotter& plotter); 00582 00583 // Convert a <T> to a <Float> for plotting 00584 static Float convertT (const T value) {return Float(real(value));}; 00585 00586 // Convert a <Float> (from plotting) to a <T> 00587 static T convertF (const Float value) {return T(value);}; 00588 00589 // Fish out cursor values 00590 static Bool readCursor (PGPlotter& plotter, 00591 Float& x, 00592 Float& y, 00593 String& ch); 00594 00595 // Take the user's data inclusion and exclusion data ranges and 00596 // generate the range and Booleans to say what sort it is 00597 Bool setIncludeExclude (Vector<T>& range, 00598 Bool& noInclude, 00599 Bool& noExclude, 00600 const Vector<T>& include, 00601 const Vector<T>& exclude, 00602 ostream& os); 00603 00604 // Set the output image suffixes and units 00605 Bool setOutThings(String& suffix, 00606 Unit& momentUnits, 00607 const Unit& imageUnits, 00608 const String& momentAxisUnits, 00609 const Int moment, Bool convertToVelocity); 00610 00611 // Smooth an image 00612 Bool smoothImage (PtrHolder<ImageInterface<T> >& pSmoothedImage, 00613 String& smoothName); 00614 00615 // Determine the noise by fitting a Gaussian to a histogram 00616 // of the entire image above the 25% levels. If a plotting 00617 // device is set, the user can interact with this process. 00618 Bool whatIsTheNoise (T& noise, 00619 ImageInterface<T>& image); 00620 00621 // Make output Coordinates 00622 CoordinateSystem makeOutputCoordinates (IPosition& outShape, 00623 const CoordinateSystem& cSysIn, 00624 const IPosition& inShape, 00625 Int momentAxis, Bool removeAxis); 00626 }; 00627 00628 00629 } //# NAMESPACE CASA - END 00630 00631 #ifndef AIPS_NO_TEMPLATE_SRC 00632 #include <images/Images/ImageMoments.cc> 00633 #endif //# AIPS_NO_TEMPLATE_SRC 00634 #endif
1.5.1