00001 //# ComponentImager.h: this defines ComponentImager, which ... 00002 //# Copyright (C) 1999,2000,2003 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 //# 00027 //# $Id: ComponentImager.h 20299 2008-04-03 05:56:44Z gervandiepen $ 00028 //#! ======================================================================== 00029 //#! Attention! Programmers read this! 00030 //#! 00031 //#! This file is a template to guide you in creating a header file 00032 //#! for your new class. By following this template, you will create 00033 //#! a permanent reference document for your class, suitable for both 00034 //#! the novice client programmer, the seasoned veteran, and anyone in 00035 //#! between. It is essential that you write the documentation portions 00036 //#! of this file with as much care as you do the source code. 00037 //#! 00038 //#! If you are unfamilar with the AIPS++ header style please refer to 00039 //#! template-class-h. 00040 //#! 00041 //#! Replacement Tokens 00042 //#! ------------------ 00043 //#! 00044 //#! These are character strings enclosed in angle brackets, on a commented 00045 //#! line. Two are found on the first line of this file: 00046 //#! 00047 //#! <ClassFileName.h> <ClassName> 00048 //#! 00049 //#! You should remove the angle brackets, and replace the characters within 00050 //#! the brackets with names specific to your class. Mimic the capitalization 00051 //#! and punctuation of the original. For example, you would change 00052 //#! 00053 //#! <ClassFileName.h> to LatticeIter.h 00054 //#! <ClassName> to LatticeIterator 00055 //#! 00056 //#! Another replacement token will be found in the "include guard" just 00057 //#! a few lines below. 00058 //#! 00059 //#! #define <AIPS_CLASSFILENAME_H> to #define AIPS_LATTICEITER_H 00060 //#! 00061 00062 #ifndef IMAGES_COMPONENTIMAGER_H 00063 #define IMAGES_COMPONENTIMAGER_H 00064 00065 #include <casa/aips.h> 00066 00067 #include <imageanalysis/ImageAnalysis/ImageTask.h> 00068 #include <components/ComponentModels/ComponentList.h> 00069 00070 #include <memory> 00071 00072 namespace casa { 00073 00074 template <class T> class ImageInterface; 00075 class Unit; 00076 class LogIO; 00077 template <class T> class MeasRef; 00078 class MDirection; 00079 class MVAngle; 00080 template <class T> class Vector; 00081 class MVFrequency; 00082 class MFrequency; 00083 00084 // <summary> 00085 // </summary> 00086 00087 // <use visibility=local> 00088 00089 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00090 // </reviewed> 00091 00092 // <prerequisite> 00093 // <li> ImageInterface 00094 // <li> ComponentList 00095 // </prerequisite> 00096 // 00097 // <etymology> 00098 // </etymology> 00099 // 00100 // <synopsis> 00101 // Project the componentlist onto the image. If any of the coordinate 00102 // transformations for a particular pixel fail (e.g. coordinate system 00103 // is not defined for that pixel) if the image has a writable mask, then those 00104 // pixels will be masked, otherwise they are just zeroed. Any pixels 00105 // that are already masked mask=F) will not have their values changed 00106 // (perhaps this behaviour should be changed). 00107 // </synopsis> 00108 // 00109 // <example> 00110 // </example> 00111 // 00112 // <motivation> 00113 // </motivation> 00114 00115 class ComponentImager: public ImageTask<Float> { 00116 public: 00117 00118 ComponentImager() = delete; 00119 00120 ComponentImager( 00121 const SPIIF image, const Record *const ®ionPtr, 00122 const String& maskInp 00123 ); 00124 00125 ~ComponentImager(); 00126 00127 void setComponentList(const ComponentList& list) { 00128 _list = list; 00129 } 00130 00131 void setSubtract(Bool b) { _subtract = b; } 00132 00133 String getClass() const { return "ComponentImager"; } 00134 00135 void modify(Bool verbose); 00136 00137 // Project the componentlist onto the image. If any of the coordinate 00138 // transformations for a particular pixel fail (e.g. coordinate system 00139 // is not defined for that pixel) if the image has a writable mask, then those 00140 // pixels will be masked, otherwise they are just zeroed. Any pixels 00141 // that are already masked mask=F) will not have their values changed 00142 // (perhaps this behaviour should be changed). 00143 static void project( 00144 ImageInterface<Float>& image, 00145 const ComponentList& list 00146 ); 00147 00148 private: 00149 // we cannot use pointer stored in base class because that's const 00150 SPIIF _image; 00151 00152 ComponentList _list; 00153 00154 Bool _subtract = False; 00155 00156 CasacRegionManager::StokesControl _getStokesControl() const { 00157 return CasacRegionManager::USE_ALL_STOKES; 00158 } 00159 00160 std::vector<Coordinate::Type> _getNecessaryCoordinates() const { 00161 return std::vector<Coordinate::Type>(1, Coordinate::DIRECTION); 00162 } 00163 00164 static std::unique_ptr<ComponentList> _doPoints( 00165 ImageInterface<Float>& image, const ComponentList& list, 00166 int longAxis, int latAxis, const Unit& fluxUnits, 00167 const MeasRef<MDirection>& dirRef, const MVAngle& pixelLatSize, 00168 const MVAngle& pixelLongSize, const Vector<MVFrequency>& freqValues, 00169 const MeasRef<MFrequency>& freqRef, Int freqAxis, Int polAxis, uInt nStokes 00170 ); 00171 00172 }; 00173 00174 } 00175 00176 #endif 00177 00178