X-shooter Pipeline Reference Manual 3.8.15
test-region_file.c
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2011-12-02 14:13:14 $
23 * $Revision: 1.3 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30/*--------------------------------------------------------------------------*/
36/*--------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------
40 Includes
41 ---------------------------------------------------------------------------*/
42#include <string.h>
43#include <stdio.h>
44#include <cpl.h>
45#include <xsh_msg.h>
46/*---------------------------------------------------------------------------
47 Defines
48 ---------------------------------------------------------------------------*/
49/*--------------------------------------------------------------------------*/
55/*--------------------------------------------------------------------------*/
56int main(int argc, char **argv)
57{
58
59 cpl_image* ima=NULL;
60 int sx=100;
61 int sy=100;
62 double value=100;
63 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
64
65 ima=cpl_image_new(sx,sy,CPL_TYPE_DOUBLE);
66 cpl_image_add_scalar(ima,1);
67
68 FILE* region_file = fopen( "ima.reg", "w");
69 fprintf( region_file, "# Region file format: DS9 version 4.0\n\
70 global color=red font=\"helvetica 4 normal\"\
71 select=1 highlite=1 edit=1 move=1 delete=1 include=1 fixed=0 source \nimage\n");
72
73 for(int j=0.4*sy;j<0.5*sy;j++) {
74 for(int i=0.4*sy;i<0.5*sy;i++) {
75 value=i*j;
76 cpl_image_set(ima,i,j,value);
77 xsh_msg_debug("ima[%d,%d]=%g",i,j,value);
78 fprintf( region_file, "point(%d,%d) #point=cross color=yellow "\
79 "font=\"helvetica 10 normal\" text={%d %d}\n", i, j, i,j);
80 }
81 }
82 cpl_image_save(ima,"ima.fits",CPL_TYPE_FLOAT,NULL,CPL_IO_DEFAULT);
83 fclose(region_file);
84 cpl_image_delete(ima);
85 return cpl_test_end(0);
86}
87
88
int main()
Unit test of xsh_bspline_interpol.
#define xsh_msg_debug(...)
Print a debug message.
Definition: xsh_msg.h:99