Feather.h

Go to the documentation of this file.
00001 //# Feather.h: Helper for feathering
00002 //# Copyright (C) 1996-2012
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 adressed 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 //#
00027 //# $Id$
00028 #ifndef SYNTHESIS_FEATHER_H
00029 #define SYNTHESIS_FEATHER_H
00030 
00031 #include <casa/BasicSL/String.h>
00032 #include <casa/BasicSL.h>
00033 #include <casa/Quanta/Quantum.h>
00034 #include <scimath/Mathematics/GaussianBeam.h>
00035 #include <coordinates/Coordinates/CoordinateSystem.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038   //Forward declaration
00039   template<class T> class ImageInterface;
00040   template<class T> class Vector;
00041   // <summary> Class that contains functions needed for feathering</summary>
00042 
00043   class Feather{
00044 
00045   public:
00046 
00047     //default constructor
00048     Feather();
00049     //Constructor 
00050     Feather(const ImageInterface<Float>& SDImage, const ImageInterface<Float>& INTImage, Float sdScale=1.0);
00051     //Destructor
00052     virtual ~Feather();
00053 
00054     //Clear the weight flags.  Used when changing between the
00055     //SDimage and the dirty image.
00056     void clearWeightFlags();
00057 
00058     //set the SDimage and Int images 
00059     void setSDScale(Float sdscale=1.0);
00060     void setSDImage(const ImageInterface<Float>& SDImage);
00061     void setINTImage(const ImageInterface<Float>& IntImage);
00062     //set and get effective dish diameter to be used in feathering function
00063     //setEffectiveDishDiam will return False if you are trying to assign a finer resolution than what 
00064     //the original data came with 
00065     Bool setEffectiveDishDiam(const Float xdiam, const Float ydiam=-1.0);
00066     void getEffectiveDishDiam(Float& xdiam, Float& ydiam);
00067     //Get the 1-D slices of amplitude  along the x and y axis of the FFT of images  
00068     //if radial is set to True then the 1D slice is the the circular average rather that X and Y cuts...only the x-values are valid then 
00069     //Note the SD image is already feathered by its beam..you cannot get unfeathered SD data as it implies deconvolution
00070     void getFTCutSDImage(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, const Bool radial=False );
00071     void getFTCutIntImage(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, Bool radial=False);
00072     //Get the 1-D slices of the feathering function that will be applied on SD and INTerf data
00073     //If normalize=False for the SD then the value for Jy/beam correction to final beam size is multiplied to 
00074     //the function
00075     void getFeatherSD(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, Bool radial=False, Bool normalize=True);
00076     void getFeatherINT(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, Bool radial=False);
00077     //Get 1-D slices of the feathered data ...
00078     //note for SD  this
00079     //should return the same values as getFTCutSDImage
00080     void getFeatheredCutSD(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, Bool radial=False);
00081     void getFeatheredCutINT(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp, Bool radial=False);
00082     //This function convolves the INT image to the new GaussianBeam
00083     //So the INT image stored in this object is going to be replaced by the new convolved image
00084     void convolveINT(const GaussianBeam& newHighBeam);
00085 
00086     //write the feathered image to disk
00087     Bool saveFeatheredImage(const String& imagename);
00089     static void getCutXY(Vector<Float>& ux, Vector<Float>& xamp, 
00090                          Vector<Float>& uy, Vector<Float>& yamp, 
00091                          const ImageInterface<Float>& image);
00092     static void getRadialCut(Vector<Float>& radius, Vector<Float>& radialAmp, 
00093                           const ImageInterface<Float>& image);
00094 
00095 
00097     static void feather(const String& image, const ImageInterface<Float>& high, const ImageInterface<Float>& low, const Float& sdScale=1.0, const String& lowPSF="", const Bool useDefault=True, const String& vpTable="" , Float effSDDiam=-1.0, const Bool lowpassfiltersd=False);
00098 
00099     static Double worldFreq(const CoordinateSystem& cs, Int spectralpix=0);
00100 
00101     
00102   private:
00103     void fillXVectors( Vector<Float>& ux, Vector<Float>& uy ) const;
00104     static void applyDishDiam(ImageInterface<Complex>& image, GaussianBeam& beam, Float effDiam, ImageInterface<Float>& newbeam, Vector<Quantity>& extraconv);
00105 
00106 
00107     
00108   
00109     CountedPtr<ImageInterface<Float> > lowIm_p;
00110     CountedPtr<ImageInterface<Float> > lowImOrig_p;
00111     CountedPtr<ImageInterface<Float> > highIm_p;
00112     CountedPtr<ImageInterface<Complex> > cwImage_p;
00113     CountedPtr<ImageInterface<Complex> > cwHighIm_p;
00114     static void getCutXY(Vector<Float>& ux, Vector<Float>& xamp, 
00115                   Vector<Float>& uy, Vector<Float>& yamp, ImageInterface<Complex>& ftimage);
00116     static void getRadialCut(Vector<Float>& radialAmp, ImageInterface<Complex>& ftimage);
00117     //calculate the complex weight image to apply on the interf image
00118     static void getLowBeam(const ImageInterface<Float>& low0, const String& lowPSF, const Bool useDefaultPB, const String& vpTableStr, GaussianBeam& lBeam);
00119     void calcCWeightImage();
00120     void applyFeather();
00121     static void getRadialUVval(const Int npix, const IPosition& imshape, const CoordinateSystem& csys, Vector<Float>& radius);
00122     GaussianBeam hBeam_p;
00123     GaussianBeam lBeam_p;
00124     GaussianBeam lBeamOrig_p;
00125     Float dishDiam_p;
00126     Bool cweightCalced_p;
00127     Bool cweightApplied_p;
00128     Float sdScale_p;
00129     CoordinateSystem csysHigh_p;
00130   };
00131 
00132 
00133 
00134 } //# NAMESPACE CASA - END
00135 
00136 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1