00001 //# ParameterParser.h 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 IMAGEANALYSIS_PARAMETERPARSER_H 00027 #define IMAGEANALYSIS_PARAMETERPARSER_H 00028 00029 #include <casacore/casa/aips.h> 00030 00031 #include <vector> 00032 00033 namespace casa { 00034 00035 class String; 00036 template <class T> class Vector; 00037 00038 00039 // <summary> 00040 // Parse various common input parameters to image analysis tasks and tool methods 00041 // </summary> 00042 // <author>Dave Mehringer</author> 00043 // <use visibility=export> 00044 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00045 // </reviewed> 00046 // <prerequisite> 00047 00048 // </prerequisite> 00049 00050 // <etymology> 00051 // Parse parameters 00052 // </etymology> 00053 00054 // <synopsis> 00055 // This class is for parsing input parameters associated with image analysis tasks and tool methods. 00056 00057 class ParameterParser { 00058 public: 00059 00060 // <src>ranges</src> are pairs describing the pixel range over which to select. 00061 // If you want to select just one pixel in the "range", you must specify that pixel 00062 // in both parts of the pair. So if you want to select pixels 0 through 5 and pixel 13, 00063 // you'd specify ranges[0] = 0; ranges[1] = 5; ranges[2] = 13; ranges[3] = 13 00064 static std::vector<uInt> consolidateAndOrderRanges( 00065 uInt& nSelected, const std::vector<uInt>& ranges 00066 ); 00067 00068 // get spectral ranges from chans parameter, 00069 // nSelectedChannels will have the total number of channels selected for the 00070 // specification, for an image that has nChannels. 00071 static std::vector<uInt> spectralRangesFromChans( 00072 uInt& nSelectedChannels, const String& specification, const uInt nChannels 00073 ); 00074 00075 // get a vector of correlations, represented by String, from a stokes string specifcation, 00076 // eg, "LLRR", "IV", etc that is commonly used in the stokes parameter in 00077 // casa image analysis tasks 00078 static std::vector<String> stokesFromString(String& specification); 00079 }; 00080 00081 }; 00082 00083 #endif