1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: sdf-1.c,v 1.1 2000/04/28 13:02:44 kevin Exp $
7 ** Revision 1.1 2000/04/28 13:02:44 kevin
11 ** This program is free software; you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License (version 2) as
13 ** published by the Free Software Foundation.
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ** GNU General Public License for more details.
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program; if not, write to the Free Software
22 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 ******************************************************************************/
25 * sdf-1.c Filter a single SDF file
35 static struct option my_options[] =
37 {"invert", 0, 0, O_INVERT},
38 {"verbose", 0, 0, O_VERBOSE},
39 {"help", 0, 0, O_HELP},
40 {"version", 0, 0, O_VERSION},
45 usage (const char *program)
47 fprintf(stdout, "usage: %s infile outfile [OPTIONS]\n", kbasename(program));
48 fprintf(stdout, "Generate a SDF2D file from a SDF2D file\n");
49 fprintf(stdout, "\n");
50 fprintf(stdout, " --invert Invert image\n");
51 fprintf(stdout, " --verbose Verbose modem\n");
52 fprintf(stdout, " --version Print version\n");
53 fprintf(stdout, " --help Print this help message\n");
58 main (int argc, char *const argv[])
69 int c = getopt_long (argc, argv, "", my_options, NULL);
84 fprintf(stdout, "Version %s\n", VERSION);
86 fprintf(stderr, "Unknown version number");
99 if (optind + 2 != argc)
105 in_file = argv[optind];
106 out_file = argv[optind + 1];
112 im_in = image_load (in_file);
113 im_out = image_create (out_file, im_in->nx, im_in->ny);
115 for (ix = 0; ix < im_in->nx; ix++)
116 for (iy = 0; iy < im_in->ny; iy++)
117 im_out->v[ix][iy] = - im_in->v[ix][iy];