SpecFitSettingsWidgetRadio.qo.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 #ifndef SPECFITSETTINGSWIDGETRADIO_QO_H
00026 #define SPECFITSETTINGSWIDGETRADIO_QO_H
00027 
00028 #include <QtGui/QWidget>
00029 #include <QProgressDialog>
00030 #include <display/QtPlotter/SpecFitSettingsWidgetRadio.ui.h>
00031 #include <display/QtPlotter/ProfileTaskFacilitator.h>
00032 #include <display/QtPlotter/GaussianEstimateDialog.qo.h>
00033 #include <casa/Containers/Record.h>
00034 #include <display/Display/DisplayCoordinateSystem.h>
00035 
00036 namespace casa {
00037 
00038         class ImageProfileFitter;
00039         class SpectralList;
00040         class SpectralElement;
00041         class SpecFit;
00042         class SpecFitThread;
00043 
00044         class SpecFitSettingsWidgetRadio : public QWidget, public ProfileTaskFacilitator {
00045                 Q_OBJECT
00046 
00047         public:
00048                 SpecFitSettingsWidgetRadio(QWidget *parent = 0);
00049                 ~SpecFitSettingsWidgetRadio();
00050                 void setUnits( QString units );
00051                 void setDisplayYUnits( const QString& units );
00052                 void setImageYUnits( const QString& units );
00053                 void setCurveName( const QString& curveName );
00054                 void addCurveName( const QString& curveName );
00055                 void setRange(double start, double end );
00056                 void reset();
00057                 void pixelsChanged( int pixX, int pixY );
00058 
00059         signals:
00060                 void gaussEstimateCountChanged( int count );
00061 
00062         private slots:
00063                 void polyFitChanged( int state );
00064                 void gaussCountChanged( int count );
00065                 void fitRatioChanged( int count );
00066                 void clean();
00067                 void specLineFit();
00068                 void setOutputLogFile();
00069                 void viewOutputLogFile();
00070                 void saveOutputChanged( int state );
00071                 void specFitEstimateSpecified(double xValue,double yValue, bool centerPeak);
00072                 void fitDone( bool newData = true );
00073                 void cancelFit();
00074                 void specifyGaussianEstimates();
00075                 void gaussianEstimatesChanged();
00076 
00077         private:
00078 
00079                 bool _constructFitter( SHARED_PTR<const ImageInterface<float> >& image,
00080                                         const String& region, const Record* const &regionPtr, const String& box,
00081                                         const String& chans, const String& stokes, const String& mask, const Int axis,
00082                                         const uInt ngauss, const SpectralList& spectralList );
00087                 void setEstimateValue( int row, int col, double val );
00088                 bool isValidEstimate( QString& peakStr, QString& centerStr,
00089                                       QString& fwhmStr, QString& fixedStr, int rowIndex );
00090                 SpectralList buildSpectralList( int nGauss, Bool& validList );
00091                 bool isValidFitSpecification( int gaussCount, bool polyFit );
00092                 void setCanvas( QtCanvas* canvas );
00093                 void doFit( float startVal, float endVal, uint gaussCount, bool fitPoly, int polyN );
00094                 String getChannels( float startVal, float endVal, const Vector<Float>& specValues ) const;
00095                 void getFitBounds( Float& startVal, Float& endVal ) const;
00096                 int getFitCount(Int& startChannelIndex, Int& endChannelIndex );
00097                 void setFitEstimate( int row, double xValue, double yValue, bool centerPeak );
00098                 void clearEstimates();
00099                 void clear();
00100                 void emptyCurveList();
00101                 void resolveOutputLogFile( );
00105                 void getConversion( const String& unitStr, Bool& velocity, Bool& wavelength ) const ;
00106                 bool processFitResults(Vector<float>& xValues, Vector<float>& xValuesPix, const String& yUnit);
00107                 void getEstimateStrings( int index, QString& peakStr, QString& centerStr, QString& fwhmStr ) const;
00108                 bool processFitResultGaussian( const SpectralElement* solution,
00109                                                int index, QList<SpecFit*>& curves, const String& yUnit);
00110                 bool processFitResultPolynomial( const SpectralElement* solution,
00111                                                  QList<SpecFit*>& curves);
00112                 bool isInRange( double xValue ) const;
00113                 QString settingsToString() const;
00114                 double toPixels( double val, String units, SpectralCoordinate& coord ) const;
00115                 void drawCurves( int pixelX, int pixelY );
00116 
00117                 enum TableHeaders {PEAK,CENTER,FWHM,FIXED,END_COLUMN};
00118                 Ui::SpecFitSettingsWidgetRadio ui;
00119                 ImageProfileFitter* fitter;
00120                 SpecFitThread* specFitThread;
00121                 QProgressDialog progressDialog;
00122                 GaussianEstimateDialog gaussEstimateDialog;
00123                 Record regionRecord;
00124 
00125 
00126                 QString outputLogPath;
00127                 QString displayYUnits;
00128                 QString imageYUnits;
00129                 QList<QList<SpecFit*> > curveList;
00130                 int SUM_FIT_INDEX;
00131                 bool viewerSettingsWritten;
00132                 volatile bool fitCancelled;
00133         };
00134 }
00135 #endif // SPECFITSETTINGSWIDGETRADIO_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1