home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / fblnk224.zip / structs.h < prev    next >
C/C++ Source or Header  |  1999-01-28  |  14KB  |  402 lines

  1. /* structs.h for fitsblink 2,0   */
  2. /* Data structures  */
  3. #ifndef _blink_structs
  4. #define _blink_structs
  5. #include <forms.h>
  6. #include <fitsio.h>
  7. #include "consts.h"
  8. #include "formblink.h"
  9.  
  10. typedef unsigned short int PIXEL;
  11. typedef unsigned char BYTE;
  12.  
  13. typedef
  14. struct {
  15.   int simple;
  16.   long bitpix;
  17.   long naxis, nax[2];
  18.   fitsfile *fptr;
  19.   char ctype1[9], ctype2[9];
  20.   double crval1, crval2;  /* Celestial coordinates of the reference pixel (in decimal degrees) */
  21.   double crpix1, crpix2;  /* Image coordinates of the reference pixel  */
  22.   double cdelt1, cdelt2;  /* Coordinate incremement at reference pixel  */
  23.   double crot;            /* Rotation angle (should be the same for both axis */
  24.   char ctype[5];          /* Projection type (like -TAN)  */
  25.   short wcs;                /* Flag which is set if wcs coordinates are present  */
  26.   float sizex, sizey;
  27.   char telescope[FLEN_VALUE];
  28.   char instrument[FLEN_VALUE];
  29.   char observer[FLEN_VALUE];
  30.   char date_obs[FLEN_VALUE];
  31.   char ut_start[20];
  32.   char ut_cent[20];
  33.   char ut_end[20];
  34.   char time_beg[20];
  35.   char time_end[20];
  36.   char object[FLEN_VALUE];     /*  Name of the object  */
  37.   /*  Flags which tell whether specific keyword was read  */
  38.   short is_date_obs;
  39.   short is_exposure;
  40.   short is_ut_start;
  41.   short is_ut_cent;
  42.   short is_ut_end;
  43.   short is_time_beg;
  44.   short is_time_end;
  45.   char time[9];
  46.   float exposure;
  47.   float ccd_temp;
  48.   float temperat, pressure, humidity;
  49.   float equinox;
  50.   char *name;
  51. } FITSFILE;
  52.  
  53.  
  54. typedef
  55. struct slika {
  56.   int width, height;  /* Width and height of the image */
  57.   int  x1, y1, x2, y2;/* Coordinates of the active rectangle inside the image */
  58.   PIXEL *image;       /* Pointer to image */
  59.   PIXEL **pi;         /* Array of pointers to image rows  */
  60.   float fitmeasure;   /*  Ratio between fitted and measured brightness 
  61.               (and vice versa) of star which is still accepted  */
  62.   float minbright;      /*  Minimum still accepted brightness  */
  63.   int minstar;
  64.   int maxsize;      /*  Size of the window inside which the average background is calculated  */
  65.   float sg_num;     /*  Sensitivity threshold expressed in standard deviations of the background */
  66.   short border;       /* The width of the region on the image edge where no star is reported  */
  67.   short aperture;   /* Flag which tells if we do aperture astrometry  */
  68.   float inner;      /* radius of the inner circle for the aperture photometry  */
  69.   float outer;      /* radius of the outer circle for the aperture photometry  */
  70.   char *name;       /*  name od the image  */
  71. } FITS_IMAGE;
  72.  
  73.  
  74. /*  Structure with coordinates highlighted in the image */
  75. typedef struct {
  76.   float x, y;  /* Coordinates of the center  */
  77.   float r;     /* radius of the circle  */
  78.   char *s;     /* Name of the object  */
  79.   short color; /* Object color  */
  80.   short shape; /* Object shape  */
  81. }  OBJECT;
  82.  
  83. /*  Data describing window showing stars  */
  84. typedef
  85. struct {
  86.   double ra, dec;  /*  RA and rec in decimal degrees  */
  87.   double width, height;  /*  width and height in decimal degrees */
  88.   double fi;
  89.   double w, h;        /* width and height in pixels  */
  90.   float minmag, maxmag;  /*  Minimum and maximum acceptable magnitudes */
  91.   int minsize, maxsize;  /* Minimum and maximum size of star  */
  92.   int nm;       /*  Number of stars in memory */
  93. } MAP_IMAGE;
  94.  
  95. /*  A structure which describes a single star from a catalog  */
  96. typedef
  97. struct {
  98.   int catalog;  /*  Catalog number  */
  99.   int n;     /*  Star number  */
  100.   int m;     /*  Index of the matched star from the image  */
  101.   double x, y;  /*  Star screen coordinates */
  102.   double ra, dec;    /*  Star space coordinates  */
  103.   float bluemag, redmag, mag;  /*  Star magnitudes  */
  104.   int q;     /*  Indicator whether magnitudes can be trusted  */
  105.   float fitmag;  /*  Fitted star intensity  */
  106.   float err; /*  Distance between the imaged in catalogued star  */
  107. }  STAR;
  108.  
  109. typedef
  110. struct {
  111.   int n;
  112.   STAR *s;
  113.   float sp;
  114. } STARS;
  115.  
  116. /*  Structure which hold values needed for matching subroutine  */
  117. typedef
  118. struct {
  119.   float min;        /* Minimum acceptable value of constellation to accepted as a match  */
  120.   int nstar;        /* Number of neighbouring stars in constellation  */
  121.   int firstbright;  /* Number of bright stars used for initial matching  */
  122.   float poserrmax;     /* Maximum positional error allowed for acceptance of a star in costellation  */
  123.   float magerrmax;     /* Maximum magnitude error (factor) allowed for acceptance a a star in constellation  */
  124.   float maxres;        /* Maximal allowed residual  */
  125. } MATCH_OPTIONS;
  126.  
  127.  
  128. /*  Structure carrying information about individual images  */
  129. typedef struct {
  130.   float dx, dy;  /*  Translation of the image relative to a reference image */
  131.   float alfa;    /*  Angle of rotation */
  132.   float a, b, d, e;   /*  Koeficients relating to angle od rotation and extension */
  133.   double ra, dec; /* right ascension and declination of the image  */
  134.   double fi;     /* Angle of rotation from north to east  */
  135.   double xsize, ysize;  /* Sizes of pixel in x and y direction  */
  136.   int year, month, day; /* Time when the image was taken  */
  137.   int hour, minute;
  138.   float second;
  139.   float *gamx, *gamy;  /*  Lists of values for grey level correction */
  140.   float *kg;    /* list of coefficients for grey level correction */
  141.   int ngam;     /*  Number of points for grey level correction */
  142.   int low, high;  /*  The lowest and the highest value in the image  */
  143.   float *histx, *histy;  /*  Lists of values for the histogram  */
  144.   float xmin, xmax;   /*  Histogram range  */
  145.   int nhisto;   /*  Number of values in the histogram */
  146.   char *name;   /*  The name of the image  */
  147.   Pixmap  pixmap;  /*  Image as shown in X window  */
  148.   FITS_IMAGE fits;      /*  Structure with information about FITS image */
  149.   FITS_IMAGE astrwin;   /*  Small image inside which an object is located */
  150.   FITSFILE fitsfile;
  151.   OBJECT *obj;
  152.   int objnum;       /*  Number of markers loaded to memory  */
  153.   int objmax;       /*  maximum number of markers  */
  154.   short objshow;    /*  A flag which tells whether the markers are shown  */
  155.   int grey_max;     /*  Maximum grey level value for the screen  */
  156.   short detect;     /*  Set to 1 if any stars were detected  */
  157.   short matched;      /*  Set to 1 if star matching was successful  */
  158.   MATCH_OPTIONS match;
  159.   MAP_IMAGE map;
  160.   STARS imagelist;
  161.   STARS cataloglist;   /*  List of stars from the catalog  */
  162. }  BLINK_FRAME;
  163.  
  164. /*=========================================================================*/
  165. /*  Structure with the information about the current state of the program  */
  166. /*=========================================================================*/
  167.  
  168. typedef struct {
  169.   int control_num;  /*  Number of the currently selected control (0 or 1)  */
  170.   int control[2];  /*  Numbers of images belonging to the first and second control */
  171.   int frame_max;   /*  Number reserved spaces for frames  */
  172.   int frame_used;  /*  Number of actually used frames  */
  173.   Display *disp;   /*  Pointer to X11 display structure */
  174.   int bw, bh;      /*  Dimensions of the blinking area in pixels  */
  175.   FD_setting *gui; /*  Pointer to structure of control window  */
  176.   FD_blinker *blinker;  /*  Pointer to blinker structure  */
  177.   FL_COORD blinkwidth;  /*  Width  */
  178.   FL_COORD blinkheight; /*  and height of the blinker window  */
  179.   FD_Edit *browser[2];  /* Pair of pointers to browsers  */
  180.   FD_Error *error;  /*  Browser for the output of errors */
  181.   FD_help *readme;  /*  Window with the README file  */
  182.   FD_Parameters *parameters;  /*  Image parameters  */
  183.   FD_Report *report;/*  Report window  */
  184.   FD_Options *options; /* astrometry options  */
  185.   FD_Catalog *catalogs; /* catalog options  */
  186.   FD_Mail *mail;
  187.   FD_Wcs *newwcs; 
  188.   FD_Settings *settings;
  189.   FD_Set_catalogs *set_catalogs;
  190.   FD_Set_observatory *set_observatory;
  191.   FD_Set_display *set_display;
  192.   FD_Set_mail *set_mail;
  193.   FD_Set_help *set_help;
  194.   FD_Commands *set_commands;
  195.   FD_Set_ccd *set_ccd;
  196.   FD_Set_count *set_count;
  197.   FD_Set_match *set_match;
  198.   FD_Star *showstar;
  199.   FD_Comet *showcomet;
  200.   FD_Telescope *telescope;
  201.   FD_Message *message;
  202.   int b[2];         /* */
  203.   short zoom_width;   /*  Number of magnification (zoom) */
  204.   short freeze;       /*  Flag which is set if the zoom windows are locked  */
  205.   int xf, yf;       /*  Coordinates of the zoom window when the zoom is locked */
  206.   short blink;        /*  Am I in a blink mode ?  */
  207.   int blinknum;     /*  Number of the image shown in the blink mode  */
  208.   int grey_max;
  209.   short color;      /* Is display in color mode (1) or grey level (0) ? */
  210.   short inverse;    /* Is display inversed after autoleveling?  */
  211.   unsigned long pixel[GREY_WANTED];  /*  Index for X colors  */
  212.   char *logfile;
  213.   FILE *logfp;
  214.   short interactive;
  215.   short verbose;
  216.   short doastr;
  217.   float delay;
  218.   float autolevel_high;
  219.   int timeout;
  220.   char *wwwbrowser;
  221.   char *helpfile;
  222. } STATE;
  223.  
  224.  
  225. /*======================================================*/
  226. /* Structure with the information about the observatory */
  227. /*======================================================*/
  228. typedef
  229. struct {
  230.   int code;
  231.   char observer[CARDLENGTH];
  232.   char telescope[CARDLENGTH];
  233.   char instrument[CARDLENGTH];
  234.   double longitude;
  235.   double latitude;
  236. } OBSERVATORY;
  237.  
  238.  
  239. /*======================================================*/
  240. /* Current telescope and camera settings                */
  241. /*======================================================*/
  242. typedef
  243. struct {
  244.   double ra, dec; /*  right ascension and declination  */
  245.   double alt, az; /*  altitude and azimuth  */
  246.   double jd, sr;  /*  Julian day and sidereal time  */
  247.   double exptime; /*  exposure time  */
  248.   double temp;    /*  Camera temperature  */
  249.   char *filename; /*  output file name  */
  250.   short dark;     /*  dark image indicator  */
  251.   char start[256];
  252.   char point[256];
  253.   char park[256];
  254.   char where[256];
  255.   char zero[256];
  256.   char center[256];
  257.   char gettemp[256];
  258.   char settemp[256];
  259.   char expose[256];
  260. } TELESCOPE;
  261.  
  262.  
  263. /*================================================*/
  264. /* Structure with information about email report  */
  265. /*================================================*/
  266. typedef
  267. struct {
  268.   char *to;    /* Address to which we send  */
  269.   char *cc;    /* A list of cc addresses    */
  270.   char *title; /* Title of the message      */
  271.   char *file;  /* Name of the file which contains the body of message  */
  272. } MAIL;
  273.  
  274.  
  275. /*  Structures for catalogs  */
  276. /*===========================*/
  277.  
  278. /*  Description of catalogs  */
  279. typedef
  280. struct {
  281.   int use;      /* Set to TRUE if the catalog is used  */
  282.   int lpath;    /* Length of the string, reserved for path to the catalog  */
  283.   char *name;   /* Catalogs name  */
  284.   char *path;   /* full path to the catalog  */
  285. } CATALOG;
  286.  
  287. /**********/
  288. /*  USNO  */
  289. /**********/
  290. /*  A list of bytes definining one record in USNO catalog  */
  291. typedef
  292. struct {
  293.   unsigned char a[USNO_RECORDLENGTH];
  294. } USNO_STAR;
  295.  
  296. /*  One entry from an accelerator file  */
  297. typedef
  298. struct {
  299.   float ra;
  300.   int index, length;
  301. } ACCELERATOR;
  302.  
  303. /*********  USNO end  ***********/
  304.  
  305.  
  306. /**********************/
  307. /*     GSC            */
  308. /**********************/
  309. typedef
  310. struct {
  311.   int id, plate;
  312.   double ra, dec, poserr;
  313.   float mag, magerr;
  314.   short magband;
  315.   short class;
  316. } GUIDE_STAR;
  317.  
  318. typedef
  319. struct {
  320.   double center;  /* center of declination band  */
  321.   short numlarge;   /* Number of large regions in declination band  */
  322.   short firstlarge; /* First large region in declination band */
  323. } LARGE_REGION;
  324.  
  325. typedef
  326. struct {
  327.   short largeid;    /*  Id of the large region  */
  328.   short firstsmall; /* id of first small region in large region  */
  329.   short depth;      /*  Depth of subdivision of large region  */
  330. } SMALL_REGION;
  331.  
  332. /****** GSC end  *********/
  333.  
  334. /*======================================*/
  335. /*  Structures for starcount functions  */
  336. /*======================================*/
  337.  
  338. typedef 
  339. struct {
  340.   int x, y;     /*      Koordinati in vrednost tocke  */
  341.   PIXEL v;
  342. } POINT;
  343.  
  344. typedef 
  345. struct {
  346.   int xf, yf;            /* First point in object found by the program  */
  347.   double xt, yt;    /* Centroid coordinates */
  348.   int x1, y1, x2, y2;    /* Limiting coordinates  */
  349.   long area;            /* Number of pixels belonging to the object  */
  350.   long perim;            /* Number of pixels in object which lie on the edge */
  351.   long p_out;            /* Number of points touching the object from outside  */
  352.   long grey;            /* Sum of grey level values inside the object  */
  353.   float  bg;            /* Average background value inside the object  */
  354.   POINT *outer;            /* Pointer to the list of outside edge points  */
  355.   POINT *inner;            /* Pointer to the list of inside points    */ 
  356.   int xu;               /* Coordinate of a point on the upper edge of the object */
  357.   int n;
  358. } OBJEKT;
  359.  
  360. typedef struct {
  361.   BYTE *s, **p;    /*    Kazalec na sliko  */
  362.   int width;  /*  Sirina slike v BYTE-ih  * 8  (torej v pixlih) */
  363.   long size;  /*    Velikost  slike  v bytih  */
  364.   int x0, y0;  /*    Offset glede na koordinate objekta na sliki  */
  365. } SHADOW;
  366.  
  367. /*  Structure with data about Gaussian filter */
  368. typedef struct {
  369.   float sigma;   /*  Width of the gaussian in pixels  */
  370.   int n;         /*  linear size of the array  */
  371.   float r;       /*  radius of the circle taken into account  */
  372.   float **g;     /*  Pointer to the coefficient array  */
  373. } GAUSSF;
  374.  
  375.  
  376. /*==========================================*/
  377. /*  Structures for field_compare functions  */
  378. /*==========================================*/
  379. /*  Pair of star coordinates  */
  380. typedef
  381. struct {
  382.   float x1, y1, x2, y2;
  383.   float mag1, mag2;
  384.   int n1, n2;
  385.   float err;
  386. } STAR_PAIR;
  387.  
  388.  
  389. /*  Parameters of the coordinate rotation and translation and magnitude transfor
  390. mation  */
  391. typedef
  392. struct {
  393.   double a, b, c, d, e, f, hi;  /*  Translation and rotation  */
  394.   double ma, mb, sma, smb;      /*  Magnitude transformation  */
  395. } TRANSROT;
  396.   
  397.  
  398. #endif
  399.  
  400.  
  401.  
  402.