kstars
fitsviewer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FITSViewer_H
00021 #define FITSViewer_H
00022
00023 #include <qwidget.h>
00024 #include <qstring.h>
00025 #include <qimage.h>
00026 #include <qpixmap.h>
00027 #include <qframe.h>
00028 #include <qrect.h>
00029 #include <qptrlist.h>
00030 #include <qstringlist.h>
00031 #include <qscrollview.h>
00032
00033 #include <kpixmapio.h>
00034 #include <kpixmap.h>
00035 #include <kdialog.h>
00036 #include <kmainwindow.h>
00037 #include <kurl.h>
00038 #include <kcommand.h>
00039
00040 #include "indi/fitsrw.h"
00041
00042 class KCommandHistory;
00043 class ContrastBrightnessDlg;
00044 class QScrollView;
00045 class FITSImage;
00046 class FITSHistogram;
00047
00048 class FITSViewer : public KMainWindow {
00049 Q_OBJECT
00050
00051 public:
00052
00053 friend class ContrastBrightnessDlg;
00054 friend class FITSChangeCommand;
00055 friend class FITSProcess;
00056 friend class FITSImage;
00057 friend class FITSHistogram;
00058 friend class FITSHistogramCommand;
00059 friend class FITSProcessCommand;
00060
00062 FITSViewer (const KURL *imageName, QWidget *parent, const char *name = 0);
00063 ~FITSViewer();
00064
00065
00066
00067 enum undoTypes { CONTRAST_BRIGHTNESS, IMAGE_REDUCTION, IMAGE_FILTER };
00068
00069 protected:
00070
00071 void keyPressEvent (QKeyEvent *ev);
00072
00073 void calculateStats();
00074 void closeEvent(QCloseEvent *ev);
00075
00076 public slots:
00077 void fitsChange();
00078
00079 private slots:
00080 void fileOpen();
00081 void fileSave();
00082 void fileSaveAs();
00083 void fitsCOPY();
00084 void fitsRestore();
00085 void fitsStatistics();
00086 void fitsHeader();
00087 void slotClose();
00088 void imageReduction();
00089 void imageHistogram();
00090 void BrightContrastDlg();
00091 void updateImgBuffer();
00092
00093 private:
00094
00095 float * loadData(const char * filename, float *buffer);
00096 bool initFITS();
00097 void show_fits_errors();
00098
00099 double average();
00100 double min(int & minIndex);
00101 double max(int & maxIndex);
00102 double stddev();
00103
00104 FITSImage *image;
00105 int Dirty;
00106 KURL currentURL;
00107 float *imgBuffer;
00108 KCommandHistory *history;
00109 QStringList record;
00110 FITSHistogram *histo;
00111
00112
00113 struct {
00114 double min, max;
00115 int minAt, maxAt;
00116 double average;
00117 double stddev;
00118 int bitpix, width, height;
00119 } stats;
00120
00121
00122 };
00123
00124 class FITSChangeCommand : public KCommand
00125 {
00126 public:
00127 FITSChangeCommand(QWidget * parent, int inType, QImage *newIMG, QImage *oldIMG);
00128 ~FITSChangeCommand();
00129
00130 void execute();
00131 void unexecute();
00132 QString name() const;
00133
00134 private:
00135 int type;
00136
00137 protected:
00138 FITSViewer *viewer;
00139 QImage *newImage;
00140 QImage *oldImage;
00141 };
00142
00143
00144 #endif