ViFrequencySelection.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #if ! defined (MSVIS_ViFrequencySelection_H_121116_1101)
00029 #define MSVIS_ViFrequencySelection_H_121116_1101
00030
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL.h>
00033 #include <casa/Arrays/Slicer.h>
00034 #include <measures/Measures/MFrequency.h>
00035
00036
00037 #include <set>
00038 #include <vector>
00039
00040 using std::set;
00041 using std::vector;
00042
00043 namespace casa {
00044
00045 class MeasurementSet;
00046 class MSSelection;
00047
00048 namespace vi {
00049
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class FrequencySelection {
00068
00069 public:
00070
00071 typedef enum {Unknown = -11, ByChannel = -10} SpecialFrames;
00072
00073 virtual ~FrequencySelection (){}
00074
00075 void addCorrelationSlices (const Vector <Vector <Slice> > & slices);
00076 virtual FrequencySelection * clone () const = 0;
00077 virtual Bool empty () const = 0;
00078 void filterByWindow (Int windowId = -1) const;
00079 Vector <Slice> getCorrelationSlices (Int polarizationId) const;
00080 Int getFrameOfReference () const;
00081 virtual set<int> getSelectedWindows () const = 0;
00082 virtual String toString () const = 0;
00083
00084 static String frameName (Int referenceFrame);
00085
00086
00087
00088
00089
00090 protected:
00091
00092 FrequencySelection (Int referenceFrame)
00093 : filterWindowId_p (-1),
00094 referenceFrame_p (referenceFrame) {}
00095 Int filterWindow() const;
00096
00097 private:
00098
00099 Vector <Vector <Slice> > correlationSlices_p;
00100 mutable Int filterWindowId_p;
00101 Int referenceFrame_p;
00102 };
00103
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 class FrequencySelectionUsingChannels : public FrequencySelection {
00115
00116 public:
00117
00118 class Element {
00119 public:
00120
00121 Element (Int spectralWindow = -1, Int firstChannel = -1, Int nChannels = -1, Int increment = 1)
00122 : firstChannel_p (firstChannel),
00123 increment_p (increment),
00124 nChannels_p (nChannels),
00125 spectralWindow_p (spectralWindow)
00126 {}
00127
00128 Slice getSlice () const { return Slice (firstChannel_p, nChannels_p, increment_p);}
00129
00130 Int firstChannel_p;
00131 Int increment_p;
00132 Int nChannels_p;
00133 Int spectralWindow_p;
00134 };
00135
00136 typedef std::vector<Element> Elements;
00137 typedef Elements::const_iterator const_iterator;
00138
00139 FrequencySelectionUsingChannels () : FrequencySelection (ByChannel) {}
00140
00141 void add (Int spectralWindow, Int firstChannel, Int nChannels, Int increment = 1);
00142 void add (const MSSelection & msSelection, const MeasurementSet * ms);
00143 const_iterator begin () const;
00144 FrequencySelection * clone () const;
00145 Bool empty () const;
00146 const_iterator end () const;
00147 Int getNChannels (Int spectralWindowId) const;
00148 set<int> getSelectedWindows () const;
00149 size_t size () const;
00150 String toString () const;
00151
00152
00153
00154
00155
00156 private:
00157
00158 Elements elements_p;
00159 mutable Elements filtered_p;
00160
00161 };
00162
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 class FrequencySelectionUsingFrame : public FrequencySelection {
00175
00176 public:
00177
00178 class Element {
00179 public:
00180
00181 Element (Int spectralWindow = -1, Double beginFrequency = 0,
00182 Double endFrequency = 0, Double increment = 0)
00183 : beginFrequency_p (beginFrequency),
00184 endFrequency_p (endFrequency),
00185 increment_p (increment),
00186 spectralWindow_p (spectralWindow)
00187 {}
00188
00189 Double getBeginFrequency () const;
00190 Double getEndFrequency () const;
00191
00192 private:
00193
00194 friend class FrequencySelectionUsingFrame;
00195
00196 Double beginFrequency_p;
00197 Double endFrequency_p;
00198 Double increment_p;
00199 Int spectralWindow_p;
00200 };
00201
00202 typedef std::vector<Element> Elements;
00203 typedef Elements::const_iterator const_iterator;
00204
00205 FrequencySelectionUsingFrame (MFrequency::Types frameOfReference);
00206
00207 void add (Int spectralWindow, Double bottomFrequency, Double topFrequency);
00208
00209 const_iterator begin () const;
00210 FrequencySelection * clone () const;
00211 Bool empty () const;
00212 const_iterator end () const;
00213 set<int> getSelectedWindows () const;
00214 String toString () const;
00215
00216 private:
00217
00218 Elements elements_p;
00219 mutable Elements filtered_p;
00220 };
00221
00222
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 class FrequencySelections {
00235 public:
00236
00237
00238 FrequencySelections ();
00239 FrequencySelections (const FrequencySelections & other);
00240 ~FrequencySelections ();
00241
00242 void add (const FrequencySelection & selection);
00243 FrequencySelections * clone () const;
00244 void filterToSpectralWindow (Int spectralWindowId);
00245 const FrequencySelection & get (Int msIndex) const;
00246 Int getFrameOfReference () const;
00247 Bool isSpectralWindowSelected (Int msIndex, Int spectralWindowId) const;
00248 Int size () const;
00249
00250
00251
00252
00253
00254
00255 private:
00256
00257 typedef std::set<pair<Int, Int> > SelectedWindows;
00258
00259 const FrequencySelectionUsingChannels defaultSelection_p;
00260 mutable Int filterWindow_p;
00261 SelectedWindows selectedWindows_p;
00262
00263 typedef std::vector<FrequencySelection *> Selections;
00264 Selections selections_p;
00265 };
00266
00267
00268
00269 }
00270
00271 }
00272
00273 #endif // ! defined (MSVIS_ViFrequencySelection_H_121116_1101)
00274