simple relative coordinates when point by mouse (if ROT0, CRPIX1 and CRPIX2 given)

This commit is contained in:
eddyem 2016-08-04 15:30:54 +03:00
parent 21b870159d
commit c601c6ac10
10 changed files with 157 additions and 179 deletions

3
README
View File

@ -45,3 +45,6 @@ to calculate simplest CDx_x coefficients user can give parameter ROT0:
CROTA2 = -ROT0 + PARANGLE - VAL_P
- for right-handed > 0 (0..360)
CROTA2 = ROT0 - PARANGLE + VAL_P
WARNING! Since 4.08.2016 filename prefix should be pointed by -o flag!

View File

@ -333,7 +333,7 @@ int push_param(){
void write_bta_queue(fitsfile *fp){
#define HISTRY(...) do{CMNT(__VA_ARGS__); WRITEHIST(fp);}while(0)
if(!bta_queue) return;
if(!bta_queue || !fp) return;
BTA_Queue *cur = bta_queue, *ptr;
BTA_PARAMS *P;
int i = 0;

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <float.h> // DBL_EPSILON
#include "takepic.h"
#include "camtools.h"
#include "usage.h"
@ -168,7 +168,7 @@ int writefits(char *filename, int width, int height, void *data){
struct tm *tm_starttime;
char buf[80];
time_t savetime = time(NULL);
fitsfile *fp;
fitsfile *fp = NULL;
TRYFITS(fits_create_file, &fp, filename);
TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes);
// FILE / Input file original name
@ -406,12 +406,10 @@ void convert_grayimage(unsigned short *src, GLubyte *dst, int w, int h){
}
avr /= (double)S;
wd = max - min;
avr = (avr - min) / wd; // normal average by preview
DBG("stat: avr=%f wd=%f max=%f min=%f", avr, wd, max, min);
// avr = -log(avr); // scale factor
// if(avr > 1.) wd /= avr;
if(wd > DBL_EPSILON) avr = (avr - min) / wd; // normal average by preview
if(avr < 0.6) wd *= avr + 0.2;
DBG("now wd is %f", wd);
if(wd < DBL_EPSILON) wd = 1.;
DBG("stat: sz=(%dx%d) avr=%g wd=%g max=%g min=%g", w,h,avr, wd, max, min);
for(y = 0; y < h; y++){
for(x = 0; x < w; x++, dst += 3, src++){
gray2rgb(colorfun((*src - min) / wd), dst);

View File

@ -122,9 +122,9 @@ KeyList *list_add_record(KeyList **list, char *rec, int immutable){
if((node = (KeyList*) MALLOC(KeyList, 1)) == 0) return NULL; // allocation error
node->record = strdup(rec); // insert data
node->immutable = immutable;
DBG("add record %s", rec);
//DBG("add record %s", rec);
if(!node->record){
/// "Не могу скопировать данные"
/// "îÅ ÍÏÇÕ ÓËÏÐÉÒÏ×ÁÔØ ÄÁÎÎÙÅ"
WARNX(_("Can't copy data"));
return NULL;
}
@ -329,6 +329,7 @@ void write_list(fitsfile *fp){
}
}
static int wcs_rdy = 0;
/**
* Check if user tell some information about WCS and add it into headers
*/
@ -350,8 +351,8 @@ void check_wcs(){
cnt += getdoubleval(&cd, FITS_keys, "CD1_1");
cnt += getdoubleval(&crot, FITS_keys, "CROTA2");
cnt += getdoubleval(&rot0, FITS_keys, "ROT0");
DBG("cnt = %d", cnt);
if(!cnt) return;
wcs_rdy = 1;
int wcs = 2;
WRITEKEY(TINT, "WCSAXIS", &wcs, "Number of WCS axes");
WRITEKEY(TSTRING, "CTYPE1", "RA---TAN", "RA-Gnomic projection");
@ -418,7 +419,6 @@ void check_wcs(){
double s, c, scx = imscale / 3600. * hbin, scy = imscale / 3600. * vbin;
if(rot0 < 0){ // left-handed
crot = (-rot0 + parangle - rotangle)*M_PI/180;
DBG("crot = %g", crot*180/M_PI);
sincos(crot, &s, &c);
CD[0][0] = -scx * c; CD[0][1] = scy * s;
CD[1][0] = scx * s; CD[1][1] = scy * c;
@ -433,3 +433,13 @@ void check_wcs(){
WRITEKEY(TDOUBLE, "CD2_1", &CD[1][0], "rotation matrix coefficient [2,1]");
WRITEKEY(TDOUBLE, "CD2_2", &CD[1][1], "rotation matrix coefficient [2,2]");
}
// function for events.c - recalculate coordinates on image into WCS
void calc_coords(float x, float y, double *alpha, double *delta){
double ra, dec, dx = x - crpix1, dy = y - crpix2;
if(!wcs_rdy){*alpha = 5e6; *delta = 5e6; return; }
ra = crval1 + dx * CD[0][0] + dy * CD[0][1];
dec = crval2 + dx * CD[1][0] + dy * CD[1][1];
if(alpha) *alpha = ra * 3600.; // hrsec
if(delta) *delta = dec * 3600.; // arcsec
}

View File

@ -37,6 +37,8 @@ void processKeybrd(unsigned char key, int mod, int win_GL_ID, _U_ int x, _U_ int
case 27:
destroyWindow_async(win_GL_ID);
break;
/* case 'x':
break;*/
case 'Z':
win->zoom *= 1.1;
calc_win_props(win, NULL, NULL);
@ -67,6 +69,11 @@ void keySpPressed(_U_ int key, _U_ int x, _U_ int y){
DBG("Sp. key pressed. mod=%d, keycode=%d, point=(%d,%d)\n", glutGetModifiers(), key, x,y);
}
// in defhdrs.c
extern void calc_coords(float x, float y, double *alpha, double *delta);
extern char *time_asc(double t);
extern char *angle_asc(double a);
int oldx, oldy; // coordinates when mouse was pressed
int movingwin = 0; // ==1 when user moves image by middle button
void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
@ -78,8 +85,16 @@ void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
if(state == GLUT_DOWN){
oldx = x; oldy = y;
float X,Y;
double RA, D;
conv_mouse_to_image_coords(x,y,&X,&Y,win);
DBG("press in (%d, %d) == (%f, %f) on image; mod == %d", x,y,X,Y, mod);
calc_coords(X, Y, &RA, &D);
printf("x = %f, y= %f", X, Y);
/// "úÁÄÁÊÔÅ WCS ÐÁÒÁÍÅÔÒÙ, ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ROT0, CRPIX1 É CRPIX2"
if(RA > 4e6){
printf("\n");
WARNX(_("Give WCS parameters, at least ROT0, CRPIX1 and CRPIX2"));
}else printf(", ra = %s, dec=%s\n", angle_asc(RA), time_asc(D));
if(key == GLUT_MIDDLE_BUTTON) movingwin = 1;
if(key == 3){ // wheel UP
if(mod == 0) win->y += 10.*win->zoom; // nothing pressed - scroll up
@ -94,47 +109,20 @@ void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
}else{
movingwin = 0;
}
/* DBG("Mouse button %s. point=(%d, %d); mod=%d, button=%d\n",
(state == GLUT_DOWN)? "pressed":"released", x, y, glutGetModifiers(), key);*/
}
/* int window = glutGetWindow();
if(window == WaveWindow){ // ÝÅÌËÎÕÌÉ × ÏËÎÅ Ó ×ÅÊ×ÌÅÔÏÍ
_U_ int w = glutGet(GLUT_WINDOW_WIDTH) / 2;
_U_ int h = glutGet(GLUT_WINDOW_HEIGHT) / 2;
if(state == GLUT_DOWN && key == GLUT_LEFT_BUTTON){
//HistCoord[0] = (x > w);
//HistCoord[1] = (y > h);
}
}
*/
}
/* this doesn't work
void mouseWheel(int button, int dir, int x, int y){
int window = glutGetWindow();
windowData *win = searchWindow_byGLID(window);
if(!win) return;
DBG("Mouse wheel, dir: %d. point=(%d, %d); mod=%d, button=%d\n",
dir, x, y, glutGetModifiers(), button);
}
*/
void mouseMove(_U_ int x, _U_ int y){
int window = glutGetWindow();
windowData *win = searchWindow_byGLID(window);
if(!win) return;
//DBG("Mouse moved to (%d, %d)\n", x, y);
if(movingwin){
float X, Y, nx, ny;//, w2, h2;
float X, Y, nx, ny;
float a = win->Daspect;
X = (x - oldx) * a; Y = (y - oldy) * a;
nx = win->x + X;
ny = win->y - Y;
// w2 = win->image->w / 2. * win->zoom;
// h2 = win->image->h / 2. * win->zoom;
// if(nx < w2 && nx > -w2)
win->x = nx;
// if(ny < h2 && ny > -h2)
win->y = ny;
win->x = nx;
win->y = ny;
oldx = x;
oldy = y;
calc_win_props(win, NULL, NULL);
@ -162,6 +150,7 @@ void createMenu(int GL_ID){
glutAddMenuEntry("Quit (ctrl+q)", 'q');
glutAddMenuEntry("Close this window (ESC)", 27);
glutAddMenuEntry("Restore zoom (1)", '1');
// glutAddMenuEntry("Make exposition (x)", 'x');
glutAttachMenu(GLUT_RIGHT_BUTTON);
}

View File

@ -37,6 +37,5 @@ void mousePressed(int key, int state, int x, int y);
void mouseMove(int x, int y);
void createMenu(int window);
void menuEvents(int opt);
//void mouseWheel(int button, int dir, int x, int y);
#endif // __EVENTS_H__

View File

@ -80,28 +80,20 @@ void createWindow(windowData *win){
glutDisplayFunc(RedrawWindow);
glutKeyboardFunc(keyPressed);
glutSpecialFunc(keySpPressed);
//glutMouseWheelFunc(mouseWheel);
glutMouseFunc(mousePressed);
glutMotionFunc(mouseMove);
//glutIdleFunc(glutPostRedisplay);
glutIdleFunc(NULL);
DBG("init textures");
glGenTextures(1, &(win->Tex));
win->zoom = 1.;
// calc_win_props(win, NULL, NULL);
// win->zoom = 1. / win->Daspect;
// DBG("Daspect: %g, zoom: %g", win->Daspect, win->zoom);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, win->Tex);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->image->w, win->image->h, 0,
GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
glDisable(GL_TEXTURE_2D);
@ -194,19 +186,6 @@ void redisplay(int GL_ID){
glutPostRedisplay();
}
/*
if(redraw)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h,
GL_LUMINANCE, GL_FLOAT, ptro); // s/image->data/tex/
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, w, h,
0, GL_LUMINANCE, GL_FLOAT, ptro);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
*/
void RedrawWindow(){
if(!initialized) return;
int window;
@ -218,7 +197,6 @@ void RedrawWindow(){
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//glTranslatef(win->x-w/2., win->y-h/2., win->z);
glTranslatef(win->x, win->y, 0.);
glScalef(-win->zoom, -win->zoom, 1.);
glEnable(GL_TEXTURE_2D);
@ -229,14 +207,6 @@ void RedrawWindow(){
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
win->image->changed = 0;
}
/*
glBegin(GL_QUADS);
glTexCoord2f(0., 1.); glVertex3f(0., 0., 0.);
glTexCoord2f(0., 0.); glVertex3f(0.,h, 0.);
glTexCoord2f(1., 0.); glVertex3f(w, h, 0.);
glTexCoord2f(1., 1.); glVertex3f(w, 0., 0.);
glEnd();
*/
w /= 2.; h /= 2.;
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex2f(-w, -h );
@ -255,10 +225,6 @@ void RedrawWindow(){
* waits for global signals to create windows & make other actions
*/
void *Redraw(_U_ void *arg){
// pthread_cond_t fakeCond = PTHREAD_COND_INITIALIZER;
// struct timeval tv;
// struct timespec timeToWait;
// struct timeval now;
while(1){
pthread_mutex_lock(&winini_mutex);
if(!initialized){
@ -279,22 +245,8 @@ void *Redraw(_U_ void *arg){
wannakill_GL_ID = 0;
}
forEachWindow(redisplay);
/* gettimeofday(&now,NULL);
timeToWait.tv_sec = now.tv_sec;
timeToWait.tv_nsec = now.tv_usec * 1000UL + 10000000UL;
pthread_cond_timedwait(&fakeCond, &winini_mutex, &timeToWait);*/
pthread_mutex_unlock(&winini_mutex);
//pthread_testcancel();
if(totWindows) glutMainLoopEvent(); // process actions if there are windows
/* gettimeofday(&now,NULL);
timeToWait.tv_sec = now.tv_sec;
timeToWait.tv_nsec = now.tv_usec * 1000UL + 10000000UL;
pthread_mutex_lock(&fakeMutex);
pthread_cond_timedwait(&fakeCond, &fakeMutex, &timeToWait);
pthread_mutex_unlock(&fakeMutex);*/
/* tv.tv_sec = 0;
tv.tv_usec = 10000;
select(0, NULL, NULL, NULL, &tv);*/
usleep(10000);
}
return NULL;
@ -305,22 +257,15 @@ void Resize(int width, int height){
int window = glutGetWindow();
windowData *win = searchWindow_byGLID(window);
if(!win) return;
/* int GRAB_WIDTH = win->w, GRAB_HEIGHT = win->h;
float _U_ tmp, wd = (float) width/GRAB_WIDTH, ht = (float)height/GRAB_HEIGHT;
tmp = (wd + ht) / 2.;
width = (int)(tmp * GRAB_WIDTH); height = (int)(tmp * GRAB_HEIGHT);*/
glutReshapeWindow(width, height);
win->w = width;
win->h = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//GLfloat W = (GLfloat)GRAB_WIDTH; GLfloat H = (GLfloat)GRAB_HEIGHT;
GLfloat W, H;
calc_win_props(win, &W, &H);
glOrtho(-W,W, -H,H, -1., 1.);
// gluPerspective(90., W/H, 0., 100.0);
// gluLookAt(0., 0., H/2., 0., 0., 0., 0., 1., 0.);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
@ -389,11 +334,12 @@ void imageview_init(){
int c = 1;
static int glutnotinited = 1;
if(initialized){
// "Уже инициализировано!"
// "õÖÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎÏ!"
WARNX(_("Already initialized!"));
return;
}
if(glutnotinited){
DBG("init");
XInitThreads(); // we need it for threaded windows
glutInit(&c, v);
glutnotinited = 0;
@ -419,12 +365,10 @@ void clear_GL_context(){
initialized = 0;
DBG("locked");
// kill main GLUT thread
// pthread_cancel(GLUTthread);
pthread_mutex_unlock(&winini_mutex);
forEachWindow(killwindow_v);
DBG("join");
pthread_join(GLUTthread, NULL); // wait while main thread exits
// pthread_mutex_unlock(&winini_mutex);
DBG("main GL thread cancelled");
}

View File

@ -285,7 +285,7 @@ wheelret:
}
#ifdef IMAGEVIEW
void change_displayed_image(_U_ unsigned short *buf, windowData *win){
void change_displayed_image(unsigned short *buf, windowData *win){
FNAME();
if(!win) return;
pthread_mutex_lock(&win->mutex);
@ -307,23 +307,15 @@ int main(int argc, char **argv){
FILE *f_statlog = NULL; // stat file
int roih=0, roiw=0, osh=0, osw=0, binh=0, binw=0, shtr=0; // camera parameters
char whynot[BUFF_SIZ]; // temporary buffer for error texts
int imW=0, imH=0; // real (with binning) image size
int imW=1024, imH=1024; // real (with binning) image size
unsigned short *buf = NULL; // image buffer
double mintemp=0.;
#ifdef IMAGEVIEW
_U_ windowData *mainwin = NULL;
_U_ rawimage im;
windowData *mainwin = NULL;
rawimage im;
#endif
initial_setup(); // setup for macros.c
//setlocale(LC_ALL, getenv("LC_ALL"));
/* setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
//bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
*/
parse_args(argc, argv);
catch_signals();
@ -334,7 +326,9 @@ int main(int argc, char **argv){
writefits(NULL, imW, imH, NULL);
return(0);
}
if(fake) test_headers = 1;
// Begin of non-fake block ------->
if(!fake){
// Turret block
if(open_turret) parse_turret_args();
if(only_turret){
@ -515,6 +509,7 @@ DBG("open %d", Ncam);
ERR("Can't set readout parameters: %s", whynot);
goto returning;
}
} // <------ end of non-fake block
DBG("geomery: %dx%d", imW, imH);
int L = imW*imH;
buf = (unsigned short*) calloc(L, sizeof(unsigned short));
@ -524,7 +519,7 @@ DBG("open %d", Ncam);
}
#ifdef IMAGEVIEW
// start image view module if not need to save image or manually defined displaying
if(!save_image || show_image){
if(fake || !save_image || show_image){
imageview_init();
im.protected = 1;
im.rawdata = MALLOC(GLubyte, imW*imH*3);
@ -532,6 +527,7 @@ DBG("open %d", Ncam);
im.w = imW; im.h = imH;
}
#endif
if(fake) pics = 0;
DBG("start %d expositions", pics);
for (i = 0; i < pics; i++){
DBG("spd");
@ -627,18 +623,13 @@ DBG("open %d", Ncam);
fprintf(f_statlog, "%s\t%ld\t%g\t%.2f\t%.2f\t", tm_buf,
time(NULL), E, t_int, t_ext);
print_stat(buf, L, f_statlog);
inline void WRITEIMG(int (*writefn)(char*,int,int,void*), char *ext){
if(!check_filename(whynot, outfile, ext))
// "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
err(1, _("Can't save file"));
else{
int r = writefn(whynot, imW, imH, buf);
// "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
if (r == 0) info(_("File saved as '%s'"), whynot);
}
}
#ifdef IMAGEVIEW
if(!save_image || show_image){
// build FITS headers tree for viewer
#ifdef USE_BTA
write_bta_data(NULL);
#endif
check_wcs();
if(!get_windows_amount() || !mainwin){
mainwin = createGLwin("Sample window", 400, 400, &im);
if(!mainwin){
@ -654,6 +645,16 @@ DBG("open %d", Ncam);
change_displayed_image(buf, mainwin);
}
#endif
inline void WRITEIMG(int (*writefn)(char*,int,int,void*), char *ext){
if(!check_filename(whynot, outfile, ext))
// "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
err(1, _("Can't save file"));
else{
int r = writefn(whynot, imW, imH, buf);
// "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
if (r == 0) info(_("File saved as '%s'"), whynot);
}
}
if(save_image){
DBG("save image");
#ifdef USERAW
@ -682,20 +683,40 @@ DBG("open %d", Ncam);
}
fflush(NULL);
}
#ifdef IMAGEVIEW
if(fake){
writefits(NULL, imW, imH, NULL);
if(!get_windows_amount() || !mainwin){
mainwin = createGLwin("Sample window", 400, 400, &im);
if(!mainwin){
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÏËÎÏ OpenGL, ÐÒÏÓÍÏÔÒ ÂÕÄÅÔ ÎÅÄÏÓÔÕÐÅÎ!"
info(_("Can't open OpenGL window, image preview will be inaccessible"));
}else{
mainwin->killthread = 1;
}
}
if(get_windows_amount() && mainwin){
DBG("change image");
change_displayed_image(buf, mainwin);
}
}
#endif
returning:
if(!only_turret){
// set fan speed to 0 or 3 according cooler status
AutoadjustFanSpeed(TRUE);
DBG("abort exp");
ApnGlueExpAbort();
DBG("close");
ApnGlueClose();
restore_signals();
DBG("free buffers & close files");
free(buf);
free_fits_list();
if(f_tlog) fclose(f_tlog);
if(f_statlog) fclose(f_statlog);
if(!fake){
// set fan speed to 0 or 3 according cooler status
AutoadjustFanSpeed(TRUE);
DBG("abort exp");
ApnGlueExpAbort();
DBG("close");
ApnGlueClose();
restore_signals();
DBG("free buffers & close files");
free(buf);
free_fits_list();
if(f_tlog) fclose(f_tlog);
if(f_statlog) fclose(f_statlog);
}
#ifdef IMAGEVIEW
DBG("test for GL window");
if(mainwin){ //window was created - wait for manual close

95
usage.c
View File

@ -63,6 +63,7 @@ int
,Shtr = -1 // shutter: -1 -- no action or SHUTTER_OPEN/SHUTTER_CLOSE
,noclean = 0 // don't flush camera after exp
,twelveBit = 0 // 12-bit ADC
,fake = 0 // fake image
,flipX = 0 // flip image around X axe (vertical flip)
,flipY = 0 // flip image around Y axe (horizontal flip)
,histry = 0 // write history at expositions
@ -141,6 +142,9 @@ void usage(char *fmt, ...){
printf("\t-b,\t--defhdr=filename\t%s\n",
// "ÉÍÑ ÆÁÊÌÁ Ó ÚÁÇÏÌÏ×ËÁÍÉ ÐÏ ÕÍÏÌÞÁÎÉÀ"
_("file with default headers"));
printf("\t-B,\t--observer=obs\t\t%s\n",
// "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
_("observers' names"));
printf("\t-c,\t--cooler-off\t\t%s\n",
// "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
_("set cooler off"));
@ -168,63 +172,63 @@ void usage(char *fmt, ...){
printf("\t-G,\t--wheel-go=N\t\t%s\n",
// ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × N-À ÐÏÚÉÃÉÀ
_("set turret to Nth position"));
printf("\t-H,\t--time-interval=T\t%s\n",
// "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
_("time interval between sequential writings to log & HISTORY (in seconds)"));
printf("\t-h,\t--hbin=N\t\t%s\n",
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ÇÏÒÉÚÏÎÔÁÌÉ"
_("horizontal binning to N pixels"));
printf("\t-I,\t--image-type=type\t%s\n",
// "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
_("image type"));
printf("\t-H,\t--time-interval=T\t%s\n",
// "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
_("time interval between sequential writings to log & HISTORY (in seconds)"));
printf("\t-i,\t--instrument=instr\t%s\n",
// "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
_("instrument name"));
printf("\t-L,\t--log-only\t\t%s\n",
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
_("don't save images, only make all-stat log"));
printf("\t-I,\t--image-type=type\t%s\n",
// "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
_("image type"));
printf("\t-l,\t--tlog\t\t\t%s\n",
// "×ÅÓÔÉ ÚÁÐÉÓØ ÒÁÂÏÞÉÈ ÔÅÍÐÅÒÁÔÕÒ × ÆÁÊÌ temp_log"
_("make temperatures logging to file temp_log"));
printf("\t-L,\t--log-only\t\t%s\n",
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
_("don't save images, only make all-stat log"));
printf("\t-M,\t--msg-id\t\t%s\n",
// "ÏÔËÒÙÔØ ËÁÍÅÒÕ ÐÏ MSG-ID"
_("open camera by its MSG-ID"));
printf("\t-N,\t--ncam=N\t\t%s\n",
// "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
_("work with Nth camera"));
printf("\t-n,\t--nframes=N\t\t%s\n",
// "N ËÁÄÒÏ× × ÓÅÒÉÉ"
_("make series of N frames"));
printf("\t-N,\t--ncam=N\t\t%s\n",
// "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
_("work with Nth camera"));
printf("\t-o,\t--outfile=prefix\t%s\n",
// "ÐÒÅÆÉËÓ ÉÍÅÎÉ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ"
_("output filename prefix"));
printf("\t-O,\t--object=obj\t\t%s\n",
// "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
_("object name"));
printf("\t-o,\t--observer=obs\t\t%s\n",
// "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
_("observers' names"));
printf("\t-P,\t--prog-id=prname\t%s\n",
// "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
_("observing program name"));
printf("\t-p,\t--pause-len=ptime\t%s\n",
// "×ÙÄÅÒÖÁÔØ ptime ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
_("make pause for ptime seconds between expositions"));
printf("\t-P,\t--prog-id=prname\t%s\n",
// "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
_("observing program name"));
printf("\t-r,\t--speed-set=N\t\t%s\n",
// "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ × N"
_("set readout speed to N"));
printf("\t-R,\t--reset\t\t\t%s\n",
// "ðÏÌÎÙÊ ÓÂÒÏÓ"
_("full reset"));
printf("\t-S,\t--sleep\t\t\t%s\n",
// "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
_("go to sleeping mode"));
printf("\t-s,\t--only-stat\t\t%s\n",
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÅ, Á ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
_("not save image, just show statistics"));
printf("\t-T,\t--only-temp\t\t%s\n",
// "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
_("only set/get temperature"));
printf("\t-S,\t--sleep\t\t\t%s\n",
// "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
_("go to sleeping mode"));
printf("\t-t,\t--set-temp=degr\t\t%s\n",
// "ÚÁÄÁÔØ ÒÁÂÏÞÕÀ ÔÅÍÐÅÒÁÔÕÒÕ degr ÇÒÁÄÕÓÏ×"
_("set work temperature to degr C"));
printf("\t-T,\t--only-temp\t\t%s\n",
// "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
_("only set/get temperature"));
printf("\t-v,\t--vbin=N\t\t%s\n",
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ×ÅÒÔÉËÁÌÉ"
_("vertical binning to N pixels"));
@ -244,6 +248,9 @@ void usage(char *fmt, ...){
// "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
_("select clip region"));
// ONLY LONG
printf("\t\t--fakeimg\t\t\t%s\n",
// "ôÅÓÔ ÏËÎÁ OpenGL ÂÅÚ ÐÏÌÕÞÅÎÉÑ ÉÚÏÂÒÁÖÅÎÉÑ"
_("Test OpenGL window (without image exposure)"));
printf("\t\t--flipX\t\t\t%s\n",
// "ÏÔÒÁÚÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ ×ÅÒÔÉËÁÌØÎÏ (ÏÔÎÏÓÉÔÅÌØÎÏ ÏÓÉ X)"
_("flip image vertically (around X axe)"));
@ -277,7 +284,7 @@ void usage(char *fmt, ...){
void parse_args(int argc, char **argv){
FNAME();
int i;
char short_options[] = "A:b:cC:dDE:fF:gG:H:h:I:i:LlM:N:n:O:o:P:p:Rr:SsTt:v:Ww:x:X:Y:";
char short_options[] = "A:b:B:cC:dDE:fF:gG:H:h:I:i:LlM:N:n:O:o:P:p:Rr:SsTt:v:Ww:x:X:Y:";
struct option long_options[] = {
/* { name, has_arg, flag, val }, ÇÄÅ:
* name - name of long parameter
@ -289,6 +296,7 @@ void parse_args(int argc, char **argv){
*/
{"author", 1, 0, 'A'},
{"defhdr", 1, 0, 'b'},
{"observers", 1, 0, 'B'},
{"cooler-off", 0, 0, 'c'},
{"imscale", 1, 0, 'C'},
{"dark", 0, 0, 'd'},
@ -307,8 +315,8 @@ void parse_args(int argc, char **argv){
{"msg-id", 1, 0, 'M'},
{"ncam", 1, 0, 'N'},
{"nframes", 1, 0, 'n'},
{"outfile", 1, 0, 'o'},
{"object", 1, 0, 'O'},
{"observers", 1, 0, 'o'},
{"prog-id", 1, 0, 'P'},
{"pause-len", 1, 0, 'p'},
{"reset", 0, 0, 'R'},
@ -324,6 +332,7 @@ void parse_args(int argc, char **argv){
{"xclip", 1, 0, 'X'},
{"yclip", 1, 0, 'Y'},
// options, that have no short analogs:
{"fakeimg", 0, &fake, 1},
{"flipX", 0, &flipX, 1},
{"flipY", 0, &flipY, 1},
{"noclean", 0, &noclean, 1},
@ -354,6 +363,11 @@ void parse_args(int argc, char **argv){
case 'b':
defhdr_filename = strdup(optarg);
break;
case 'B':
observers = strdup(optarg);
// "îÁÂÌÀÄÁÔÅÌÉ: %s"
info(_("Observers: %s"), observers);
break;
case 'c':
only_turret = FALSE;
set_T = TRUE;
@ -470,16 +484,16 @@ void parse_args(int argc, char **argv){
// "óÅÒÉÑ ÉÚ %d ËÁÄÒÏ×"
info(_("Series of %d frames"), pics);
break;
case 'o':
outfile = strdup(optarg);
// "ðÒÅÆÉËÓ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ"
info(_("Output filename prefix: %s"), outfile);
break;
case 'O':
objname = strdup(optarg);
// "éÍÑ ÏÂßÅËÔÁ - %s"
info(_("Object name - %s"), objname);
break;
case 'o':
observers = strdup(optarg);
// "îÁÂÌÀÄÁÔÅÌÉ: %s"
info(_("Observers: %s"), observers);
break;
case 'P':
prog_id = strdup(optarg);
// "îÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ: %s"
@ -578,23 +592,22 @@ void parse_args(int argc, char **argv){
usage(NULL);
}
}
argc -= optind;
argv += optind;
if(argc == 0){
if(fake){
only_turret = FALSE;
save_image = FALSE;
}
else if(!strchr(argv[0], '=') && !strchr(argv[0], ' ')){ // argv[0] is a filename
outfile = argv[0];
argc--;
argv++;
argc -= optind;
argv += optind;
if(outfile == NULL){
save_image = FALSE;
}
get_defhdrs(defhdr_filename);
if(argc > 0){ // additional headers
// "äÏÐÏÌÎÉÔÅÌØÎÙÅ ÚÁÇÏÌÏ×ËÉ:\n"
info(_("Additional headers"));
// "äÏÐÏÌÎÉÔÅÌØÎÙÅ ÚÁÇÏÌÏ×ËÉ: "
info(_("Additional headers: "));
for (i = 0; i < argc; i++)
info("%s ", argv[i]);
add_morehdrs(argc, argv);
}
add_morehdrs(argc, argv);
if(Shtr != -1) only_turret = FALSE;
}

View File

@ -57,6 +57,7 @@ extern int
,Shtr
,noclean
,twelveBit
,fake
,flipX
,flipY
,histry