casa
$Rev:20696$
|
00001 //# ImageAnalysis.h: Image analysis and handling tool 00002 //# Copyright (C) 2007 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This program is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU General Public License as published by the Free 00007 //# Software Foundation; either version 2 of the License, or (at your option) 00008 //# any later version. 00009 //# 00010 //# This program 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 General Public License for 00013 //# more details. 00014 //# 00015 //# You should have received a copy of the GNU General Public License along 00016 //# with this program; if not, write to the Free Software Foundation, Inc., 00017 //# 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 #ifndef _IMAGEANALYSIS__H__ 00027 #define _IMAGEANALYSIS__H__ 00028 00029 00030 //# put includes here 00031 #include <coordinates/Coordinates/CoordinateSystem.h> 00032 #include <lattices/LatticeMath/Fit2D.h> 00033 #include <casa/Quanta.h> 00034 #include <measures/Measures/Stokes.h> 00035 #include <images/Images/ImageInfo.h> 00036 #include <images/Images/ImageInterface.h> 00037 #include <components/ComponentModels/ComponentType.h> 00038 #include <casa/Arrays/AxesSpecifier.h> 00039 #include <casa/Utilities/PtrHolder.h> 00040 #include <measures/Measures/Stokes.h> 00041 00042 namespace casa { 00043 00044 class DirectionCoordinate; 00045 class LogIO; 00046 class SkyComponent; 00047 class Record; 00048 class Fit2D; 00049 class ImageRegion; 00050 class ComponentList; 00051 template<class T> class Array; 00052 template<class T> class Block; 00053 template<class T> class PtrBlock; 00054 template<class T> class Flux; 00055 template<class T> class ImageStatistics; 00056 template<class T> class ImageHistograms; 00057 template<class T> class MaskedArray; 00058 template<class T> class Quantum; 00059 template<class T> class SubLattice; 00060 template<class T> class SubImage; 00061 template<class T> class Vector; 00062 00063 // <summary> 00064 // Image analysis and handling tool 00065 // </summary> 00066 00067 // <synopsis> 00068 // This the casapy image tool. 00069 // One time it should be merged with pyrap's image tool ImageProxy. 00070 // </synopsis> 00071 00072 class ImageAnalysis 00073 { 00074 public: 00075 00076 ImageAnalysis(); 00077 00078 //ImageInterface constructor 00079 ImageAnalysis(const ImageInterface<Float>* inImage); 00080 00081 //Use this constructor with cloneInputPointer=False if you want this object 00082 // to take over management of the input pointer. The input pointer will be deleted 00083 // when this object is destroyed. 00084 ImageAnalysis(ImageInterface<Float>* inImage, const Bool cloneInputPointer); 00085 00086 virtual ~ImageAnalysis(); 00087 00088 Bool addnoise(const String& type, const Vector<Double>& pars, 00089 Record& region, const Bool zero = False); 00090 00091 ImageInterface<Float> * imagecalc(const String& outfile, 00092 const String& pixels, 00093 const Bool overwrite = False); 00094 00095 ImageInterface<Float> * imageconcat(const String& outfile, 00096 const Vector<String>& infiles, 00097 const Int axis, 00098 const Bool relax = False, 00099 const Bool tempclose = True, 00100 const Bool overwrite = False); 00101 00102 Bool imagefromarray(const String& outfile, Array<Float>& pixels, 00103 const Record& csys, const Bool linear = False, 00104 const Bool overwrite = False, const Bool log = True); 00105 00106 Bool imagefromascii(const String& outfile, const String& infile, 00107 const Vector<Int>& shape, const String& sep, 00108 const Record& csys, const Bool linear = False, 00109 const Bool overwrite = False); 00110 00111 Bool imagefromfits(const String& outfile, const String& infile, 00112 const Int whichrep = 0, const Int whichhdu = 0, 00113 const Bool zeroblanks = False, 00114 const Bool overwrite = False); 00115 00116 Bool imagefromimage(const String& outfile, const String& infile, 00117 Record& region, const String& mask, 00118 const Bool dropdeg = False, 00119 const Bool overwrite = False); 00120 00121 Bool imagefromshape(const String& outfile, const Vector<Int>& shape, 00122 const Record& csys, const Bool linear = True, 00123 const Bool overwrite = False, const Bool log = True); 00124 00125 Bool adddegaxes(const String& outfile, 00126 PtrHolder<ImageInterface<Float> >& ph, 00127 const Bool direction, 00128 const Bool spectral, 00129 const String& stokes, 00130 const Bool linear = False, 00131 const Bool tabular = False, 00132 const Bool overwrite = False); 00133 00134 ImageInterface<Float> * convolve( 00135 const String& outfile, 00136 Array<Float>& kernel, 00137 const String& kernImage, 00138 const Double scale, 00139 Record& region, String& mask, 00140 const Bool overwrite=False, 00141 const Bool async=False, 00142 const Bool stretch=False 00143 ); 00144 00145 Record* boundingbox(const Record& region); 00146 00147 String brightnessunit(); 00148 00149 Bool calc(const String& pixels); 00150 00151 // regions should be a Record of Records having different regions 00152 00153 Bool calcmask(const String& mask, Record& regions, const String& name, 00154 const Bool asdefault = True); 00155 00156 00157 ImageInterface<Float> * continuumsub(const String& outline, 00158 const String& outcont, Record& region, 00159 const Vector<int>& channels, 00160 const String& pol = "", 00161 const Int fitorder = 0, 00162 const Bool overwrite = false); 00163 00164 // the output <src>fakeBeam</src> indicates if there was no beam in the header and a fake one 00165 // was assumed to do the conversion. 00166 Quantity convertflux(Bool& fakeBeam, const Quantity& value, const Quantity& major, 00167 const Quantity& minor, 00168 const String& type = "Gaussian", 00169 const Bool topeak = True, 00170 Bool supressNoBeamWarnings = False); 00171 00172 ImageInterface<Float>* convolve2d( 00173 const String& outfile, const Vector<Int>& axes, 00174 const String& type, const Quantity& major, 00175 const Quantity& minor, const Quantity& pa, 00176 Double scale, Record& region, const String& mask, 00177 const Bool overwrite = False, const Bool stretch=False 00178 ); 00179 00180 CoordinateSystem coordsys(const Vector<int>& axes); 00181 00182 CoordinateSystem csys(const Vector<int>& axes); 00183 00184 Record* coordmeasures(Quantity& intensity, Record& direction, 00185 Record& frequency, Record& velocity, 00186 const Vector<double>& pixel); 00187 00188 Matrix<Float> decompose( 00189 Record& region, const String& mask, 00190 const Bool simple = false, 00191 const Double threshold = -1, 00192 const Int ncontour = 11, 00193 const Int minrange = 1, 00194 const Int naxis = 2, 00195 const Bool fit = True, 00196 const Double maxrms = -1, 00197 const Int maxretry = -1, 00198 const Int maxiter = 256, 00199 const Double convcriteria = 0.0001 00200 ); 00201 00202 Matrix<Float> decompose( 00203 Matrix<Int>& blcs, Matrix<Int>& trcs, 00204 Record& region, const String& mask, 00205 const Bool simple = false, 00206 const Double threshold = -1, 00207 const Int ncontour = 11, 00208 const Int minrange = 1, 00209 const Int naxis = 2, 00210 const Bool fit = True, 00211 const Double maxrms = -1, 00212 const Int maxretry = -1, 00213 const Int maxiter = 256, 00214 const Double convcriteria = 0.0001, 00215 const Bool stretch=False 00216 ); 00217 00218 Record deconvolvecomponentlist(Record& complist); 00219 00220 Bool remove(Bool verbose=true); 00221 00222 Bool fft( 00223 const String& real, const String& imag, const String& amp, 00224 const String& phase, const Vector<Int>& axes, Record& region, 00225 const String& mask, const Bool stretch 00226 ); 00227 00228 Record findsources(const Int nmax, const Double cutoff, Record& region, 00229 const String& mask, const Bool point = True, 00230 const Int width = 5, const Bool negfind = False); 00231 00232 ImageInterface<Float>* fitpolynomial(const String& residfile, 00233 const String& fitfile, 00234 const String& sigmafile, 00235 const Int axis, const Int order, 00236 Record& region, const String& mask, 00237 const bool overwrite = false); 00238 00239 Bool getchunk(Array<Float>& pixel, Array<Bool>& pixmask, 00240 const Vector<Int>& blc, const Vector<Int>& trc, 00241 const Vector<Int>& inc, const Vector<Int>& axes, 00242 const Bool list = False, const Bool dropdeg = False, 00243 const bool getmask = False); 00244 00245 Bool getregion( 00246 Array<Float>& pixels, Array<Bool>& pixmask, Record& region, 00247 const Vector<Int>& axes, const String& mask, 00248 const Bool list=False, const Bool dropdeg=False, 00249 const Bool getmask=False, const Bool extendMask=False 00250 ); 00251 00252 Record* getslice(const Vector<Double>& x, const Vector<Double>& y, 00253 const Vector<Int>& axes, const Vector<Int>& coord, 00254 const Int npts = 0, const String& method = "linear"); 00255 00256 ImageInterface<Float>* hanning( 00257 const String& outfile, Record& region, 00258 const String& mask, const Int axis=-10, 00259 const Bool drop=True, 00260 const bool overwrite=False, 00261 const Bool extendMask=True 00262 ); 00263 00264 Vector<Bool> haslock(); 00265 00266 Bool histograms( 00267 Record& histout, const Vector<Int>& axes, Record& region, 00268 const String& mask, const Int nbins, 00269 const Vector<Double>& includepix, const Bool gauss, 00270 const Bool cumu, const Bool log, const Bool list, 00271 const String& plotter, const Int nx, const Int ny, 00272 const Vector<Int>& size, const Bool force=False, 00273 const Bool disk=False, const Bool extendMask=False 00274 ); 00275 00276 Vector<String> history(const Bool list = False, const Bool browse = True); 00277 00278 ImageInterface<Float> * insert(const String& infile, Record& region, 00279 const Vector<double>& locate); 00280 00281 // Bool isopen(); 00282 00283 Bool ispersistent(); 00284 00285 Bool lock(const Bool writelock = False, const Int nattempts = 0); 00286 00287 Bool makecomplex(const String& outfile, const String& imag, Record& region, 00288 const Bool overwrite = False); 00289 00290 Vector<String> maskhandler(const String& op,const Vector<String>& nam); 00291 00292 Record miscinfo(); 00293 00294 Bool modify( 00295 Record& model, Record& region , const String& mask, 00296 const Bool subtract = True, const Bool list=True, const Bool extendMask=False 00297 ); 00298 00299 Record maxfit(Record& region, const Bool point, const Int width = 5, 00300 const Bool negfind = False, const Bool list = True); 00301 00302 ImageInterface<Float> * moments( 00303 const Vector<Int>& moments, const Int axis, Record& region, 00304 const String& mask, const Vector<String>& method, 00305 const Vector<Int>& smoothaxes, 00306 const Vector<String>& smoothtypes, 00307 const Vector<Quantity>& smoothwidths, 00308 const Vector<Float>& includepix, 00309 const Vector<Float>& excludepix, 00310 const Double peaksnr, const Double stddev, 00311 const String& doppler = "RADIO", const String& outfile = "", 00312 const String& smoothout="", const String& plotter="/NULL", 00313 const Int nx=1, const Int ny=1, const Bool yind=False, 00314 const Bool overwrite=False, const Bool drop=True, 00315 const Bool stretchMask=False 00316 ); 00317 00318 String name(const Bool strippath = False); 00319 00320 Bool open(const String& infile); 00321 00322 Record* pixelvalue(const Vector<Int>& pixel); 00323 void pixelValue (Bool& offImage, Quantum<Double>& value, Bool& mask, 00324 Vector<Int>& pos) const; 00325 00326 Bool putchunk(const Array<Float>& pixels, const Vector<Int>& blc, 00327 const Vector<Int>& inc, const Bool list = False, 00328 const Bool locking = True, const Bool replicate = False); 00329 00330 Bool putregion(const Array<Float>& pixels, const Array<Bool>& pixelmask, 00331 Record& region, const Bool list = False, 00332 const Bool usemask = True, 00333 const Bool locking = True, const Bool replicate = False); 00334 00335 ImageInterface<Float> * rebin( 00336 const String& outfile, 00337 const Vector<Int>& bin, Record& region, 00338 const String& mask, const Bool dropdeg, 00339 const Bool overwrite=False, 00340 const Bool extendMask=False 00341 ); 00342 00343 //regrids to a given coordinate system...one uses a record that is 00344 //converted to a CoordinateSytem 00345 00346 ImageInterface<Float> * regrid( 00347 const String& outfile, 00348 const Vector<Int>& shape, 00349 const Record& csys, const Vector<Int>& axes, 00350 Record& region, const String& mask, 00351 const String& method="linear", 00352 const Int decimate=10, 00353 const Bool replicate=False, 00354 const Bool doref=True, 00355 const Bool dropdeg=False, 00356 const Bool overwrite=False, 00357 const Bool force=False, 00358 const Bool specAsVelocity=False, 00359 const Bool extendAxes=False 00360 ); 00361 00362 00363 // regrids to match the "other" image interface... 00364 ImageInterface<Float> * regrid( 00365 const String& outfile, const ImageInterface<Float>*other, 00366 const String& method="linear", 00367 const Vector<Int>& axes = Vector<Int>(0), 00368 const Record ®ion = Record(), 00369 const String& mask="", 00370 const Int decimate=10, 00371 const Bool replicate=False, 00372 const Bool doref=True, 00373 const Bool dropdeg=False, 00374 const Bool overwrite=False, 00375 const Bool force=False, 00376 const Bool specAsVelocity=False, 00377 const Bool extendAxes=False 00378 ); 00379 00380 ImageInterface<Float>* rotate( 00381 const String& outfile, 00382 const Vector<int>& shape, 00383 const Quantity& pa, Record& region, 00384 const String& mask, 00385 const String& method="cubic", 00386 const Int decimate=0, 00387 const Bool replicate=False, 00388 const Bool dropdeg=False, 00389 const Bool overwrite=False, 00390 const Bool extendMask=False 00391 ); 00392 00393 Bool rename(const String& name, const Bool overwrite = False); 00394 00395 Bool replacemaskedpixels( 00396 const String& pixels, Record& region, 00397 const String& mask, const Bool update=False, 00398 const Bool list=False, const Bool extendMask=False 00399 ); 00400 00401 Record restoringbeam(); 00402 00403 ImageInterface<Float>* sepconvolve( 00404 const String& outfile, 00405 const Vector<Int>& axes, 00406 const Vector<String>& types, 00407 const Vector<Quantity>& widths, 00408 Double scale, 00409 Record& region, 00410 const String& mask, 00411 const bool overwrite=False, 00412 const bool extendMask=False 00413 ); 00414 00415 Bool set(const String& pixels, const Int pixelmask, 00416 Record& region, const Bool list = false); 00417 00418 Bool setbrightnessunit(const String& unit); 00419 00420 bool setcoordsys(const Record& csys); 00421 00422 bool sethistory(const String& origin, const Vector<String>& history); 00423 00424 bool setmiscinfo(const Record& info); 00425 00426 Vector<Int> shape(); 00427 00428 Bool setrestoringbeam(const Quantity& major, const Quantity& minor, 00429 const Quantity& pa, const Record& beam, 00430 const Bool remove = False, const Bool log = True); 00431 00432 // if messageStore != 0, log messages, stripped of time stampe and priority, will also be placed in this parameter and 00433 // returned to caller for eg logging to file. 00434 Bool statistics( 00435 Record& statsout, const Vector<Int>& axes, Record& region, 00436 const String& mask, const Vector<String>& plotstats, 00437 const Vector<Float>& includepix, const Vector<Float>& excludepix, 00438 const String& plotter="/NULL", const Int nx=1, 00439 const Int ny=1, const Bool list=True, 00440 const Bool force=False, const Bool disk=False, 00441 const Bool robust=False, const Bool verbose=True, 00442 const Bool extendMask=False, vector<String> *const &messageStore=0 00443 ); 00444 00445 bool twopointcorrelation( 00446 const String& outfile, Record& region, 00447 const String& mask, const Vector<Int>& axes, 00448 const String& method="structurefunction", 00449 const Bool overwrite=False, const Bool stretch=False 00450 ); 00451 00452 ImageInterface<Float> * subimage(const String& outfile, Record& region, 00453 const String& mask, 00454 const Bool dropdeg = False, 00455 const Bool overwrite = False, 00456 const Bool list = True, const Bool extendMask=False); 00457 00458 Vector<String> summary(Record& header, const String& doppler = "RADIO", 00459 const Bool list = True, 00460 const Bool pixelorder = True); 00461 00462 Bool tofits( 00463 const String& outfile, const Bool velocity, const Bool optical, 00464 const Int bitpix, const Double minpix, const Double maxpix, 00465 Record& region, const String& mask, 00466 const Bool overwrite=False, 00467 const Bool dropdeg=False, const Bool deglast=False, 00468 const Bool dropstokes=False, const Bool stokeslast=False, 00469 const Bool wavelength=False, const Bool airWavelength=False, 00470 const String& origin="", Bool stretch=False 00471 ); 00472 00473 Bool toASCII( 00474 const String& outfile, Record& region, const String& mask, 00475 const String& sep=" ", const String& format="%e", 00476 const Double maskvalue=-999, const Bool overwrite=False, 00477 const Bool extendMask=False 00478 ); 00479 00480 00481 Vector<Double> topixel(Record& value); 00482 00483 Record toworld(const Vector<double>& value, const String& format = "n"); 00484 00485 Bool unlock(); 00486 00487 Bool detached(); 00488 00489 Record setregion(const Vector<Int>& blc, const Vector<Int>& trc, 00490 const String& infile = ""); 00491 00492 Record setboxregion(const Vector<Double>& blc, const Vector<Double>& trc, 00493 const Bool frac = False, const String& infile = ""); 00494 00495 //make test image...cube or 2d (default) 00496 bool maketestimage(const String& outfile="", const Bool overwrite=False, 00497 const String& imagetype="2d"); 00498 00499 ImageInterface<Float> * newimage(const String& infile, 00500 const String& outfile, 00501 Record& region, 00502 const String& Mask, 00503 const bool dropdeg = False, 00504 const bool overwrite = False); 00505 00506 ImageInterface<Float> * newimagefromfile(const String& fileName); 00507 00508 ImageInterface<Float> * newimagefromarray(const String& outfile, 00509 Array<Float> & pixelsArray, 00510 const Record& csys, 00511 const Bool linear = False, 00512 const Bool overwrite = False, 00513 const Bool log = True); 00514 00515 ImageInterface<Float> * newimagefromshape(const String& outfile, 00516 const Vector<Int>& shape, 00517 const Record& csys, 00518 const Bool linear = True, 00519 const Bool overwrite = False, 00520 const Bool log = True); 00521 00522 ImageInterface<Float> * newimagefromfits(const String& outfile, 00523 const String& infile, 00524 const Int whichrep = 0, 00525 const Int whichhdu = 0, 00526 const Bool zeroblanks = False, 00527 const Bool overwrite = False); 00528 00529 Record* echo(Record& v, const Bool godeep = False); 00530 00531 00532 //Functions to get you back a spectral profile at direction position x, y. 00533 //x, y are to be in the world coord value or pixel value...user specifies 00534 //by parameter xytype ("world" or "pixel"). 00535 //On success returns true 00536 //return value of profile is in zyaxisval, zxaxisval contains the spectral 00537 //values at which zyaxisval is evaluated its in the spectral type 00538 //specified by specaxis...possibilities are "pixel", "frequency", "radio velocity" 00539 //"optical velocity", "wavelength" or "air wavelength" (the code checks for the 00540 //keywords "pixel", "freq", "vel", "optical", and "radio" in the string) 00541 // if "vel" is found but no "radio" or "optical", the full relativistic velocity 00542 // is generated (MFrequency::RELATIVISTIC) 00543 // xunits determines the units of the x-axis values...default is "GHz" for 00544 // freq and "km/s" for vel, "mm" for wavelength and "um" for "air wavelength" 00545 //PLEASE note that the returned value of zyaxisval are the units of the image 00546 //specframe can be a valid frame from MFrequency...i.e LSRK, LSRD etc... 00547 Bool getFreqProfile(const Vector<Double>& xy, 00548 Vector<Float>& zxaxisval, Vector<Float>& zyaxisval, 00549 const String& xytype="world", 00550 const String& specaxis="freq", 00551 const Int& whichStokes=0, 00552 const Int& whichTabular=0, 00553 const Int& whichLinear=0, 00554 const String& xunits="", 00555 const String& specframe="", 00556 const Int& whichQuality=0, 00557 const String& restValue=""); 00558 00559 //how about using this ? 00560 //for x.shape(xn) & y shape(yn) 00561 //if xn == yn == 1, single point 00562 //if xn == yn == 2, rectangle 00563 //if (xn == yn) > 2, polygon (could originate from ellipse) 00564 Bool getFreqProfile(const Vector<Double>& x, 00565 const Vector<Double>& y, 00566 Vector<Float>& zxaxisval, Vector<Float>& zyaxisval, 00567 const String& xytype="world", 00568 const String& specaxis="freq", 00569 const Int& whichStokes=0, 00570 const Int& whichTabular=0, 00571 const Int& whichLinear=0, 00572 const String& xunits="", 00573 const String& specframe="", 00574 const Int &combineType=0, 00575 const Int& whichQuality=0, 00576 const String& restValue=""); 00577 00578 // Return a record of the associates ImageInterface 00579 Bool toRecord(RecordInterface& rec); 00580 // Create a pagedimage if imagename is not "" else create a tempimage 00581 Bool fromRecord(const RecordInterface& rec, const String& imagename=""); 00582 00583 // Deconvolve from beam 00584 // return True if the deconvolved source is a point source, False otherwise 00585 // The returned value of successFit is True if the deconvolution could be performed, False otherwise. 00586 casa::Bool 00587 deconvolveFromBeam(Quantity& majorFit, 00588 Quantity& minorFit, 00589 Quantity& paFit, 00590 Bool& successFit, 00591 const Vector<Quantity>& beam); 00592 00593 // get the associated ImageInterface object 00594 const ImageInterface<Float>* getImage() const; 00595 00596 // If file name empty make TempImage (allowTemp=T) or do nothing. 00597 // Otherwise, make a PagedImage from file name and copy mask and 00598 // misc from inimage. Returns T if image made, F if not 00599 static Bool makeExternalImage ( 00600 std::auto_ptr<ImageInterface<Float> >& image, 00601 const String& fileName, 00602 const CoordinateSystem& cSys, 00603 const IPosition& shape, 00604 const ImageInterface<Float>& inImage, 00605 LogIO& os, Bool overwrite=False, 00606 Bool allowTemp=False, 00607 Bool copyMask=True 00608 ); 00609 00610 00611 private: 00612 00613 ImageInterface<Float> *pImage_p; 00614 LogIO *itsLog; 00615 00616 00617 00618 // Having private version of IS and IH means that they will 00619 // only recreate storage images if they have to 00620 00621 ImageStatistics<casa::Float>* pStatistics_p; 00622 ImageHistograms<casa::Float>* pHistograms_p; 00623 // 00624 IPosition last_chunk_shape_p; 00625 ImageRegion* pOldStatsRegionRegion_p; 00626 casa::ImageRegion* pOldStatsMaskRegion_p; 00627 casa::ImageRegion* pOldHistRegionRegion_p; 00628 casa::ImageRegion* pOldHistMaskRegion_p; 00629 casa::Bool oldStatsStorageForce_p, oldHistStorageForce_p; 00630 00631 00632 00633 // Center refpix apart from STokes 00634 void centreRefPix (casa::CoordinateSystem& cSys, 00635 const casa::IPosition& shape) const; 00636 00637 // Convert types 00638 casa::ComponentType::Shape convertModelType (casa::Fit2D::Types typeIn) const; 00639 00640 // Delete private ImageStatistics and ImageHistograms objects 00641 bool deleteHistAndStats(); 00642 00643 00644 // Hanning smooth a vector 00645 void hanning_smooth (casa::Array<casa::Float>& out, 00646 casa::Array<casa::Bool>& maskOut, 00647 const casa::Vector<casa::Float>& in, 00648 const casa::Array<casa::Bool>& maskIn, 00649 casa::Bool isMasked) const; 00650 00651 00652 // Make a new image with given CS 00653 casa::Bool make_image(casa::String &error, const casa::String &image, 00654 const casa::CoordinateSystem& cSys, 00655 const casa::IPosition& shape, 00656 casa::LogIO& os, casa::Bool log=casa::True, 00657 casa::Bool overwrite=casa::False); 00658 00659 00660 // Make a mask and define it in the image. 00661 static Bool makeMask(casa::ImageInterface<Float>& out, 00662 String& maskName, 00663 Bool init, Bool makeDefault, 00664 LogIO& os, Bool list); 00665 00666 // See if the combination of the 'region' and 'mask' ImageRegions have changed 00667 casa::Bool haveRegionsChanged (casa::ImageRegion* pNewRegionRegion, 00668 casa::ImageRegion* pNewMaskRegion, 00669 casa::ImageRegion* pOldRegionRegion, 00670 casa::ImageRegion* pOldMaskRegion) const; 00671 00672 // Convert a Record to a CoordinateSystem 00673 casa::CoordinateSystem* 00674 makeCoordinateSystem(const casa::Record& cSys, 00675 const casa::IPosition& shape) const; 00676 00677 // Make a block of regions from a Record 00678 void makeRegionBlock(casa::PtrBlock<const casa::ImageRegion*>& regions, 00679 const casa::Record& Regions, 00680 casa::LogIO& logger); 00681 00682 // Set the cache 00683 void set_cache(const casa::IPosition& chunk_shape) const; 00684 00685 00686 // Prints an error message if the image DO is detached and returns True. 00687 //bool detached() const; 00688 00689 // Convert object-id's in the expression to LatticeExprNode objects. 00690 // It returns a string where the object-id's are placed by $n. 00691 // That string can be parsed by ImageExprParse. 00692 // Furthermore it fills the string exprName with the expression 00693 // where the object-id's are replaced by the image names. 00694 // Note that an image name can be an expression in itself, so 00695 // this string is not suitable for the ImageExprParse. 00696 //casa::String substituteOID (casa::Block<casa::LatticeExprNode>& nodes, 00697 // casa::String& exprName, 00698 // const casa::String& expr) const; 00699 00700 00701 // Some helper functions that needs to be in casa namespace coordsys 00702 00703 Record toWorldRecord (const Vector<Double>& pixel, 00704 const String& format) const; 00705 00706 Record worldVectorToRecord (const Vector<Double>& world, 00707 Int c, const String& format, 00708 Bool isAbsolute, Bool showAsAbsolute) const; 00709 00710 Record worldVectorToMeasures(const Vector<Double>& world, 00711 Int c, Bool abs) const; 00712 00713 void trim (Vector<Double>& inout, 00714 const Vector<Double>& replace) const; 00715 00716 //return a vector of the spectral axis values in units requested 00717 //e.g "vel", "fre" or "pix"..specVal has to be sized already 00718 Bool getSpectralAxisVal(const String& specaxis, Vector<Float>& specVal, 00719 const CoordinateSystem& cSys, const String& xunits, 00720 const String& freqFrame="", const String& restValue=""); 00721 //return a vector of the spectral axis values in units requested 00722 //e.g "vel", "fre" or "pix"..specVal has to be sized already 00723 00724 00725 ImageInterface<Float> * _regrid( 00726 const String& outfile, const Vector<Int>& shape, 00727 const CoordinateSystem& csys, const Vector<Int>& axes, 00728 const Record& region, const String& mask, 00729 const String& method, const Int decimate, 00730 const Bool replicate, const Bool doref, 00731 const Bool dropdeg, const Bool overwrite, 00732 const Bool force, const Bool extendMask 00733 ); 00734 00735 ImageInterface<Float>* _regridByVelocity( 00736 const String& outfile, const Vector<Int>& shape, 00737 const CoordinateSystem& csysTemplate, const Vector<Int>& axes, 00738 const Record& region, const String& mask, 00739 const String& method, const Int decimate, 00740 const Bool replicate, const Bool doref, 00741 const Bool dropdeg, const Bool overwrite, 00742 const Bool force, const Bool extendMask 00743 ) const; 00744 }; 00745 00746 } // casac namespace 00747 #endif 00748