casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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 <components/ComponentModels/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     //set the SDimage and Int images 
00054     void setSDScale(Float sdscale=1.0);
00055     void setSDImage(const ImageInterface<Float>& SDImage);
00056     void setINTImage(const ImageInterface<Float>& IntImage);
00057     //set and get effective dish diameter to be used in feathering function
00058     //setEffectiveDishDiam will return False if you are trying to assign a finer resolution than what 
00059     //the original data came with 
00060     Bool setEffectiveDishDiam(const Float xdiam, const Float ydiam=-1.0);
00061     void getEffectiveDishDiam(Float& xdiam, Float& ydiam);
00062     //Get the 1-D slices of amplitude  along the x and y axis of the FFT of images  
00063     //Note the SD image is already feathered by its beam..you cannot get unfeathered SD data as it implies deconvolution
00064     void getFTCutSDImage(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00065     void getFTCutIntImage(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00066     //Get the 1-D slices of the feathering function that will be applied on SD and INTerf data
00067     void getFeatherSD(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00068     void getFeatherINT(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00069     //Get 1-D slices of the feathered data ...
00070     //note for SD  this
00071     //should return the same values as getFTCutSDImage
00072     void getFeatheredCutSD(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00073     void getFeatheredCutINT(Vector<Float>& ux, Vector<Float>& xamp, Vector<Float>& uy, Vector<Float>& yamp);
00074     //write the feathered image to disk
00075     Bool saveFeatheredImage(const String& imagename);
00076 
00078     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);
00079 
00080     static Double worldFreq(const CoordinateSystem& cs, Int spectralpix=0);
00081   private:
00082     void fillXVectors( Vector<Float>& ux, Vector<Float>& uy ) const;
00083     static void applyDishDiam(ImageInterface<Complex>& image, GaussianBeam& beam, Float effDiam, ImageInterface<Float>& newbeam, Vector<Quantity>& extraconv);
00084 
00085   private:
00086     CountedPtr<ImageInterface<Float> > lowIm_p;
00087     CountedPtr<ImageInterface<Float> > lowImOrig_p;
00088     CountedPtr<ImageInterface<Float> > highIm_p;
00089     CountedPtr<ImageInterface<Complex> > cwImage_p;
00090     CountedPtr<ImageInterface<Complex> > cwHighIm_p;
00091     void getCutXY(Vector<Float>& ux, Vector<Float>& xamp, 
00092                   Vector<Float>& uy, Vector<Float>& yamp, ImageInterface<Complex>& ftimage);
00093     //calculate the complex weight image to apply on the interf image
00094     static void getLowBeam(const ImageInterface<Float>& low0, const String& lowPSF, const Bool useDefaultPB, const String& vpTableStr, GaussianBeam& lBeam);
00095     void calcCWeightImage();
00096     void applyFeather();
00097     GaussianBeam hBeam_p;
00098     GaussianBeam lBeam_p;
00099     GaussianBeam lBeamOrig_p;
00100     Float dishDiam_p;
00101     Bool cweightCalced_p;
00102     Bool cweightApplied_p;
00103     Float sdScale_p;
00104     CoordinateSystem csysHigh_p;
00105   };
00106 
00107 
00108 
00109 } //# NAMESPACE CASA - END
00110 
00111 #endif