SDDSlib
Loading...
Searching...
No Matches
sddsimageprofiles.c
Go to the documentation of this file.
1/**
2 * @file sddsimageprofiles.c
3 * @brief Analyze images stored as horizontal lines (one per column) based on the ideas of B-X Yang.
4 *
5 * This program processes image data stored in SDDS (Self Describing Data Set) format,
6 * allowing for various profile analyses such as center line, integrated, averaged, or peak profiles.
7 * It can handle background subtraction and define specific areas of interest within the image.
8 *
9 * ## Usage
10 * ```
11 * sddsimageprofiles [<inputfile>] [<outputfile>]
12 * -pipe=[input][,output]
13 * -columnPrefix=<prefix>
14 * -profileType={x|y}
15 * -method={centerLine|integrated|averaged|peak}
16 * -background=<filename>
17 * -areaOfInterest=<rowStart>,<rowEnd>,<columnStart>,<columnEnd>
18 * ```
19 *
20 * ## Options
21 * - `-pipe=[input][,output]`:
22 * - `-columnPrefix=<prefix>`:
23 * - `-profileType={x|y}`:
24 * - `-method={centerLine|integrated|averaged|peak}`:
25 * - `-background=<filename>`:
26 * - `-areaOfInterest=<rowStart>,<rowEnd>,<columnStart>,<columnEnd>`:
27 *
28 * @copyright
29 * - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
30 * - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
31 *
32 * @license
33 * This file is distributed under the terms of the Software License Agreement
34 * found in the file LICENSE included with this distribution.
35 *
36 * @author R. Soliday, Xuesong Jiao
37 */
38
39#include "mdb.h"
40#include "SDDS.h"
41#include "scan.h"
42
43/* Enumeration for option types */
44enum option_type {
45 SET_PIPE,
46 SET_PROFILETYPE,
47 SET_COLPREFIX,
48 SET_METHOD,
49 SET_AREAOFINTEREST,
50 SET_BACKGROUND,
51 N_OPTIONS,
52};
53
54char *option[N_OPTIONS] = {
55 "pipe", "profileType", "columnPrefix",
56 "method", "areaOfInterest", "background"};
57
58char *USAGE =
59 "Usage: sddsimageprofiles [<inputfile>] [<outputfile>]\n"
60 "Options:\n"
61 " -pipe=[input][,output] Specify input and/or output via pipe.\n"
62 " -columnPrefix=<prefix> Set the column prefix.\n"
63 " -profileType={x|y} Choose profile type: 'x' or 'y'.\n"
64 " -method={centerLine|integrated|averaged|peak} Select the method for profile analysis.\n"
65 " -background=<filename> Specify a background image file.\n"
66 " -areaOfInterest=<rowStart>,<rowEnd>,<columnStart>,<columnEnd> Define the area of interest.\n\n"
67 "Program by Robert Soliday. (\"" __DATE__ " " __TIME__ "\", SVN revision: " SVN_VERSION ")\n\n"
68 "-method:\n"
69 " If this option is not specified, it is a real profile.\n"
70 " If centerLine is specified, it will find the row with the\n"
71 " greatest integrated profile and display that line only.\n"
72 " If integrated is specified, it will sum all the profiles\n"
73 " together. If averaged is specified, it will divide the sum\n"
74 " of all the profiles by the number of profiles. If peak is\n"
75 " specified, it will find the peak point and display the profile\n"
76 " for that row.\n";
77
78typedef struct {
79 short *shortData;
80 unsigned short *ushortData;
81 int32_t *longData;
82 uint32_t *ulongData;
83 int64_t *long64Data;
84 uint64_t *ulong64Data;
85 float *floatData;
86 double *doubleData;
88
89int xImageProfile(IMAGE_DATA *data, int32_t *type, int64_t rows, SDDS_DATASET *SDDS_dataset,
90 long method, int64_t x1, int64_t x2, long y1, long y2, long *colIndex, double *colIndex2);
91
92int yImageProfile(IMAGE_DATA *data, int32_t *type, int64_t rows, SDDS_DATASET *SDDS_dataset,
93 long method, int64_t x1, int64_t x2, long y1, long y2, long *colIndex, double *colIndex2);
94
95int64_t xPeakLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2);
96
97long yPeakLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2);
98
99int64_t xCenterLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2);
100
101long yCenterLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2);
102
103int64_t GetData(SDDS_DATASET *SDDS_orig, char *input, IMAGE_DATA **data, int32_t **type, long **colIndex,
104 double **colIndex2, char *colPrefix, long *validColumns);
105
106int main(int argc, char **argv) {
107 SDDS_DATASET SDDS_dataset, SDDS_orig, SDDS_bg;
108 long i_arg;
109 SCANNED_ARG *s_arg;
110 IMAGE_DATA *data = NULL, *bg_data = NULL;
111 char *input = NULL, *output = NULL, *colPrefix = NULL, *background = NULL;
112 long profileType = 1, noWarnings = 0, tmpfile_used = 0, method = 0;
113 unsigned long pipeFlags = 0;
114 int64_t rows, bg_rows, j;
115 long i, validColumns = 0, bg_validColumns = 0;
116 int32_t *type = NULL, *bg_type = NULL;
117
118 int64_t rowStart = 1, rowEnd = 0;
119 long columnStart = 1, columnEnd = 0;
120
121 long *colIndex, *bg_colIndex;
122 double *colIndex2, *bg_colIndex2;
123
125 argc = scanargs(&s_arg, argc, argv);
126
127 if (argc < 3)
128 bomb(NULL, USAGE);
129
130 for (i_arg = 1; i_arg < argc; i_arg++) {
131 if (s_arg[i_arg].arg_type == OPTION) {
132 switch (match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
133 case SET_PROFILETYPE:
134 if (s_arg[i_arg].n_items != 2)
135 SDDS_Bomb("invalid -profileType syntax");
136 if (strcmp("x", s_arg[i_arg].list[1]) == 0)
137 profileType = 1;
138 if (strcmp("y", s_arg[i_arg].list[1]) == 0)
139 profileType = 2;
140 break;
141 case SET_COLPREFIX:
142 if (s_arg[i_arg].n_items != 2)
143 SDDS_Bomb("invalid -columnPrefix syntax");
144 colPrefix = s_arg[i_arg].list[1];
145 break;
146 case SET_METHOD:
147 if (s_arg[i_arg].n_items != 2)
148 SDDS_Bomb("invalid -method syntax");
149 if ((strncasecmp("centralLine", s_arg[i_arg].list[1], strlen(s_arg[i_arg].list[1])) == 0) ||
150 (strncasecmp("centerLine", s_arg[i_arg].list[1], strlen(s_arg[i_arg].list[1])) == 0))
151 method = 1;
152 if (strncasecmp("integrated", s_arg[i_arg].list[1], strlen(s_arg[i_arg].list[1])) == 0)
153 method = 2;
154 if (strncasecmp("averaged", s_arg[i_arg].list[1], strlen(s_arg[i_arg].list[1])) == 0)
155 method = 3;
156 if (strncasecmp("peak", s_arg[i_arg].list[1], strlen(s_arg[i_arg].list[1])) == 0)
157 method = 4;
158 break;
159 case SET_AREAOFINTEREST:
160 if (s_arg[i_arg].n_items != 5)
161 SDDS_Bomb("invalid -areaOfInterest syntax");
162 if (sscanf(s_arg[i_arg].list[1], "%" SCNd64, &rowStart) != 1 || rowStart <= 0)
163 SDDS_Bomb("invalid -areaOfInterest syntax or value");
164 if (sscanf(s_arg[i_arg].list[2], "%" SCNd64, &rowEnd) != 1 || rowEnd <= 0)
165 SDDS_Bomb("invalid -areaOfInterest syntax or value");
166 if (sscanf(s_arg[i_arg].list[3], "%ld", &columnStart) != 1 || columnStart <= 0)
167 SDDS_Bomb("invalid -areaOfInterest syntax or value");
168 if (sscanf(s_arg[i_arg].list[4], "%ld", &columnEnd) != 1 || columnEnd <= 0)
169 SDDS_Bomb("invalid -areaOfInterest syntax or value");
170 break;
171 case SET_BACKGROUND:
172 if (s_arg[i_arg].n_items != 2)
173 SDDS_Bomb("invalid -background syntax");
174 background = s_arg[i_arg].list[1];
175 break;
176 case SET_PIPE:
177 if (!processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags))
178 SDDS_Bomb("invalid -pipe syntax");
179 break;
180 default:
181 fprintf(stderr, "error: unknown switch: %s\n", s_arg[i_arg].list[0]);
182 exit(EXIT_FAILURE);
183 break;
184 }
185 } else {
186 if (input == NULL)
187 input = s_arg[i_arg].list[0];
188 else if (output == NULL)
189 output = s_arg[i_arg].list[0];
190 else
191 SDDS_Bomb("too many filenames");
192 }
193 }
194
195 if (colPrefix == NULL) {
196 fprintf(stderr, "error: missing columnPrefix\n");
197 exit(EXIT_FAILURE);
198 }
199
200 processFilenames("sddsimageprofiles", &input, &output, pipeFlags, noWarnings, &tmpfile_used);
201
202 /* Read in the image file */
203 rows = GetData(&SDDS_orig, input, &data, &type, &colIndex, &colIndex2, colPrefix, &validColumns);
204
205 if (rows < 0) {
206 fprintf(stderr, "error: no rows in image file\n");
207 exit(EXIT_FAILURE);
208 }
209
210 if (background != NULL) {
211 /* Read in the background image file */
212 bg_rows = GetData(&SDDS_bg, background, &bg_data, &bg_type, &bg_colIndex, &bg_colIndex2, colPrefix, &bg_validColumns);
213 if (rows != bg_rows) {
214 fprintf(stderr, "error: background has a different number of rows\n");
215 exit(EXIT_FAILURE);
216 }
217 if (validColumns != bg_validColumns) {
218 fprintf(stderr, "error: background has a different number of columns\n");
219 exit(EXIT_FAILURE);
220 }
221 /* Subtract the background from the image file */
222 for (i = 0; i < validColumns; i++) {
223 if (type[colIndex[i]] != bg_type[bg_colIndex[i]]) {
224 fprintf(stderr, "error: column types don't match with background image\n");
225 exit(EXIT_FAILURE);
226 }
227 if (colIndex2[i] != bg_colIndex2[i]) {
228 fprintf(stderr, "error: image rows don't match with background image\n");
229 exit(EXIT_FAILURE);
230 }
231 switch (type[colIndex[i]]) {
232 case SDDS_SHORT:
233 for (j = 0; j < rows; j++)
234 data[colIndex[i]].shortData[j] -= bg_data[bg_colIndex[i]].shortData[j];
235 break;
236 case SDDS_USHORT:
237 for (j = 0; j < rows; j++)
238 data[colIndex[i]].ushortData[j] -= bg_data[bg_colIndex[i]].ushortData[j];
239 break;
240 case SDDS_LONG:
241 for (j = 0; j < rows; j++)
242 data[colIndex[i]].longData[j] -= bg_data[bg_colIndex[i]].longData[j];
243 break;
244 case SDDS_ULONG:
245 for (j = 0; j < rows; j++)
246 data[colIndex[i]].ulongData[j] -= bg_data[bg_colIndex[i]].ulongData[j];
247 break;
248 case SDDS_LONG64:
249 for (j = 0; j < rows; j++)
250 data[colIndex[i]].long64Data[j] -= bg_data[bg_colIndex[i]].long64Data[j];
251 break;
252 case SDDS_ULONG64:
253 for (j = 0; j < rows; j++)
254 data[colIndex[i]].ulong64Data[j] -= bg_data[bg_colIndex[i]].ulong64Data[j];
255 break;
256 case SDDS_FLOAT:
257 for (j = 0; j < rows; j++)
258 data[colIndex[i]].floatData[j] -= bg_data[bg_colIndex[i]].floatData[j];
259 break;
260 case SDDS_DOUBLE:
261 for (j = 0; j < rows; j++)
262 data[colIndex[i]].doubleData[j] -= bg_data[bg_colIndex[i]].doubleData[j];
263 break;
264 default:
265 continue;
266 }
267 }
268 }
269
270 /* Initialize the output file and define the columns */
271 if (!SDDS_InitializeOutput(&SDDS_dataset, SDDS_ASCII, 1, NULL, NULL, output)) {
272 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
273 exit(EXIT_FAILURE);
274 }
275
276 if (profileType == 1) {
277 if (SDDS_DefineParameter(&SDDS_dataset, "Zone", NULL, NULL, NULL, NULL, SDDS_STRING, 0) == -1) {
278 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
279 exit(EXIT_FAILURE);
280 }
281 if (SDDS_DefineColumn(&SDDS_dataset, "x", NULL, NULL, NULL, NULL, SDDS_LONG64, 0) == -1) {
282 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
283 exit(EXIT_FAILURE);
284 }
285 if (SDDS_DefineColumn(&SDDS_dataset, "y", NULL, NULL, NULL, NULL, SDDS_DOUBLE, 0) == -1) {
286 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
287 exit(EXIT_FAILURE);
288 }
289 } else {
290 if (SDDS_DefineParameter(&SDDS_dataset, "Zone", NULL, NULL, NULL, NULL, SDDS_STRING, 0) == -1) {
291 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
292 exit(EXIT_FAILURE);
293 }
294 if (SDDS_DefineColumn(&SDDS_dataset, "x", NULL, NULL, NULL, NULL, SDDS_DOUBLE, 0) == -1) {
295 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
296 exit(EXIT_FAILURE);
297 }
298 if (SDDS_DefineColumn(&SDDS_dataset, "y", NULL, NULL, NULL, NULL, SDDS_DOUBLE, 0) == -1) {
299 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
300 exit(EXIT_FAILURE);
301 }
302 }
303 if (SDDS_WriteLayout(&SDDS_dataset) == 0) {
304 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
305 exit(EXIT_FAILURE);
306 }
307
308 if ((rowEnd > rows) || (rowEnd < rowStart))
309 rowEnd = rows;
310
311 if ((columnEnd > validColumns) || (columnEnd < columnStart))
312 columnEnd = validColumns;
313
314 if (profileType == 1) {
315 xImageProfile(data, type, rows, &SDDS_dataset, method, rowStart - 1, rowEnd, columnStart - 1, columnEnd, colIndex, colIndex2);
316 } else {
317 yImageProfile(data, type, rows, &SDDS_dataset, method, rowStart - 1, rowEnd, columnStart - 1, columnEnd, colIndex, colIndex2);
318 }
319
320 /* Close the output file */
321 if (SDDS_Terminate(&SDDS_dataset) != 1) {
322 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
323 exit(EXIT_FAILURE);
324 }
325
326 for (i = 0; i < validColumns; i++) {
327 switch (type[colIndex[i]]) {
328 case SDDS_SHORT:
329 free(data[colIndex[i]].shortData);
330 break;
331 case SDDS_USHORT:
332 free(data[colIndex[i]].ushortData);
333 break;
334 case SDDS_LONG:
335 free(data[colIndex[i]].longData);
336 break;
337 case SDDS_ULONG:
338 free(data[colIndex[i]].ulongData);
339 break;
340 case SDDS_LONG64:
341 free(data[colIndex[i]].long64Data);
342 break;
343 case SDDS_ULONG64:
344 free(data[colIndex[i]].ulong64Data);
345 break;
346 case SDDS_FLOAT:
347 free(data[colIndex[i]].floatData);
348 break;
349 case SDDS_DOUBLE:
350 free(data[colIndex[i]].doubleData);
351 break;
352 default:
353 continue;
354 }
355 }
356 free(data);
357 free(type);
358 if (background != NULL) {
359 for (i = 0; i < validColumns; i++) {
360 switch (bg_type[bg_colIndex[i]]) {
361 case SDDS_SHORT:
362 free(bg_data[bg_colIndex[i]].shortData);
363 break;
364 case SDDS_USHORT:
365 free(bg_data[bg_colIndex[i]].ushortData);
366 break;
367 case SDDS_LONG:
368 free(bg_data[bg_colIndex[i]].longData);
369 break;
370 case SDDS_ULONG:
371 free(bg_data[bg_colIndex[i]].ulongData);
372 break;
373 case SDDS_LONG64:
374 free(bg_data[bg_colIndex[i]].long64Data);
375 break;
376 case SDDS_ULONG64:
377 free(bg_data[bg_colIndex[i]].ulong64Data);
378 break;
379 case SDDS_FLOAT:
380 free(bg_data[bg_colIndex[i]].floatData);
381 break;
382 case SDDS_DOUBLE:
383 free(bg_data[bg_colIndex[i]].doubleData);
384 break;
385 default:
386 continue;
387 }
388 }
389 free(bg_data);
390 free(bg_type);
391 }
392
393 return EXIT_SUCCESS;
394}
395
396int xImageProfile(IMAGE_DATA *data, int32_t *type, int64_t rows, SDDS_DATASET *SDDS_dataset, long method,
397 int64_t x1, int64_t x2, long y1, long y2, long *colIndex, double *colIndex2) {
398 int64_t i, k = 0;
399 int j;
400 double val = 0;
401 long center;
402 int64_t *index;
403 double *values;
404 char value[100];
405 index = malloc(sizeof(int64_t) * rows);
406 values = malloc(sizeof(double) * rows);
407
408 if (method == 0) { /* Highest point */
409 for (i = x1; i < x2; i++) {
410 switch (type[colIndex[y1]]) {
411 case SDDS_SHORT:
412 val = data[colIndex[y1]].shortData[i];
413 break;
414 case SDDS_USHORT:
415 val = data[colIndex[y1]].ushortData[i];
416 break;
417 case SDDS_LONG:
418 val = data[colIndex[y1]].longData[i];
419 break;
420 case SDDS_ULONG:
421 val = data[colIndex[y1]].ulongData[i];
422 break;
423 case SDDS_LONG64:
424 val = data[colIndex[y1]].long64Data[i];
425 break;
426 case SDDS_ULONG64:
427 val = data[colIndex[y1]].ulong64Data[i];
428 break;
429 case SDDS_FLOAT:
430 val = data[colIndex[y1]].floatData[i];
431 break;
432 case SDDS_DOUBLE:
433 val = data[colIndex[y1]].doubleData[i];
434 break;
435 }
436 for (j = y1 + 1; j < y2; j++) {
437 switch (type[colIndex[j]]) {
438 case SDDS_SHORT:
439 if (val < data[colIndex[j]].shortData[i])
440 val = data[colIndex[j]].shortData[i];
441 break;
442 case SDDS_USHORT:
443 if (val < data[colIndex[j]].ushortData[i])
444 val = data[colIndex[j]].ushortData[i];
445 break;
446 case SDDS_LONG:
447 if (val < data[colIndex[j]].longData[i])
448 val = data[colIndex[j]].longData[i];
449 break;
450 case SDDS_ULONG:
451 if (val < data[colIndex[j]].ulongData[i])
452 val = data[colIndex[j]].ulongData[i];
453 break;
454 case SDDS_LONG64:
455 if (val < data[colIndex[j]].long64Data[i])
456 val = data[colIndex[j]].long64Data[i];
457 break;
458 case SDDS_ULONG64:
459 if (val < data[colIndex[j]].ulong64Data[i])
460 val = data[colIndex[j]].ulong64Data[i];
461 break;
462 case SDDS_FLOAT:
463 if (val < data[colIndex[j]].floatData[i])
464 val = data[colIndex[j]].floatData[i];
465 break;
466 case SDDS_DOUBLE:
467 if (val < data[colIndex[j]].doubleData[i])
468 val = data[colIndex[j]].doubleData[i];
469 break;
470 }
471 }
472 index[k] = i + 1;
473 values[k] = val;
474 k++;
475 }
476 } else if ((method == 1) || (method == 4)) { /* Center line or peak */
477 if (method == 4) {
478 center = yPeakLine(data, type, colIndex, x1, x2, y1, y2);
479 } else {
480 center = yCenterLine(data, type, colIndex, x1, x2, y1, y2);
481 }
482 for (i = x1; i < x2; i++) {
483 switch (type[colIndex[center]]) {
484 case SDDS_SHORT:
485 val = data[colIndex[center]].shortData[i];
486 break;
487 case SDDS_USHORT:
488 val = data[colIndex[center]].ushortData[i];
489 break;
490 case SDDS_LONG:
491 val = data[colIndex[center]].longData[i];
492 break;
493 case SDDS_ULONG:
494 val = data[colIndex[center]].ulongData[i];
495 break;
496 case SDDS_LONG64:
497 val = data[colIndex[center]].long64Data[i];
498 break;
499 case SDDS_ULONG64:
500 val = data[colIndex[center]].ulong64Data[i];
501 break;
502 case SDDS_FLOAT:
503 val = data[colIndex[center]].floatData[i];
504 break;
505 case SDDS_DOUBLE:
506 val = data[colIndex[center]].doubleData[i];
507 break;
508 }
509 index[k] = i + 1;
510 values[k] = val;
511 k++;
512 }
513 } else if ((method == 2) || (method == 3)) { /* Integrated or Averaged profile */
514 for (i = x1; i < x2; i++) {
515 val = 0;
516 for (j = y1; j < y2; j++) {
517 switch (type[colIndex[j]]) {
518 case SDDS_SHORT:
519 val += data[colIndex[j]].shortData[i];
520 break;
521 case SDDS_USHORT:
522 val += data[colIndex[j]].ushortData[i];
523 break;
524 case SDDS_LONG:
525 val += data[colIndex[j]].longData[i];
526 break;
527 case SDDS_ULONG:
528 val += data[colIndex[j]].ulongData[i];
529 break;
530 case SDDS_LONG64:
531 val += data[colIndex[j]].long64Data[i];
532 break;
533 case SDDS_ULONG64:
534 val += data[colIndex[j]].ulong64Data[i];
535 break;
536 case SDDS_FLOAT:
537 val += data[colIndex[j]].floatData[i];
538 break;
539 case SDDS_DOUBLE:
540 val += data[colIndex[j]].doubleData[i];
541 break;
542 }
543 }
544 index[k] = i + 1;
545 if (method == 2)
546 values[k] = val;
547 else
548 values[k] = val / (y2 - y1);
549 k++;
550 }
551 }
552
553 if (SDDS_StartPage(SDDS_dataset, x2 - x1) == 0) {
554 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
555 exit(EXIT_FAILURE);
556 }
557 sprintf(value, "(%" PRId64 ",%ld) x (%" PRId64 ",%ld)", x1 + 1, y1 + 1, x2, y2);
558 if (SDDS_SetParameters(SDDS_dataset, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, "Zone", value, NULL) != 1) {
559 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
560 exit(EXIT_FAILURE);
561 }
562 if (SDDS_SetColumn(SDDS_dataset, SDDS_SET_BY_NAME, index, k, "x", NULL) != 1) {
563 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
564 exit(EXIT_FAILURE);
565 }
566 if (SDDS_SetColumn(SDDS_dataset, SDDS_SET_BY_NAME, values, k, "y", NULL) != 1) {
567 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
568 exit(EXIT_FAILURE);
569 }
570 if (SDDS_WritePage(SDDS_dataset) != 1) {
571 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
572 exit(EXIT_FAILURE);
573 }
574 free(index);
575 free(values);
576 return 0;
577}
578
579int yImageProfile(IMAGE_DATA *data, int32_t *type, int64_t rows, SDDS_DATASET *SDDS_dataset, long method,
580 int64_t x1, int64_t x2, long y1, long y2, long *colIndex, double *colIndex2) {
581 int i, k = 0;
582 int64_t j;
583 double val;
584 int64_t center;
585
586 double *index;
587 double *values;
588 char value[100];
589
590 index = malloc(sizeof(double) * (y2 - y1));
591 values = malloc(sizeof(double) * (y2 - y1));
592
593 if (method == 0) { /* Highest point */
594 for (i = y1; i < y2; i++) {
595 switch (type[colIndex[i]]) {
596 case SDDS_SHORT:
597 val = data[colIndex[i]].shortData[x1];
598 break;
599 case SDDS_USHORT:
600 val = data[colIndex[i]].ushortData[x1];
601 break;
602 case SDDS_LONG:
603 val = data[colIndex[i]].longData[x1];
604 break;
605 case SDDS_ULONG:
606 val = data[colIndex[i]].ulongData[x1];
607 break;
608 case SDDS_LONG64:
609 val = data[colIndex[i]].long64Data[x1];
610 break;
611 case SDDS_ULONG64:
612 val = data[colIndex[i]].ulong64Data[x1];
613 break;
614 case SDDS_FLOAT:
615 val = data[colIndex[i]].floatData[x1];
616 break;
617 case SDDS_DOUBLE:
618 val = data[colIndex[i]].doubleData[x1];
619 break;
620 default:
621 continue;
622 }
623 for (j = x1 + 1; j < x2; j++) {
624 switch (type[colIndex[i]]) {
625 case SDDS_SHORT:
626 if (val < data[colIndex[i]].shortData[j]) {
627 val = data[colIndex[i]].shortData[j];
628 }
629 break;
630 case SDDS_USHORT:
631 if (val < data[colIndex[i]].ushortData[j]) {
632 val = data[colIndex[i]].ushortData[j];
633 }
634 break;
635 case SDDS_LONG:
636 if (val < data[colIndex[i]].longData[j]) {
637 val = data[colIndex[i]].longData[j];
638 }
639 break;
640 case SDDS_ULONG:
641 if (val < data[colIndex[i]].ulongData[j]) {
642 val = data[colIndex[i]].ulongData[j];
643 }
644 break;
645 case SDDS_LONG64:
646 if (val < data[colIndex[i]].long64Data[j]) {
647 val = data[colIndex[i]].long64Data[j];
648 }
649 break;
650 case SDDS_ULONG64:
651 if (val < data[colIndex[i]].ulong64Data[j]) {
652 val = data[colIndex[i]].ulong64Data[j];
653 }
654 break;
655 case SDDS_FLOAT:
656 if (val < data[colIndex[i]].floatData[j]) {
657 val = data[colIndex[i]].floatData[j];
658 }
659 break;
660 case SDDS_DOUBLE:
661 if (val < data[colIndex[i]].doubleData[j]) {
662 val = data[colIndex[i]].doubleData[j];
663 }
664 break;
665 default:
666 continue;
667 }
668 }
669 index[k] = colIndex2[i];
670 values[k] = val;
671 k++;
672 }
673 } else if ((method == 1) || (method == 4)) { /* Center line or peak */
674 if (method == 4) {
675 center = xPeakLine(data, type, colIndex, x1, x2, y1, y2);
676 } else {
677 center = xCenterLine(data, type, colIndex, x1, x2, y1, y2);
678 }
679 for (i = y1; i < y2; i++) {
680 switch (type[colIndex[i]]) {
681 case SDDS_SHORT:
682 val = data[colIndex[i]].shortData[center];
683 break;
684 case SDDS_USHORT:
685 val = data[colIndex[i]].ushortData[center];
686 break;
687 case SDDS_LONG:
688 val = data[colIndex[i]].longData[center];
689 break;
690 case SDDS_ULONG:
691 val = data[colIndex[i]].ulongData[center];
692 break;
693 case SDDS_LONG64:
694 val = data[colIndex[i]].long64Data[center];
695 break;
696 case SDDS_ULONG64:
697 val = data[colIndex[i]].ulong64Data[center];
698 break;
699 case SDDS_FLOAT:
700 val = data[colIndex[i]].floatData[center];
701 break;
702 case SDDS_DOUBLE:
703 val = data[colIndex[i]].doubleData[center];
704 break;
705 default:
706 continue;
707 }
708 index[k] = colIndex2[i];
709 values[k] = val;
710 k++;
711 }
712 } else if ((method == 2) || (method == 3)) { /* Integrated or Averaged profile */
713 for (i = y1; i < y2; i++) {
714 val = 0;
715 switch (type[colIndex[i]]) {
716 case SDDS_SHORT:
717 for (j = x1; j < x2; j++)
718 val += data[colIndex[i]].shortData[j];
719 break;
720 case SDDS_USHORT:
721 for (j = x1; j < x2; j++)
722 val += data[colIndex[i]].ushortData[j];
723 break;
724 case SDDS_LONG:
725 for (j = x1; j < x2; j++)
726 val += data[colIndex[i]].longData[j];
727 break;
728 case SDDS_ULONG:
729 for (j = x1; j < x2; j++)
730 val += data[colIndex[i]].ulongData[j];
731 break;
732 case SDDS_LONG64:
733 for (j = x1; j < x2; j++)
734 val += data[colIndex[i]].long64Data[j];
735 break;
736 case SDDS_ULONG64:
737 for (j = x1; j < x2; j++)
738 val += data[colIndex[i]].ulong64Data[j];
739 break;
740 case SDDS_FLOAT:
741 for (j = x1; j < x2; j++)
742 val += data[colIndex[i]].floatData[j];
743 break;
744 case SDDS_DOUBLE:
745 for (j = x1; j < x2; j++)
746 val += data[colIndex[i]].doubleData[j];
747 break;
748 default:
749 continue;
750 }
751 index[k] = colIndex2[i];
752 if (method == 2)
753 values[k] = val;
754 else
755 values[k] = val / (x2 - x1);
756 k++;
757 }
758 }
759
760 if (SDDS_StartPage(SDDS_dataset, k) == 0) {
761 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
762 exit(EXIT_FAILURE);
763 }
764 sprintf(value, "(%" PRId64 ",%ld) x (%" PRId64 ",%ld)", x1 + 1, y1 + 1, x2, y2);
765 if (SDDS_SetParameters(SDDS_dataset, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, "Zone", value, NULL) != 1) {
766 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
767 exit(EXIT_FAILURE);
768 }
769 if (SDDS_SetColumn(SDDS_dataset, SDDS_SET_BY_NAME, index, k, "y", NULL) != 1) {
770 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
771 exit(EXIT_FAILURE);
772 }
773 if (SDDS_SetColumn(SDDS_dataset, SDDS_SET_BY_NAME, values, k, "x", NULL) != 1) {
774 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
775 exit(EXIT_FAILURE);
776 }
777 if (SDDS_WritePage(SDDS_dataset) != 1) {
778 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
779 exit(EXIT_FAILURE);
780 }
781 free(index);
782 free(values);
783 return 0;
784}
785
786int64_t xPeakLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2) {
787 int64_t i, j;
788 double maxValue = 0;
789 int64_t index = 0;
790
791 index = x1;
792 switch (type[colIndex[y1]]) {
793 case SDDS_SHORT:
794 maxValue = data[colIndex[y1]].shortData[x1];
795 break;
796 case SDDS_USHORT:
797 maxValue = data[colIndex[y1]].ushortData[x1];
798 break;
799 case SDDS_LONG:
800 maxValue = data[colIndex[y1]].longData[x1];
801 break;
802 case SDDS_ULONG:
803 maxValue = data[colIndex[y1]].ulongData[x1];
804 break;
805 case SDDS_LONG64:
806 maxValue = data[colIndex[y1]].long64Data[x1];
807 break;
808 case SDDS_ULONG64:
809 maxValue = data[colIndex[y1]].ulong64Data[x1];
810 break;
811 case SDDS_FLOAT:
812 maxValue = data[colIndex[y1]].floatData[x1];
813 break;
814 case SDDS_DOUBLE:
815 maxValue = data[colIndex[y1]].doubleData[x1];
816 break;
817 }
818 for (i = y1; i < y2; i++) {
819 for (j = x1; j < x2; j++) {
820 switch (type[colIndex[i]]) {
821 case SDDS_SHORT:
822 if (maxValue < data[colIndex[i]].shortData[j]) {
823 maxValue = data[colIndex[i]].shortData[j];
824 index = j;
825 }
826 break;
827 case SDDS_USHORT:
828 if (maxValue < data[colIndex[i]].ushortData[j]) {
829 maxValue = data[colIndex[i]].ushortData[j];
830 index = j;
831 }
832 break;
833 case SDDS_LONG:
834 if (maxValue < data[colIndex[i]].longData[j]) {
835 maxValue = data[colIndex[i]].longData[j];
836 index = j;
837 }
838 break;
839 case SDDS_ULONG:
840 if (maxValue < data[colIndex[i]].ulongData[j]) {
841 maxValue = data[colIndex[i]].ulongData[j];
842 index = j;
843 }
844 break;
845 case SDDS_LONG64:
846 if (maxValue < data[colIndex[i]].long64Data[j]) {
847 maxValue = data[colIndex[i]].long64Data[j];
848 index = j;
849 }
850 break;
851 case SDDS_ULONG64:
852 if (maxValue < data[colIndex[i]].ulong64Data[j]) {
853 maxValue = data[colIndex[i]].ulong64Data[j];
854 index = j;
855 }
856 break;
857 case SDDS_FLOAT:
858 if (maxValue < data[colIndex[i]].floatData[j]) {
859 maxValue = data[colIndex[i]].floatData[j];
860 index = j;
861 }
862 break;
863 case SDDS_DOUBLE:
864 if (maxValue < data[colIndex[i]].doubleData[j]) {
865 maxValue = data[colIndex[i]].doubleData[j];
866 index = j;
867 }
868 break;
869 }
870 }
871 }
872 return index;
873}
874
875long yPeakLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2) {
876 int i;
877 int64_t j;
878 double maxValue = 0;
879 long index = 0;
880
881 index = y1;
882 switch (type[colIndex[y1]]) {
883 case SDDS_SHORT:
884 maxValue = data[colIndex[y1]].shortData[x1];
885 break;
886 case SDDS_USHORT:
887 maxValue = data[colIndex[y1]].ushortData[x1];
888 break;
889 case SDDS_LONG:
890 maxValue = data[colIndex[y1]].longData[x1];
891 break;
892 case SDDS_ULONG:
893 maxValue = data[colIndex[y1]].ulongData[x1];
894 break;
895 case SDDS_LONG64:
896 maxValue = data[colIndex[y1]].long64Data[x1];
897 break;
898 case SDDS_ULONG64:
899 maxValue = data[colIndex[y1]].ulong64Data[x1];
900 break;
901 case SDDS_FLOAT:
902 maxValue = data[colIndex[y1]].floatData[x1];
903 break;
904 case SDDS_DOUBLE:
905 maxValue = data[colIndex[y1]].doubleData[x1];
906 break;
907 }
908 for (i = y1; i < y2; i++) {
909 for (j = x1; j < x2; j++) {
910 switch (type[colIndex[i]]) {
911 case SDDS_SHORT:
912 if (maxValue < data[colIndex[i]].shortData[j]) {
913 maxValue = data[colIndex[i]].shortData[j];
914 index = i;
915 }
916 break;
917 case SDDS_USHORT:
918 if (maxValue < data[colIndex[i]].ushortData[j]) {
919 maxValue = data[colIndex[i]].ushortData[j];
920 index = i;
921 }
922 break;
923 case SDDS_LONG:
924 if (maxValue < data[colIndex[i]].longData[j]) {
925 maxValue = data[colIndex[i]].longData[j];
926 index = i;
927 }
928 break;
929 case SDDS_ULONG:
930 if (maxValue < data[colIndex[i]].ulongData[j]) {
931 maxValue = data[colIndex[i]].ulongData[j];
932 index = i;
933 }
934 break;
935 case SDDS_LONG64:
936 if (maxValue < data[colIndex[i]].long64Data[j]) {
937 maxValue = data[colIndex[i]].long64Data[j];
938 index = i;
939 }
940 break;
941 case SDDS_ULONG64:
942 if (maxValue < data[colIndex[i]].ulong64Data[j]) {
943 maxValue = data[colIndex[i]].ulong64Data[j];
944 index = i;
945 }
946 break;
947 case SDDS_FLOAT:
948 if (maxValue < data[colIndex[i]].floatData[j]) {
949 maxValue = data[colIndex[i]].floatData[j];
950 index = i;
951 }
952 break;
953 case SDDS_DOUBLE:
954 if (maxValue < data[colIndex[i]].doubleData[j]) {
955 maxValue = data[colIndex[i]].doubleData[j];
956 index = i;
957 }
958 break;
959 }
960 }
961 }
962 return index;
963}
964
965int64_t xCenterLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2) {
966 int64_t i, j, start = 1;
967 double val = 0, maxValue = 0;
968 int64_t index = 0;
969
970 for (i = x1; i < x2; i++) {
971 val = 0;
972 for (j = y1; j < y2; j++) {
973 switch (type[colIndex[j]]) {
974 case SDDS_SHORT:
975 val += data[colIndex[j]].shortData[i];
976 break;
977 case SDDS_USHORT:
978 val += data[colIndex[j]].ushortData[i];
979 break;
980 case SDDS_LONG:
981 val += data[colIndex[j]].longData[i];
982 break;
983 case SDDS_ULONG:
984 val += data[colIndex[j]].ulongData[i];
985 break;
986 case SDDS_LONG64:
987 val += data[colIndex[j]].long64Data[i];
988 break;
989 case SDDS_ULONG64:
990 val += data[colIndex[j]].ulong64Data[i];
991 break;
992 case SDDS_FLOAT:
993 val += data[colIndex[j]].floatData[i];
994 break;
995 case SDDS_DOUBLE:
996 val += data[colIndex[j]].doubleData[i];
997 break;
998 }
999 }
1000 if (start == 1) {
1001 index = i;
1002 maxValue = val;
1003 start = 0;
1004 } else {
1005 if (val > maxValue) {
1006 index = i;
1007 maxValue = val;
1008 }
1009 }
1010 }
1011 return index;
1012}
1013
1014long yCenterLine(IMAGE_DATA *data, int32_t *type, long *colIndex, int64_t x1, int64_t x2, long y1, long y2) {
1015 int i, start = 1;
1016 int64_t j;
1017 double val, maxValue = 0;
1018 long index = 0;
1019
1020 for (i = y1; i < y2; i++) {
1021 val = 0;
1022 for (j = x1; j < x2; j++)
1023 switch (type[colIndex[i]]) {
1024 case SDDS_SHORT:
1025 val += data[colIndex[i]].shortData[j];
1026 break;
1027 case SDDS_USHORT:
1028 val += data[colIndex[i]].ushortData[j];
1029 break;
1030 case SDDS_LONG:
1031 val += data[colIndex[i]].longData[j];
1032 break;
1033 case SDDS_ULONG:
1034 val += data[colIndex[i]].ulongData[j];
1035 break;
1036 case SDDS_LONG64:
1037 val += data[colIndex[i]].long64Data[j];
1038 break;
1039 case SDDS_ULONG64:
1040 val += data[colIndex[i]].ulong64Data[j];
1041 break;
1042 case SDDS_FLOAT:
1043 val += data[colIndex[i]].floatData[j];
1044 break;
1045 case SDDS_DOUBLE:
1046 val += data[colIndex[i]].doubleData[j];
1047 break;
1048 default:
1049 continue;
1050 }
1051 if (start == 1) {
1052 index = i;
1053 maxValue = val;
1054 start = 0;
1055 } else {
1056 if (val > maxValue) {
1057 index = i;
1058 maxValue = val;
1059 }
1060 }
1061 }
1062 return index;
1063}
1064
1065int64_t GetData(SDDS_DATASET *SDDS_orig, char *input, IMAGE_DATA **data, int32_t **type, long **colIndex,
1066 double **colIndex2, char *colPrefix, long *validColumns) {
1067 int64_t rows;
1068 long i, j, temp;
1069 double temp2;
1070 int32_t orig_column_names;
1071 char **orig_column_name;
1072
1073 /* Open image file */
1074 if (!SDDS_InitializeInput(SDDS_orig, input)) {
1075 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
1076 exit(EXIT_FAILURE);
1077 }
1078
1079 /* Read column names */
1080 if (!(orig_column_name = SDDS_GetColumnNames(SDDS_orig, &orig_column_names))) {
1081 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
1082 exit(EXIT_FAILURE);
1083 }
1084
1085 /* Allocate memory for image file data */
1086 *data = malloc(sizeof(IMAGE_DATA) * orig_column_names);
1087 *type = malloc(sizeof(int32_t) * orig_column_names);
1088
1089 /* Read page */
1090 if (SDDS_ReadPage(SDDS_orig) != 1) {
1091 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
1092 exit(EXIT_FAILURE);
1093 }
1094
1095 /* Get number of rows */
1096 rows = SDDS_RowCount(SDDS_orig);
1097 *colIndex = malloc(sizeof(long) * orig_column_names);
1098 *colIndex2 = malloc(sizeof(double) * orig_column_names);
1099
1100 /* Read all numerical data from file */
1101 for (i = 0; i < orig_column_names; i++) {
1102 (*type)[i] = SDDS_GetNamedColumnType(SDDS_orig, orig_column_name[i]);
1103 if ((*type)[i] == 0) {
1104 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
1105 exit(EXIT_FAILURE);
1106 }
1107
1108 switch ((*type)[i]) {
1109 case SDDS_SHORT:
1110 (*data)[i].shortData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1111 break;
1112 case SDDS_USHORT:
1113 (*data)[i].ushortData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1114 break;
1115 case SDDS_LONG:
1116 (*data)[i].longData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1117 break;
1118 case SDDS_ULONG:
1119 (*data)[i].ulongData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1120 break;
1121 case SDDS_LONG64:
1122 (*data)[i].long64Data = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1123 break;
1124 case SDDS_ULONG64:
1125 (*data)[i].ulong64Data = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1126 break;
1127 case SDDS_FLOAT:
1128 (*data)[i].floatData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1129 break;
1130 case SDDS_DOUBLE:
1131 (*data)[i].doubleData = SDDS_GetColumn(SDDS_orig, orig_column_name[i]);
1132 break;
1133 default:
1134 continue;
1135 }
1136 if (strncmp(colPrefix, orig_column_name[i], strlen(colPrefix)) != 0) {
1137 continue;
1138 }
1139 (*colIndex)[*validColumns] = i;
1140 *validColumns += 1;
1141 }
1142
1143 if (SDDS_Terminate(SDDS_orig) != 1) {
1144 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
1145 exit(EXIT_FAILURE);
1146 }
1147
1148 if (*validColumns == 0) {
1149 fprintf(stderr, "error: no valid columns in image file\n");
1150 exit(EXIT_FAILURE);
1151 }
1152 /* For each valid column read the row from the column name */
1153 for (i = 0; i < *validColumns; i++) {
1154 (*colIndex2)[i] = atof(orig_column_name[(*colIndex)[i]] + strlen(colPrefix));
1155 }
1156 /* Sort columns by their row value ('row' is not related to the SDDS rows) */
1157 for (i = 0; i < *validColumns; i++) {
1158 for (j = i + 1; j < *validColumns; j++) {
1159 if ((*colIndex2)[j] < (*colIndex2)[i]) {
1160 temp = (*colIndex)[i];
1161 temp2 = (*colIndex2)[i];
1162 (*colIndex)[i] = (*colIndex)[j];
1163 (*colIndex2)[i] = (*colIndex2)[j];
1164 (*colIndex)[j] = temp;
1165 (*colIndex2)[j] = temp2;
1166 }
1167 }
1168 }
1169 return rows;
1170}
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)
int32_t SDDS_SetColumn(SDDS_DATASET *SDDS_dataset, int32_t mode, void *data, int64_t rows,...)
Sets the values for one data column in the current data table of an SDDS dataset.
void * SDDS_GetColumn(SDDS_DATASET *SDDS_dataset, char *column_name)
Retrieves a copy of the data for a specified column, including only rows marked as "of interest".
int32_t SDDS_InitializeInput(SDDS_DATASET *SDDS_dataset, char *filename)
Definition SDDS_input.c:49
int32_t SDDS_Terminate(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_ReadPage(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_InitializeOutput(SDDS_DATASET *SDDS_dataset, int32_t data_mode, int32_t lines_per_row, const char *description, const char *contents, const char *filename)
Initializes the SDDS output dataset.
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.
int32_t SDDS_DefineColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, int32_t field_length)
Defines a data column within the SDDS dataset.
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.
int32_t SDDS_DefineParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, char *fixed_value)
Defines a data parameter with a fixed string value.
int32_t SDDS_GetNamedColumnType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of a column in the SDDS dataset by its name.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
Definition SDDS_utils.c:432
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
Definition SDDS_utils.c:288
void SDDS_Bomb(char *message)
Terminates the program after printing an error message and recorded errors.
Definition SDDS_utils.c:342
#define SDDS_ULONG
Identifier for the unsigned 32-bit integer data type.
Definition SDDStypes.h:67
#define SDDS_FLOAT
Identifier for the float data type.
Definition SDDStypes.h:43
#define SDDS_STRING
Identifier for the string data type.
Definition SDDStypes.h:85
#define SDDS_ULONG64
Identifier for the unsigned 64-bit integer data type.
Definition SDDStypes.h:55
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
Definition SDDStypes.h:61
#define SDDS_SHORT
Identifier for the signed short integer data type.
Definition SDDStypes.h:73
#define SDDS_USHORT
Identifier for the unsigned short integer data type.
Definition SDDStypes.h:79
#define SDDS_DOUBLE
Identifier for the double data type.
Definition SDDStypes.h:37
#define SDDS_LONG64
Identifier for the signed 64-bit integer data type.
Definition SDDStypes.h:49
void bomb(char *error, char *usage)
Reports error messages to the terminal and aborts the program.
Definition bomb.c:26
long match_string(char *string, char **option, long n_options, long mode)
Matches a given string against an array of option strings based on specified modes.
int scanargs(SCANNED_ARG **scanned, int argc, char **argv)
Definition scanargs.c:36
long processPipeOption(char **item, long items, unsigned long *flags)
Definition scanargs.c:356
void processFilenames(char *programName, char **input, char **output, unsigned long pipeFlags, long noWarnings, long *tmpOutputUsed)
Definition scanargs.c:390