• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • fitsviewer
fitsimage.h
Go to the documentation of this file.
1 /***************************************************************************
2  fitsimage.cpp - FITS Image
3  -------------------
4  begin : Tue Feb 24 2004
5  copyright : (C) 2004 by Jasem Mutlaq
6  email : mutlaqja@ikarustech.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  * Some code fragments were adapted from Peter Kirchgessner's FITS plugin*
17  * See http://members.aol.com/pkirchg for more details. *
18  ***************************************************************************/
19 
20 #ifndef FITSIMAGE_H_
21 #define FITSIMAGE_H_
22 
23 #include <QFrame>
24 #include <QImage>
25 #include <QPixmap>
26 #include <QMouseEvent>
27 #include <QResizeEvent>
28 #include <QPaintEvent>
29 #include <QScrollArea>
30 #include <QLabel>
31 
32 #include <kxmlguiwindow.h>
33 #include <kurl.h>
34 
35 #ifdef WIN32
36 // avoid compiler warning when windows.h is included after fitsio.h
37 #include <windows.h>
38 #endif
39 
40 #include <fitsio.h>
41 #include "fitshistogram.h"
42 #include "fitscommon.h"
43 
44 #include "skypoint.h"
45 #include "dms.h"
46 
47 #define INITIAL_W 640
48 #define INITIAL_H 480
49 
50 #define MINIMUM_PIXEL_RANGE 5
51 #define MINIMUM_STDVAR 5
52 
53 class QProgressDialog;
54 
55 typedef struct
56 {
57  double ra;
58  double dec;
59 } wcs_point;
60 
61 class Edge
62 {
63 public:
64  float x;
65  float y;
66  int val;
67  int scanned;
68  float width;
69  float HFR;
70  float sum;
71 };
72 
73 class FITSImage
74 {
75 public:
76  FITSImage(FITSMode mode=FITS_NORMAL);
77  ~FITSImage();
78 
79  /* Loads FITS image, scales it, and displays it in the GUI */
80  bool loadFITS(const QString &filename, QProgressDialog *progress=NULL);
81  /* Save FITS */
82  int saveFITS(const QString &filename);
83  /* Rescale image lineary from image_buffer, fit to window if desired */
84  int rescale(FITSZoom type);
85  /* Calculate stats */
86  void calculateStats(bool refresh=false);
87 
88  void subtract(float *darkFrame);
89 
90  // Access functions
91  float * getImageBuffer() { return image_buffer; }
92  void getSize(double *w, double *h) { *w = stats.dim[0]; *h = stats.dim[1]; }
93  void getMinMax(double *min, double *max) { *min = stats.min; *max = stats.max; }
94  double getMin() { return stats.min; }
95  double getMax() { return stats.max; }
96  int getDetectedStars() { return starCenters.count(); }
97  QList<Edge*> getStarCenters() { return starCenters;}
98  long getWidth() { return stats.dim[0]; }
99  long getHeight() { return stats.dim[1]; }
100  double getStdDev() { return stats.stddev; }
101  double getAverage() { return stats.average; }
102  int getBPP() { return stats.bitpix; }
103  FITSMode getMode() { return mode;}
104 
105 
106  int getFITSRecord(QString &recordList, int &nkeys);
107 
108  // Set functions
109  void setFITSMinMax(double newMin, double newMax);
110 
111  void setHistogram(FITSHistogram *inHistogram) { histogram = inHistogram; }
112  void applyFilter(FITSScale type, float *image=NULL, int min=-1, int max=-1);
113 
114 
115  // Star Detection & HFR
116  int findStars();
117  double getHFR(HFRType type=HFR_AVERAGE);
118  void findCentroid(int initStdDev=MINIMUM_STDVAR, int minEdgeWidth=MINIMUM_PIXEL_RANGE);
119  void getCenterSelection(int *x, int *y);
120 
121  // WCS
122  bool hasWCS() { return HasWCS; }
123  wcs_point *getWCSCoord() { return wcs_coord; }
124 
125  /* stats struct to hold statisical data about the FITS data */
126  struct
127  {
128  double min, max;
129  double average;
130  double stddev;
131  int bitpix;
132  int ndim;
133  long dim[2];
134  } stats;
135 
136 private:
137 
138 
139  bool checkCollision(Edge* s1, Edge*s2);
140  double average();
141  double stddev();
142  int calculateMinMax(bool refresh=false);
143  void checkWCS();
144  void readWCSKeys();
145 
146  bool markStars;
147  float *image_buffer; /* scaled image buffer (0-255) range */
148  fitsfile* fptr;
149  int data_type; /* FITS data type when opened */
150  FITSHistogram *histogram;
151  bool tempFile;
152  bool starsSearched;
153  bool HasWCS;
154  QString filename;
155  FITSMode mode;
156 
157  wcs_point *wcs_coord;
158  QList<Edge*> starCenters;
159 
160 };
161 
162 #endif
Edge::sum
float sum
Definition: fitsimage.h:70
FITSImage
Definition: fitsimage.h:73
wcs_point::ra
double ra
Definition: fitsimage.h:57
FITSImage::findStars
int findStars()
Definition: fitsimage.cpp:985
FITSImage::getWCSCoord
wcs_point * getWCSCoord()
Definition: fitsimage.h:123
Edge::width
float width
Definition: fitsimage.h:68
wcs_point::dec
double dec
Definition: fitsimage.h:58
FITSImage::bitpix
int bitpix
Definition: fitsimage.h:131
FITSImage::getFITSRecord
int getFITSRecord(QString &recordList, int &nkeys)
Definition: fitsimage.cpp:451
FITS_NORMAL
Definition: fitscommon.h:20
Edge::x
float x
Definition: fitsimage.h:64
FITSImage::findCentroid
void findCentroid(int initStdDev=MINIMUM_STDVAR, int minEdgeWidth=MINIMUM_PIXEL_RANGE)
Definition: fitsimage.cpp:490
Edge
Definition: fitsimage.h:61
MINIMUM_PIXEL_RANGE
#define MINIMUM_PIXEL_RANGE
Definition: fitsimage.h:50
FITSImage::saveFITS
int saveFITS(const QString &filename)
Definition: fitsimage.cpp:268
FITSImage::getHeight
long getHeight()
Definition: fitsimage.h:99
FITSImage::min
double min
Definition: fitsimage.h:128
Edge::y
float y
Definition: fitsimage.h:65
dms.h
FITSImage::stats
struct FITSImage::@1 stats
fitshistogram.h
FITSImage::max
double max
Definition: fitsimage.h:128
FITSImage::getMode
FITSMode getMode()
Definition: fitsimage.h:103
FITSImage::applyFilter
void applyFilter(FITSScale type, float *image=NULL, int min=-1, int max=-1)
Definition: fitsimage.cpp:829
FITSImage::hasWCS
bool hasWCS()
Definition: fitsimage.h:122
FITSScale
FITSScale
Definition: fitscommon.h:22
fitscommon.h
MINIMUM_STDVAR
#define MINIMUM_STDVAR
Definition: fitsimage.h:51
HFRType
HFRType
Definition: fitscommon.h:24
Edge::scanned
int scanned
Definition: fitsimage.h:67
FITSImage::getMin
double getMin()
Definition: fitsimage.h:94
FITSImage::getStarCenters
QList< Edge * > getStarCenters()
Definition: fitsimage.h:97
FITSImage::ndim
int ndim
Definition: fitsimage.h:132
FITSImage::stddev
double stddev
Definition: fitsimage.h:130
FITSImage::average
double average
Definition: fitsimage.h:129
skypoint.h
FITSImage::getImageBuffer
float * getImageBuffer()
Definition: fitsimage.h:91
FITSImage::dim
long dim[2]
Definition: fitsimage.h:133
FITSImage::getDetectedStars
int getDetectedStars()
Definition: fitsimage.h:96
FITSImage::getWidth
long getWidth()
Definition: fitsimage.h:98
FITSHistogram
Definition: fitshistogram.h:48
HFR_AVERAGE
Definition: fitscommon.h:24
FITSImage::getMinMax
void getMinMax(double *min, double *max)
Definition: fitsimage.h:93
FITSImage::getCenterSelection
void getCenterSelection(int *x, int *y)
Definition: fitsimage.cpp:1008
Edge::HFR
float HFR
Definition: fitsimage.h:69
FITSImage::FITSImage
FITSImage(FITSMode mode=FITS_NORMAL)
Definition: fitsimage.cpp:64
FITSImage::rescale
int rescale(FITSZoom type)
FITSImage::setHistogram
void setHistogram(FITSHistogram *inHistogram)
Definition: fitsimage.h:111
FITSImage::getHFR
double getHFR(HFRType type=HFR_AVERAGE)
Definition: fitsimage.cpp:782
FITSImage::~FITSImage
~FITSImage()
Definition: fitsimage.cpp:75
FITSImage::subtract
void subtract(float *darkFrame)
Definition: fitsimage.cpp:973
Edge::val
int val
Definition: fitsimage.h:66
FITSImage::getMax
double getMax()
Definition: fitsimage.h:95
FITSImage::getBPP
int getBPP()
Definition: fitsimage.h:102
FITSImage::getSize
void getSize(double *w, double *h)
Definition: fitsimage.h:92
FITSImage::loadFITS
bool loadFITS(const QString &filename, QProgressDialog *progress=NULL)
Definition: fitsimage.cpp:96
FITSImage::setFITSMinMax
void setFITSMinMax(double newMin, double newMax)
Definition: fitsimage.cpp:445
FITSImage::calculateStats
void calculateStats(bool refresh=false)
Definition: fitsimage.cpp:387
FITSImage::getStdDev
double getStdDev()
Definition: fitsimage.h:100
FITSZoom
FITSZoom
Definition: fitscommon.h:23
wcs_point
Definition: fitsimage.h:55
FITSMode
FITSMode
Definition: fitscommon.h:20
QList
FITSImage::getAverage
double getAverage()
Definition: fitsimage.h:101
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal