casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Fit2DTool.qo.h
Go to the documentation of this file.
00001 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000
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 FIT2DTOOL_QO_H
00026 #define FIT2DTOOL_QO_H
00027 
00028 #include <QtGui/QDialog>
00029 #include <QProgressDialog>
00030 #include <QFileDialog>
00031 #include <casa/aipstype.h>
00032 #include <display/Fit/Fit2DTool.ui.h>
00033 #include <display/Fit/FindSourcesDialog.qo.h>
00034 #include <display/Fit/PixelRangeDialog.qo.h>
00035 #include <display/Fit/ResidualHistogramDialog.qo.h>
00036 #include <display/Fit/Fit2DLogDialog.qo.h>
00037 #include <display/region/QtRegionSource.qo.h>
00038 
00039 namespace casa {
00040 
00041 template <class T> class ImageInterface;
00042 class Gaussian2DFitter;
00043 class ColorComboDelegate;
00044 class RegionShape;
00045 
00046 class Fit2DTool : public QDialog {
00047     Q_OBJECT
00048 
00049 public:
00050     Fit2DTool(QWidget *parent = 0);
00051     void setImage( ImageInterface<Float>* image );
00052     ~Fit2DTool();
00053 
00054 signals:
00055         void showOverlay(String, const QString&);
00056         void removeOverlay(String);
00057         void remove2DFitOverlay( QList<RegionShape*> fitMarkers );
00058         void add2DFitOverlay( QList<RegionShape*> fitMarkers );
00059         void addResidualFitImage( String );
00060 
00061 public slots:
00062         void frameChanged( int frame );
00063         void newRegion( int, const QString &shape, const QString &name,
00064                 const QList<double> &world_x, const QList<double> &world_y,
00065                 const QList<int> &pixel_x, const QList<int> &pixel_y,
00066                 const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
00067         void updateRegion( int, viewer::region::RegionChanges,
00068                 const QList<double> &world_x, const QList<double> &world_y,
00069                 const QList<int> &pixel_x, const QList<int> &pixel_y );
00070 
00071 private slots:
00072         void showFileDialog();
00073         void showFindSourcesDialog();
00074         void showPixelRangeDialog();
00075         void estimateFileChanged( const QString& fullPath );
00076         void pixelRangeChanged();
00077         void pixelRangeEnabledChanged( bool enabled );
00078         void pixelRangeNoneSelected( bool selected );
00079         void doFit();
00080         void fitColorChanged( const QString& colorName);
00081         void fitDone();
00082         void clearFitMarkers();
00083         void showResults();
00084         void showSaveDialog();
00085         void showResidualHistogramDialog();
00086         void residualSupportChanged( bool enable );
00087         void showResidualDialog();
00088         void displayFitChanged( bool display );
00089 
00090 private:
00091         Fit2DTool( const Fit2DTool& fitTool );
00092         Fit2DTool operator=( const Fit2DTool& fitTool );
00093         Vector<Float> populateInclude() const;
00094         Vector<Float> populateExclude() const;
00095         void populateIncludeExclude(Vector<Float>& range ) const;
00096 
00097         void setImageFunctionalityEnabled( bool enable );
00098         void resetRegion( const QList<int>& pixelX, const QList<int>& pixelY );
00099         bool populateSaveFile( String& saveFile );
00100         bool populateResidualFile( String& saveFile );
00101         void showFileChooserDialog(const QString& title, QFileDialog::FileMode mode, QLineEdit* destinationLineEdit );
00102         bool validateFile( QLineEdit* directoryLineEdit, QLineEdit* fileLineEdit,
00103                         String& saveFile, const QString& purpose );
00104         void addViewerFitMarkers();
00105         void removeViewerFitMarkers();
00106         void clearRegions();
00107 
00108         const QString REGION_LABEL;
00109         ImageInterface<Float>* image;
00110         QList<RegionShape*> fitMarkers;
00111         Gaussian2DFitter* fitter;
00112         ColorComboDelegate* fitColorDelegate;
00113         QProgressDialog progressBar;
00114     FindSourcesDialog findSourcesDialog;
00115     PixelRangeDialog pixelRangeDialog;
00116     Fit2DLogDialog logDialog;
00117     ResidualHistogramDialog residualHistogramDialog;
00118     String residualImagePath;
00119 
00120     Ui::Fit2DToolClass ui;
00121 };
00122 }
00123 #endif // FIT2DTOOL_QO_H