casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpectralCollapser.h
Go to the documentation of this file.
1 //# SpectralCollapser.h: Header file for class SpectralCollapser
2 //# Copyright (C) 1998,1999,2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This program is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU General Public License as published by the Free
7 //# Software Foundation; either version 2 of the License, or (at your option)
8 //# any later version.
9 //#
10 //# This program is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 //# more details.
14 //#
15 //# You should have received a copy of the GNU General Public License along
16 //# with this program; if not, write to the Free Software Foundation, Inc.,
17 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $
27 
28 #ifndef IMAGEANALYSIS_SPECTRALCOLLAPSER_H
29 #define IMAGEANALYSIS_SPECTRALCOLLAPSER_H
30 
32 
33 #include <casa/namespace.h>
34 
35 namespace casacore{
36 
37 template <class T> class SubImage;
38 }
39 
40 namespace casa {
41 
42 
44  // <summary>
45  // Class to collapse an image along the spectral axis.
46  // </summary>
47 
48  // <reviewed reviewer="" date="" tests="" demos="">
49  // </reviewed>
50 
51  // <prerequisite>
52  // <li> <linkto class=ImageCollapser>ImageCollapser</linkto>
53  // </prerequisite>
54 
55  // <etymology>
56  // Collapses an image along the spectral axis
57  // </etymology>
58 
59  // <synopsis>
60  // Helper class to collapse an image along the spectral axis. The spectral
61  // range to combine is provided interactively from the profiler. The class
62  // transforms the range to the channels to be combined. The actual image\
63  // combination is then done with the class "ImageCollapser".
64  // </synopsis>
65 
66 public:
67  // The different collapse types
68  enum CollapseType {
73  //PVRMSE,
74  };
75 
81  };
82 
83  // Constructor
84  SpectralCollapser(const SPCIIF image);
85 
86  // Constructor
87  SpectralCollapser(const SPCIIF image, const casacore::String storePath);
88 
89  // Destructor
90  virtual ~SpectralCollapser();
91 
92  // Parameters:
93  // <src>specVals</src> - the vector of spectral values
94  // <src>startVal</src> - the spectral value to start the collapse
95  // <src>endVal</src> - the spectral value to end the collapse
96  // <src>unit</src> - the unit of the spectral values
97  // <src>collType</src> - the collapse type (e.g. "mean" or "median")
98  // <src>collError</src> - information on what the error
99  // <src>outname</src> - name of the collapsed image (output)
100  // <src>msg</src> - message string (output)
101  virtual casacore::Bool collapse(const casacore::Vector<casacore::Float> &specVals, const casacore::Float startVal, const casacore::Float endVal,
102  const casacore::String &unit, const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError, casacore::String &outname, casacore::String &msg);
103 
105 
107 
108  // Convert from string to collapse type
109  static void stringToCollapseType(const casacore::String &text, SpectralCollapser::CollapseType &collType);
110 
111  // Convert from string to error type
112  static void stringToCollapseError(const casacore::String &text, SpectralCollapser::CollapseError &collError);
113 
114  // Convert from collapse type to string
115  static void collapseTypeToString(const SpectralCollapser::CollapseType &collType, casacore::String &strCollType);
116 
117  // Convert from error type to string
118  static void collapseErrorToString(const SpectralCollapser::CollapseError &collError, casacore::String &strCollError);
119 
120 private:
123 
125  casacore::String _all; // = CasacRegionManager::ALL;
128 
129  // Disallow default constructor
131 
132  void _setUp();
133  casacore::Bool _cleanTmpData(const casacore::String &tmpFileName) const;
134  casacore::Bool _cleanTmpData(const casacore::String &tmpData, const casacore::String &tmpError) const;
136  casacore::Bool _getQualitySubImgs(SPCIIF image, std::shared_ptr<casacore::SubImage<casacore::Float> > &subData, std::shared_ptr<casacore::SubImage<casacore::Float> > &subError) const;
137  casacore::Bool _getOutputName(const casacore::String &wcsInp, casacore::String &outImg, casacore::String &outImgData, casacore::String &outImgError) const;
138  casacore::Bool _collapse(const SPCIIF image, const casacore::String &aggString,
139  const casacore::String& chanInp, const casacore::String& outname) const;
141  const casacore::Int & startIndex, const casacore::Int &endIndex, const casacore::String& outname);
142  casacore::Bool _mergeDataError(const casacore::String &outImg, const casacore::String &dataImg, const casacore::String &errorImg, const casacore::Float &normError=1.0) const;
143  void _addMiscInfo(const casacore::String &outName, const casacore::String &wcsInput, const casacore::String &chanInput,
144  const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError) const;
145  void _collTypeToImCollString(const SpectralCollapser::CollapseType &collType, casacore::String &colType) const;
146  void _collErrorToImCollString(const SpectralCollapser::CollapseError &collError, casacore::String &colError) const ;
147 
148 };
149 }
150 
151 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
int Int
Definition: aipstype.h:50
casacore::Bool _getQualitySubImg(const casacore::ImageInterface< casacore::Float > *image, const casacore::Bool &data, casacore::SubImage< casacore::Float > &qualitySub)
casacore::Bool _collapse(const SPCIIF image, const casacore::String &aggString, const casacore::String &chanInp, const casacore::String &outname) const
casacore::Bool _getOutputName(const casacore::String &wcsInp, casacore::String &outImg, casacore::String &outImgData, casacore::String &outImgError) const
static void stringToCollapseType(const casacore::String &text, SpectralCollapser::CollapseType &collType)
Convert from string to collapse type.
void _collErrorToImCollString(const SpectralCollapser::CollapseError &collError, casacore::String &colError) const
casacore::Bool _moments(const casacore::ImageInterface< casacore::Float > *image, const casacore::Vector< casacore::Int > &momentVec, const casacore::Int &startIndex, const casacore::Int &endIndex, const casacore::String &outname)
casacore::Bool _mergeDataError(const casacore::String &outImg, const casacore::String &dataImg, const casacore::String &errorImg, const casacore::Float &normError=1.0) const
ostream-like interface to creating log messages.
Definition: LogIO.h:167
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
CollapseType
Class to collapse an image along the spectral axis.
virtual casacore::Bool collapse(const casacore::Vector< casacore::Float > &specVals, const casacore::Float startVal, const casacore::Float endVal, const casacore::String &unit, const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError, casacore::String &outname, casacore::String &msg)
Parameters: specVals - the vector of spectral values startVal - the spectral value to start the colla...
static void collapseErrorToString(const SpectralCollapser::CollapseError &collError, casacore::String &strCollError)
Convert from error type to string.
virtual ~SpectralCollapser()
Destructor.
void _addMiscInfo(const casacore::String &outName, const casacore::String &wcsInput, const casacore::String &chanInput, const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError) const
static void collapseTypeToString(const SpectralCollapser::CollapseType &collType, casacore::String &strCollType)
Convert from collapse type to string.
casacore::String summaryHeader() const
void _collTypeToImCollString(const SpectralCollapser::CollapseType &collType, casacore::String &colType) const
static void stringToCollapseError(const casacore::String &text, SpectralCollapser::CollapseError &collError)
Convert from string to error type.
SpectralCollapser()
Disallow default constructor.
std::shared_ptr< const casacore::ImageInterface< casacore::Float > > SPCIIF
Definition: ImageTypedefs.h:50
void collapseTypeToVector(const SpectralCollapser::CollapseType &collType, casacore::Vector< casacore::Int > &momentVec)
casacore::Bool _getQualitySubImgs(SPCIIF image, std::shared_ptr< casacore::SubImage< casacore::Float > > &subData, std::shared_ptr< casacore::SubImage< casacore::Float > > &subError) const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
A (masked) subset of an ImageInterface object.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool _cleanTmpData(const casacore::String &tmpFileName) const
casacore::String _storePath
casacore::IPosition _specAxis
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42