LCStretch.h

Go to the documentation of this file.
00001 //# LCStretch.h: Stretch length 1 axes in an LCRegion along straight lines
00002 //# Copyright (C) 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 LATTICES_LCSTRETCH_H
00029 #define LATTICES_LCSTRETCH_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/lattices/LRegions/LCRegionMulti.h>
00034 #include <casacore/lattices/LRegions/LCBox.h>
00035 
00036 
00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00038 
00039 // <summary>
00040 // Stretch length 1 axes in an LCRegion along straight lines
00041 // </summary>
00042 
00043 // <use visibility=export>
00044 
00045 // <reviewed reviewer="" date="" tests="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> <linkto class=LCRegion>LCRegion</linkto>
00050 // </prerequisite>
00051 
00052 // <synopsis> 
00053 // The LCStretch class is a specialization of class
00054 // <linkto class=LCRegion>LCRegion</linkto>.
00055 // It makes it possible to stretch a LCRegion along straight lines to
00056 // other dimensions. E.g. a circle in the xy-plane can be stretched to
00057 // a cylinder in the xyz-space.
00058 // It can be used for a lattice of any dimensionality as long as the
00059 // dimensionality of the (hyper-)stretch matches the dimensionality of
00060 // the lattice.
00061 // </synopsis> 
00062 
00063 // <example>
00064 // <srcblock>
00065 // </srcblock>
00066 // </example>
00067 
00068 // <todo asof="1997/11/11">
00069 // <li> Stretch along (slanted) cone lines
00070 // </todo>
00071 
00072 class LCStretch: public LCRegionMulti
00073 {
00074 public:
00075     LCStretch();
00076 
00077     // Stretch the given region along axes as given by <src>stretchAxes</src>
00078     // from the bottom left corner (blc) to the top right corner (trc)
00079     // as given by <src>stretchBox</src>.
00080     // The axes to be stretched need to have length 1 in the original region.
00081     // Every kind of box (absolute, relative, fractional, unspecified)
00082     // can be used to define the stretch blc and trc.
00083     // The dimensionality of the LCStretch region is the same as the
00084     // dimensionality of the original region.
00085     // <br>
00086     // The second version takes over the pointer when the switch is true.
00087     // <group> 
00088     LCStretch (const LCRegion& region,
00089                const IPosition& stretchAxes,
00090                const LCBox& stretchBox);
00091     LCStretch (Bool takeOver,
00092                const LCRegion* region,
00093                const IPosition& stretchAxes,
00094                const LCBox& stretchBox);
00095     // </group>
00096 
00097     // Copy constructor (copy semantics).
00098     LCStretch (const LCStretch& other);
00099 
00100     virtual ~LCStretch();
00101 
00102     // Assignment (copy semantics).
00103     LCStretch& operator= (const LCStretch& other);
00104 
00105     // Comparison
00106     virtual Bool operator== (const LCRegion& other) const;
00107  
00108     // Make a copy of the derived object.
00109     virtual LCRegion* cloneRegion() const;
00110 
00111     // Get the original region.
00112     const LCRegion& region() const;
00113     
00114      // Get the stretch axes.
00115     const IPosition& stretchAxes() const;
00116 
00117     // Get the stretch box.
00118     const LCBox& stretchBox() const;
00119 
00120     // Get the class name (to store in the record).
00121     static String className();
00122 
00123     // Get the region type.  Returns the class name.
00124     virtual String type() const;
00125  
00126     // Convert the (derived) object to a record.
00127     virtual TableRecord toRecord (const String& tableName) const;
00128 
00129     // Convert correct object from a record.
00130     static LCStretch* fromRecord (const TableRecord&,
00131                                   const String& tableName);
00132 
00133 protected:
00134     // Construct another LCRegion (for e.g. another lattice) by moving
00135     // this one. It recalculates the bounding box and mask.
00136     // A positive translation value indicates "to right".
00137     virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
00138                                    const IPosition& newLatticeShape) const;
00139 
00140     // Do the actual getting of the mask.
00141     virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
00142 
00143     // This function is needed here because the niceCursorShape of the
00144     // contributing region does not make any sense (other dimensionality). 
00145     virtual IPosition doNiceCursorShape (uInt maxPixels) const;
00146 
00147 private:
00148     // Fill the object.
00149     void fill (const IPosition& stretchAxes, const LCBox& stretchBox);
00150 
00151 
00152     IPosition itsStretchAxes;
00153     LCBox     itsStretchBox;
00154 };
00155 
00156 
00157 inline const LCRegion& LCStretch::region() const
00158 {
00159     return *(regions()[0]);
00160 }
00161 inline const IPosition& LCStretch::stretchAxes() const
00162 {
00163     return itsStretchAxes;
00164 }
00165 inline const LCBox& LCStretch::stretchBox() const
00166 {
00167     return itsStretchBox;
00168 }
00169 
00170 
00171 
00172 } //# NAMESPACE CASACORE - END
00173 
00174 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1