casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MomentSettingsWidgetRadio.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library 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 Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 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 #ifndef MOMENTSETTINGSWIDGETRADIO_QO_H
26 #define MOMENTSETTINGSWIDGETRADIO_QO_H
27 
28 #include <QWidget>
29 #include <QMap>
30 #include <QThread>
31 #include <QProgressDialog>
32 #include <casa/Quanta/Quantum.h>
35 #include <display/QtPlotter/MomentSettingsWidgetRadio.ui.h>
37 
38 namespace casacore{
39 
40  template <class T> class ImageInterface;
41 }
42 
43 namespace casa {
44 
45  class MomentCollapseThreadRadio;
46  class ThresholdingBinPlotDialog;
47  class Converter;
48  template <class T> class ImageMoments;
49 
51 
52  public:
53  CollapseResult( const casacore::String& outputName, bool tmp, std::shared_ptr<casacore::ImageInterface<float>> img );
54 
56  return outputFileName;
57  }
58  bool isTemporaryOutput() const {
59  return temporary;
60  }
61  std::shared_ptr<casacore::ImageInterface<float> > getImage() const {
62  return image;
63  }
64 
65  private:
67  bool temporary;
68 
69  std::shared_ptr<casacore::ImageInterface<float> > image;
70  };
71 
72 
73 //Note: ImageMomentsProgressMonitor is an interface that provides this class
74 //with updates concerning the progress of the moment calculation task.
75 
80  class MomentCollapseThreadRadio : public QThread, public ImageMomentsProgressMonitor {
81  Q_OBJECT
82  public:
84  bool isSuccess() const;
85  void setChannelStr( casacore::String str );
87  void setOutputFileName( QString name );
89  std::vector<CollapseResult> getResults() const;
90  void setData(const casacore::Vector<int>& moments, const int axis,
97  const double peaksnr, const double stddev,
98  const casacore::String& doppler = "RADIO", const casacore::String& baseName = "");
99  void run();
100  void halt();
101  //Methods from the ImageMomentsProgressMonitor interface
102  void setStepCount( int count );
103  void setStepsCompleted( int count );
104  void done();
106 
107  signals:
108  void stepCountChanged( int count );
109  void stepsCompletedChanged( int count );
110 
111  private:
112  bool getOutputFileName( casacore::String& outName, int moment, const casacore::String& channelStr ) const;
113 
117  int axis;
125  double peaksnr;
126  double stddev;
129  QString outputFileName;
130  int stepSize;
131  std::vector<CollapseResult> collapseResults;
135  };
136 
137 //Note: ProfileTaskFacilitator abstracts out some of the common functionality
138 //needed for calculating moments and spectral line fitting into a single
139 //base class
140 
141 
142  class MomentSettingsWidgetRadio : public QWidget, public ProfileTaskFacilitator {
143  Q_OBJECT
144 
145  public:
146  MomentSettingsWidgetRadio(QWidget *parent = 0);
147 
148  void setUnits( QString units );
149  void setRange( double min, double max );
150  void reset();
152 
153  signals:
154  void updateProgress(int);
155  void momentsFinished();
156 
157  private slots:
158  void setStepCount( int count );
159  void setStepsCompleted( int count );
160  void thresholdingChanged();
161  void thresholdSpecified();
162  void adjustTableRows( int count );
163  void collapseImage();
164  void setCollapsedImageFile();
165  void collapseDone();
166  void graphicalThreshold();
167  void symmetricThresholdChanged( int checkedState );
168  void thresholdTextChanged( const QString& text );
169  void stopMoments();
170 
171  private:
172  void _initAnalysis();
177  };
178  QMap<SummationIndex, int> momentMap;
179  Ui::MomentSettingsWidgetRadio ui;
183  QString outputFileName;
184  QList<QString> momentOptions;
185  QProgressDialog progressBar;
186  QString m_units;
187 
188  //Progress Monitor functionality
193 
194  void setTableValue(int row, int col, float val );
195  void getChannelMinMax( int channelIndex, QString& minStr, QString& maxStr ) const;
196  void convertChannelRanges( const QString& oldUnits, const QString& newUnits );
197  void convertChannelValue( const QString& channelStr, const QString& channelIdentifier,
198  Converter* converter, int row, int col, bool toPixels,
200  casacore::String makeChannelInterval( float startChannelIndex,float endChannelIndex ) const;
203  casacore::String populateChannels(casacore::uInt * nSelectedChannels, bool * channelOK);
204  bool populateThresholds( casacore::Vector<float>& includeThreshold, casacore::Vector<float>& excludeThreshold );
205  bool populateThreshold( casacore::Vector<float>& threshold );
206  };
207 
208 }
209 
210 #endif // MOMENTSETTINGSWIDGETRADIO_QO_H
void stepsCompletedChanged(int count)
void setRange(double min, double max)
void setUnits(QString units)
int momentCount
Progress Monitor functionality.
casacore::Vector< casacore::String > method
void convertChannelValue(const QString &channelStr, const QString &channelIdentifier, Converter *converter, int row, int col, bool toPixels, casacore::SpectralCoordinate &coord)
MomentSettingsWidgetRadio(QWidget *parent=0)
#define max(a, b)
Definition: hio.h:44
#define min(a, b)
Definition: hio.h:45
void thresholdTextChanged(const QString &text)
casacore::String getOutputFileName() const
Note: ProfileTaskFacilitator abstracts out some of the common functionality needed for calculating mo...
This class generates moments from an image.
casacore::Vector< casacore::String > smoothtypes
void setTableValue(int row, int col, float val)
casacore::Record _makeRegionRecord()
void setChannelStr(casacore::String str)
bool getOutputFileName(casacore::String &outName, int moment, const casacore::String &channelStr) const
void symmetricThresholdChanged(int checkedState)
std::shared_ptr< casacore::ImageInterface< float > > image
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
CollapseResult(const casacore::String &outputName, bool tmp, std::shared_ptr< casacore::ImageInterface< float >> img)
casacore::Vector< int > populateMoments(casacore::Vector< QString > &momentNames)
void setMomentNames(const casacore::Vector< QString > &momentNames)
casacore::String makeChannelInterval(float startChannelIndex, float endChannelIndex) const
std::vector< CollapseResult > getResults() const
Note: ImageMomentsProgressMonitor is an interface that provides this class with updates concerning th...
This is just an interface class for monitoring the progress of collapsing and image through calculati...
void setStepCount(int count)
Methods from the ImageMomentsProgressMonitor interface.
std::shared_ptr< casacore::ImageInterface< float > > getImage() const
MomentCollapseThreadRadio * collapseThread
std::vector< CollapseResult > collapseResults
A hierarchical collection of named fields of various types.
Definition: Record.h:180
void setOutputFileName(QString name)
bool populateThreshold(casacore::Vector< float > &threshold)
Interconvert pixel and frequency values.
This dialog displays a histogram that allows the user to set a minimum/maximum moment collapse thresh...
void getChannelMinMax(int channelIndex, QString &minStr, QString &maxStr) const
casacore::String populateChannels(casacore::uInt *nSelectedChannels, bool *channelOK)
casacore::Vector< casacore::String > populateMethod() const
String: the storage and methods of handling collections of characters.
Definition: String.h:223
MomentCollapseThreadRadio(ImageMoments< float > *imageAnalysis)
void setData(const casacore::Vector< int > &moments, const int axis, const casacore::Vector< casacore::String > &method, const casacore::Vector< int > &smoothaxes, const casacore::Vector< casacore::String > &smoothtypes, const casacore::Vector< casacore::Quantity > &smoothwidths, const casacore::Vector< float > &includepix, const casacore::Vector< float > &excludepix, const double peaksnr, const double stddev, const casacore::String &doppler="RADIO", const casacore::String &baseName="")
bool populateThresholds(casacore::Vector< float > &includeThreshold, casacore::Vector< float > &excludeThreshold)
casacore::Vector< casacore::Quantity > smoothwidths
casacore::String getErrorMessage() const
unsigned int uInt
Definition: aipstype.h:51
ThresholdingBinPlotDialog * thresholdingBinDialog
void convertChannelRanges(const QString &oldUnits, const QString &newUnits)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42