Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/RegionManager_8h_source.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 21:30:31 2011
Кодировка:
casacore: images/Regions/RegionManager.h Source File

RegionManager.h

Go to the documentation of this file.
00001 //# RegionManager.h: Manangement of image regions
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 IMAGES_REGIONMANAGER_H
00027 #define IMAGES_REGIONMANAGER_H
00028 
00029 #include <lattices/Lattices/RegionType.h>
00030 #include <tables/Tables/Table.h>
00031 
00032 
00033 namespace casa {
00034 
00035   //# Forward Declarations.
00036   class LogIO;
00037   class String;
00038   class Record;
00039   template<class T> class Vector;
00040   class CoordinateSystem;
00041   class WCRegion;
00042   class WCBox;
00043   template<class T> class PtrBlock;
00044   class ImageRegion;
00045   template<class T> class Quantum;
00046 
00047   // <summary>
00048   // image component class handling regions
00049   // </summary>
00050 
00051   // <synopsis>
00052   // This is a casa based class to provide the funtionality to the 
00053   // RegionManager Tool
00054   // </synopsis>
00055 
00056   class RegionManager
00057   {
00058   public:
00059     //blank constructor
00060     RegionManager();
00061     RegionManager(CoordinateSystem& csys);
00062     virtual ~RegionManager();
00063     String absreltype(const Int absrelval=0);
00064 
00065     //Some little but useful tidbits.
00066     bool isPixelRegion(const ImageRegion& reg);
00067     bool isWorldRegion(const ImageRegion& reg);
00068     void setcoordsys(const CoordinateSystem& csys);
00069       
00070     //LCSlicer box
00071     Record* box(const Vector<Double>& blc, const Vector<Double>& trc, 
00072                 const Vector<Double>& inc, const String& absrel,
00073                 const Bool frac, const String& comment="");
00074     //LCBox box
00075     Record* box(const Vector<Double>& blc, const Vector<Double>& trc, 
00076                 const Vector<Int>& shape, const String& comment="");
00077     Record* wbox(const Vector<Quantity>& blc, 
00078                  const Vector<Quantity>& trc, 
00079                  const Vector<Int>& pixelaxes, 
00080                  const CoordinateSystem& csys,
00081                  const String& absrel, const String& comment);
00082     Record* wbox(const Vector<Quantity>& blc, 
00083                  const Vector<Quantity>& trc, 
00084                  const Vector<Int>& pixelaxes, 
00085                  const String& absrel, const String& comment);
00086     ImageRegion* wbox(const Vector<Quantity>& blc, 
00087                       const Vector<Quantity>& trc, 
00088                       const Vector<Int>& pixelaxes, 
00089                       const CoordinateSystem& csys,
00090                       const String& absrel="abs" );
00091     //Wpolygon with coordsys and if pixelaxes[0] is -1 then its assumed
00092     //to be 0,1,...
00093     ImageRegion* wpolygon(const Vector<Quantity>& x, 
00094                           const Vector<Quantity>& y, 
00095                           const Vector<Int>& pixelaxes, 
00096                           const CoordinateSystem& csys, 
00097                           const String& absrel);
00098     //wpolygon version without csys...throws an exception if 
00099     //setcoordsys is not run
00100     ImageRegion* wpolygon(const Vector<Quantity>& x, 
00101                           const Vector<Quantity>& y, 
00102                           const Vector<Int>& pixelaxes,  
00103                           const String& absrel);
00104       
00105     //Various versions of creating a complement region
00106     ImageRegion*  doComplement(const WCRegion& reg1);
00107     ImageRegion*  doComplement(const PtrBlock<const WCRegion*>& reg1);
00108     ImageRegion*  doComplement(const ImageRegion& reg1);
00109 
00110     //Various versions of concatenating a region onto another.
00111     ImageRegion*  doConcatenation(const WCRegion& region, const WCBox& box);
00112     ImageRegion*  doconcatenation(const PtrBlock<const WCRegion*>& regions, const WCBox& box);
00113     ImageRegion*  doConcatenation(const PtrBlock<const ImageRegion*>& regions, const TableRecord& box);
00114     ImageRegion*  doConcatenation(const Record& regions, const TableRecord& box);
00115 
00116     //Various versions of handling the difference of regions
00117     ImageRegion*  doDifference(const WCRegion& reg1, const WCRegion& reg2);
00118     ImageRegion*  doDifference(const PtrBlock<const WCRegion*>& reg1);
00119     ImageRegion*  doDifference(const ImageRegion& reg1, const ImageRegion& reg2);
00120 
00121     //Different versions of intersecting regions
00122     ImageRegion*  doIntersection(const WCRegion& reg1, const WCRegion& reg2);
00123     ImageRegion*  doIntersection(const PtrBlock<const WCRegion*>& reg1);
00124     ImageRegion*  doIntersection(const ImageRegion& reg1, const ImageRegion& reg2);
00125 
00126     //Different versions of unioning regions
00127     ImageRegion*  doUnion(const WCRegion& reg1, const WCRegion& reg2);
00128     ImageRegion*  doUnion(const PtrBlock<const WCRegion*>& reg1);
00129     ImageRegion*  doUnion(const ImageRegion& reg1, const ImageRegion& reg2);
00130       
00131     //Reading of a file containing an ImageRegion in the AipsIO format dump
00132     Record* readImageFile(const String& filename, const String& dummy);
00133     //Writing a file of the AipsIO dump of the record representation of the region
00134     Bool writeImageFile(const String& file, const String& dummy,
00135                         const Record& regionRecord);
00136 
00137     //save region into a table (image, blank table or any other such)
00138     String imageRegionToTable(const String& tabName, 
00139                               const ImageRegion& imreg,
00140                               const String& regName); 
00141 
00142     String recordToTable(const String& tabName, const RecordInterface& rec, 
00143                          const String& regName="");
00144     //recover region from table
00145     Record* tableToRecord(const String& tabName,   const String& regname);
00146 
00147     //names of regions in table
00148     Vector<String> namesInTable(const String& tabName);
00149 
00150     //Remove a region from table...refuse if regionname is ""
00151     Bool removeRegionInTable(const String& tabName, const String& regName);
00152 
00153 
00154   private:
00155     // Function to return the internal Table object to the RegionHandler.
00156     static Table& getTable (void* ptr, Bool writable);
00157     RegionType::AbsRelType regionTypeFromString(const String& absreltype);
00158 
00159     //# Data members
00160     LogIO*            itsLog;
00161     CoordinateSystem* itsCSys;
00162     Table             tab_p;
00163   };
00164 
00165 } // casa namespace
00166 
00167 #endif
00168 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines