casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageInputProcessor.h
Go to the documentation of this file.
1 //# Copyright (C) 1998,1999,2000,2001,2003
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This program is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU General Public License as published by the Free
6 //# Software Foundation; either version 2 of the License, or (at your option)
7 //# any later version.
8 //#
9 //# This program is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 //# more details.
13 //#
14 //# You should have received a copy of the GNU General Public License along
15 //# with this program; if not, write to the Free Software Foundation, Inc.,
16 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef IMAGES_IMAGEINPUTPROCESSOR_H
27 #define IMAGES_IMAGEINPUTPROCESSOR_H
28 
30 
34 
35 #include <casa/namespace.h>
36 
37 namespace casa {
38 
40  // <summary>
41  // Collection of methods for processing inputs to image analysis applications
42  // </summary>
43 
44  // <reviewed reviewer="" date="" tests="" demos="">
45  // </reviewed>
46 
47  // <prerequisite>
48  // </prerequisite>
49 
50  // <etymology>
51  // Processes inputs to image analysis apps.
52  // </etymology>
53 
54  // <synopsis>
55  // Collection of methods for processing inputs to image analysis applications
56  // </synopsis>
57 
58 public:
59 
60  //constructor
62 
63  //Destructor
65 
66  // Process the inputs. Output parameters are the pointer to the
67  // opened <src>image</src>, the specified region as a record (<src>
68  // regionRecord</src>, and a <src>diagnostics</src> casacore::String describing
69  // how the region was chosen. If provided, <src>regionPtr</src> should
70  // be a pointer to a record created by a casacore::RegionManager method.
71  // <src>stokesControl</src> indicates default
72  // stokes range to use if <src>stokes</src> is blank. In this case <src>stokes</src>
73  // will be set the the value of stokes that will be used. If
74  // <src>allowMultipleBoxes</src> is false, an exception will be thrown if
75  // the inputs specify multiple n-dimensional rectangles. This should usually
76  // be set to false if the caller can only deal with a single n-dimensional
77  // rectangular region.
78  /*
79  template<class T> void process(
80  SPIIT image, casacore::Record& regionRecord,
81  casacore::String& diagnostics,
82  std::vector<OutputDestinationChecker::OutputStruct> *const outputStruct,
83  casacore::String& stokes, const casacore::String& imagename,
84  const casacore::Record* regionPtr, const casacore::String& regionName,
85  const casacore::String& box, const casacore::String& chans,
86  const CasacRegionManager::StokesControl& stokesControl,
87  const casacore::Bool& allowMultipleBoxes,
88  const std::vector<casacore::Coordinate::Type> *const &requiredCoordinateTypes,
89  casacore::Bool verbose=true
90  );
91 */
92  // Process the inputs. Use this version if the associated image already exists.
93  // Output parameters the specified region as a record (<src>
94  // regionRecord</src>, and a <src>diagnostics</src> casacore::String describing
95  // how the region was chosen. If provided, <src>regionPtr</src> should
96  // be a pointer to a record created by a casacore::RegionManager method.
97  // <src>stokesControl</src> indicates default
98  // stokes range to use if <src>stokes</src> is blank. In this case <src>stokes</src>
99  // will be set the the value of stokes that will be used. If
100  // <src>allowMultipleBoxes</src> is false, an exception will be thrown if
101  // the inputs specify multiple n-dimensional rectangles. This should usually
102  // be set to false if the caller can only deal with a single n-dimensional
103  // rectangular region.
104  template<class T> void process(
105  casacore::Record& regionRecord,
106  casacore::String& diagnostics,
107  std::vector<OutputDestinationChecker::OutputStruct> *const outputStruct,
108  casacore::String& stokes,
109  SPCIIT image,
110  const casacore::Record* regionPtr,
111  const casacore::String& regionName, const casacore::String& box,
112  const casacore::String& chans,
113  const CasacRegionManager::StokesControl& stokesControl,
114  const casacore::Bool& allowMultipleBoxes,
115  const std::vector<casacore::Coordinate::Type> *const &requiredCoordinateTypes,
116  casacore::Bool verbose=true
117  );
118 
119  // Get the number of channels that have been selected. The process() method must
120  // be called prior to calling this method or an exception is thrown.
122 
123 private:
127 
128  template<class T> void _process(
129  casacore::Record& regionRecord, casacore::String& diagnostics,
130  std::vector<OutputDestinationChecker::OutputStruct>* outputStruct,
131  casacore::String& stokes, SPCIIT image,
132  const casacore::Record *const &regionPtr,
133  const casacore::String& regionName, const casacore::String& box,
134  const casacore::String& chans, const CasacRegionManager::StokesControl& stokesControl,
135  const casacore::Bool& allowMultipleBoxes,
136  const std::vector<casacore::Coordinate::Type> *const &requiredCoordinateTypes, casacore::Bool verbose
137  );
138 
139  // set region given a pointer to a region record.
140  void _setRegion(
141  casacore::Record& regionRecord, casacore::String& diagnostics,
142  const casacore::Record *const regionPtr
143  ) const;
144 
145  template<class T> void _setRegion(casacore::Record& regionRecord, casacore::String& diagnostics,
146  const casacore::ImageInterface<T> *const image, const casacore::String& regionName
147  ) const;
148 
150  const casacore::Record& region, const casacore::CoordinateSystem& csys
151  ) const;
152 
153  casacore::String _pairsToString(const std::vector<casacore::uInt>& pairs) const;
154 
155 };
156 }
157 
158 #ifndef AIPS_NO_TEMPLATE_SRC
159 #include <imageanalysis/ImageAnalysis/ImageInputProcessor2.tcc>
160 #endif
161 
162 #endif /* IMAGES_IMAGEINPUTPROCESSOR_H */
casacore::uInt nSelectedChannels() const
Get the number of channels that have been selected.
void process(casacore::Record &regionRecord, casacore::String &diagnostics, std::vector< OutputDestinationChecker::OutputStruct > *const outputStruct, casacore::String &stokes, SPCIIT image, const casacore::Record *regionPtr, const casacore::String &regionName, const casacore::String &box, const casacore::String &chans, const CasacRegionManager::StokesControl &stokesControl, const casacore::Bool &allowMultipleBoxes, const std::vector< casacore::Coordinate::Type > *const &requiredCoordinateTypes, casacore::Bool verbose=true)
Process the inputs.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
casacore::String _stokesFromRecord(const casacore::Record &region, const casacore::CoordinateSystem &csys) const
~ImageInputProcessor()
Destructor.
casacore::String _pairsToString(const std::vector< casacore::uInt > &pairs) const
A base class for astronomical images.
void _setRegion(casacore::Record &regionRecord, casacore::String &diagnostics, const casacore::Record *const regionPtr) const
set region given a pointer to a region record.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
#define SPCIIT
Definition: ImageTypedefs.h:35
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ImageInputProcessor()
Collection of methods for processing inputs to image analysis applications.
void _process(casacore::Record &regionRecord, casacore::String &diagnostics, std::vector< OutputDestinationChecker::OutputStruct > *outputStruct, casacore::String &stokes, SPCIIT image, const casacore::Record *const &regionPtr, const casacore::String &regionName, const casacore::String &box, const casacore::String &chans, const CasacRegionManager::StokesControl &stokesControl, const casacore::Bool &allowMultipleBoxes, const std::vector< casacore::Coordinate::Type > *const &requiredCoordinateTypes, casacore::Bool verbose)
Interconvert pixel and world coordinates.
unsigned int uInt
Definition: aipstype.h:51