SDDSlib
Loading...
Searching...
No Matches
image2sdds.c
1/*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * This file is distributed subject to a Software License Agreement found
7 * in the file LICENSE that is included with this distribution.
8\*************************************************************************/
9
10/*************************************************************************
11 * FILE: image2sdds.c
12 * Author: Josh Stein
13 *
14 * Purpose: Program for converting a raw binary image file
15 * to a variety of SDDS formats.
16 *
17 * Mods: login mm/dd/yy: description
18 *
19 * stein 02/26/97: created
20 *************************************************************************/
21
22#include <stdio.h>
23#include <string.h>
24#include <SDDS.h> /* SDDS library header */
25
26#define VERSION "V1.2"
27#define XDIMENSION 482 /* Default beam size in X axis */
28#define YDIMENSION 512 /* Default beam size in Y axis */
29
30/* Parameter defines */
31#define PARM_DEBUG 1
32#define PARM_XDIM 2
33#define PARM_YDIM 3
34#define PARM_TRANSPOSE 4
35#define PARM_ASCII 5
36#define PARM_HELP 6
37#define PARM_QMARK 7
38#define PARM_CONTOUR 8
39#define PARM_2D 9
40#define PARM_XMIN 10
41#define PARM_YMIN 11
42#define PARM_XMAX 12
43#define PARM_YMAX 13
44#define PARM_MULTICOLUMNMODE 14
45
46int asciiOutput = 0; /* Set to 1 for ASCII sdds output, 0 for binary */
47int array = 0; /* Set to 1 for 2 dimensional array output */
48int contour = 0;
49int xDim = 0;
50int yDim = 0;
51double xMin = 0;
52double yMin = 0;
53double xMax = 1;
54double yMax = 1;
55int useXmax = 0;
56int useYmax = 0;
57int debug = 0;
58int transpose = 0;
59int multiColumnMode = 0;
60
61struct parm_info {
62 char *parm;
63 int len;
64 int id;
65 char *desc;
66};
67
68typedef struct parm_info PARM_INFO;
69
70static PARM_INFO ptable[] = {
71 {"-2d", 3, PARM_2D, "2D_array"},
72 {"-debug", 6, PARM_DEBUG, "Debug_flag"},
73 {"-xdim", 5, PARM_XDIM, "X_Dimensions"},
74 {"-ydim", 5, PARM_YDIM, "Y_Dimensions"},
75 {"-transpose", 10, PARM_TRANSPOSE, "Transpose"},
76 {"-ascii", 6, PARM_ASCII, "Transpose"},
77 {"-contour", 8, PARM_CONTOUR, "Contour"},
78 {"-help", 5, PARM_HELP, "Help"},
79 {"-?", 2, PARM_QMARK, "Help"},
80 {"-xmin", 5, PARM_XMIN, "X_Minimum"},
81 {"-ymin", 5, PARM_YMIN, "Y_Minimum"},
82 {"-xmax", 5, PARM_XMAX, "X_Maximum"},
83 {"-ymax", 5, PARM_YMAX, "Y_Maximum"},
84 {"-multicolumnmode", 16, PARM_MULTICOLUMNMODE, "MultiColumnMode"},
85 {NULL, -1, -1}};
86
87/* Prototypes */
88int process_cmdline_args(int argc, char *argv[], char *infile, char *outfile);
89void usage(char *name);
90
91int main(int argc, char *argv[]) {
92 short *image = NULL;
93 short *rotimage = NULL;
94 char infile[255];
95 char outfile[255];
96 char xDimStr[10];
97 char yDimStr[10];
98 int32_t dim[2];
99 FILE *infilefp;
100 int x, y, i, n, j;
101 SDDS_TABLE table;
102 double xInterval = .02;
103 double yInterval = .02;
104 double *indexes = NULL;
105 char **columnNames = NULL;
106 int32_t *data = NULL;
107
108 process_cmdline_args(argc, argv, infile, outfile);
109
110 /* If user didn't specify extrema */
111 if (!xDim) {
112 xDim = XDIMENSION;
113 }
114 if (!yDim) {
115 yDim = YDIMENSION;
116 }
117
118 image = (short *)malloc(sizeof(short) * xDim * yDim);
119 rotimage = (short *)malloc(sizeof(short) * xDim * yDim);
120
121 /* Open input file */
122 if ((infilefp = fopen(infile, "r")) == NULL) {
123 fprintf(stderr, "%s: error: enable to open input file: %s\n", argv[0], infile);
124 exit(1);
125 }
126
127 /* Read image into 1 dimensional array */
128 for (x = 0; x < xDim * yDim; x++) {
129 image[x] = getc(infilefp);
130 if (image[x] == EOF) {
131 fprintf(stderr, "%s: Unexpected EOF at index %d\n", argv[0], x);
132 exit(1);
133 }
134 }
135 fclose(infilefp);
136 /* Use transpose factor here to adjust image */
137 i = 0;
138 for (x = 0; x < xDim; x++) {
139 for (y = 0; y < yDim; y++) {
140 rotimage[y * xDim + x] = image[i];
141 i++;
142 }
143 }
144
145 /* Begin SDDS specifics */
146
147 if (transpose) { /* Reverse dimensions for transposed image */
148 sprintf(yDimStr, "%d", xDim); /* Dimensions of image sent to sdds */
149 sprintf(xDimStr, "%d", yDim);
150 } else {
151 sprintf(xDimStr, "%d", xDim); /* Dimensions of image sent to sdds */
152 sprintf(yDimStr, "%d", yDim);
153 }
154
155 if (asciiOutput) {
156 if (!SDDS_InitializeOutput(&table, SDDS_ASCII, 1, "ImageArray", "Converted image data", outfile)) {
157 fprintf(stderr, "%s: SDDS error: unable to initialize output file %s\n", argv[0], outfile);
158 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
159 }
160 } else {
161 if (!SDDS_InitializeOutput(&table, SDDS_BINARY, 1, "ImageArray", "Converted image data", outfile)) {
162 fprintf(stderr, "%s: SDDS error: unable to initialize output file %s\n", argv[0], outfile);
163 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
164 }
165 }
166 if (transpose) {
167 if (useXmax)
168 xInterval = (xMax - xMin) / (yDim - 1);
169 if (useYmax)
170 yInterval = (yMax - yMin) / (xDim - 1);
171 } else {
172 if (useXmax)
173 xInterval = (xMax - xMin) / (xDim - 1);
174 if (useYmax)
175 yInterval = (yMax - yMin) / (yDim - 1);
176 }
177 if (contour) {
178 if (!multiColumnMode) {
179 /* Begin setting parameters for use in sddscontour tool */
180 if (SDDS_DefineParameter(&table, "Variable1Name", NULL, NULL, NULL, NULL, SDDS_STRING, "x") == -1) {
181 fprintf(stderr, "%s: SDDS error: unable to define paramter 1: variable1Name\n", argv[0]);
182 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
183 }
184
185 if (SDDS_DefineParameter(&table, "Variable2Name", NULL, NULL, NULL, NULL, SDDS_STRING, "y") == -1) {
186 fprintf(stderr, "%s: SDDS error: unable to define parameter 2: variable2Name\n", argv[0]);
187 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
188 }
189
190 if (SDDS_DefineParameter1(&table, "xInterval", NULL, NULL, NULL, NULL, SDDS_DOUBLE, &xInterval) == -1) {
191 fprintf(stderr, "%s: SDDS error: unable to define parameter 3: xInterval\n", argv[0]);
192 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
193 }
194
195 if (SDDS_DefineParameter1(&table, "xMinimum", NULL, NULL, NULL, NULL, SDDS_DOUBLE, &xMin) == -1) {
196 fprintf(stderr, "%s: SDDS error: unable to define paramter 4: xMinimum\n", argv[0]);
197 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
198 }
199
200 if (SDDS_DefineParameter(&table, "xDimension", NULL, NULL, NULL, NULL, SDDS_LONG, xDimStr) == -1) {
201 fprintf(stderr, "%s: SDDS error: unable to define paramter 5: xDimension\n", argv[0]);
202 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
203 }
204
205 if (SDDS_DefineParameter1(&table, "yInterval", NULL, NULL, NULL, NULL, SDDS_DOUBLE, &yInterval) == -1) {
206 fprintf(stderr, "%s: SDDS error: unable to define parameter 6: yInterval\n", argv[0]);
207 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
208 }
209
210 if (SDDS_DefineParameter1(&table, "yMinimum", NULL, NULL, NULL, NULL, SDDS_DOUBLE, &yMin) == -1) {
211 fprintf(stderr, "%s: SDDS error: unable to define paramter 7: yMinimum\n", argv[0]);
212 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
213 }
214
215 if (SDDS_DefineParameter(&table, "yDimension", NULL, NULL, NULL, NULL, SDDS_LONG, yDimStr) == -1) {
216 fprintf(stderr, "%s: SDDS error: unable to define paramter 8: yDimension\n", argv[0]);
217 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
218 }
219 }
220 }
221 /* Done setting parameters */
222
223 if (array) {
224 if (SDDS_DefineArray(&table, "ImageArray", NULL, NULL, "Intensity", NULL, SDDS_CHARACTER, 0, 2, NULL) == -1) {
225 fprintf(stderr, "%s: SDDS error: unable to define array %s\n", argv[0], "Image");
226 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
227 }
228 } else {
229 if (!multiColumnMode) {
230 if (SDDS_DefineColumn(&table, "Image", NULL, NULL, NULL, NULL, SDDS_SHORT, 0) == -1) {
231 fprintf(stderr, "%s: SDDS error: unable to define column %s\n", argv[0], "Image");
232 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
233 }
234 } else {
235 if (SDDS_DefineSimpleColumn(&table, "Index", NULL, SDDS_DOUBLE) < 0) {
236 fprintf(stderr, "Problem defining column Index.\n");
237 return (1);
238 }
239 if (transpose) {
240 dim[0] = xDim;
241 dim[1] = yDim;
242 } else {
243 dim[0] = yDim;
244 dim[1] = xDim;
245 }
246 indexes = malloc(sizeof(double) * dim[1]);
247 columnNames = malloc(sizeof(char *) * dim[0]);
248 data = malloc(sizeof(int32_t) * dim[1]);
249 for (i = 0; i < dim[0]; i++) {
250 columnNames[i] = malloc(sizeof(char) * 20);
251 sprintf(columnNames[i], "Line%" PRId32, i);
252 if (SDDS_DefineSimpleColumn(&table, columnNames[i], NULL, SDDS_SHORT) < 0) {
253 fprintf(stderr, "Problem defining column %s.\n", columnNames[i]);
254 return (1);
255 }
256 }
257 }
258 }
259
260 if (!SDDS_WriteLayout(&table)) {
261 fprintf(stderr, "%s: SDDS error: unable to write layout\n", argv[0]);
262 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
263 }
264
265 if (!multiColumnMode) {
266 if (!SDDS_StartTable(&table, xDim * yDim)) {
267 fprintf(stderr, "%s: SDDS error: unable to start table\n", argv[0]);
268 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
269 }
270 } else {
271 if (!SDDS_StartTable(&table, dim[1])) {
272 fprintf(stderr, "%s: SDDS error: unable to start table\n", argv[0]);
273 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
274 }
275 }
276
277 if (!array) {
278 if (!multiColumnMode) {
279 if (transpose) {
280 for (x = 0; x < xDim * yDim; x++) {
281 if (!SDDS_SetRowValues(&table, (SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE), x, "Image", rotimage[x], NULL)) {
282 fprintf(stderr, "%s: SDDS error: unable to write row\n", argv[0]);
283 SDDS_PrintErrors(stderr, SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors);
284 }
285 }
286 } else {
287 for (x = 0; x < xDim * yDim; x++) {
288 if (!SDDS_SetRowValues(&table, (SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE), x, "Image", image[x], NULL)) {
289 fprintf(stderr, "%s: SDDS error: unable to write row\n", argv[0]);
290 SDDS_PrintErrors(stderr, SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors);
291 }
292 }
293 }
294 } else {
295 for (i = 0; i < dim[1]; i++)
296 indexes[i] = xMin + xInterval * i;
297 if (!SDDS_SetColumnFromDoubles(&table, SDDS_SET_BY_NAME, indexes, dim[1], "Index"))
298 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
299 n = 0;
300
301 for (i = 0; i < dim[0]; i++) {
302 for (j = 0; j < dim[1]; j++) {
303 if (transpose) {
304 data[j] = image[n];
305 } else {
306 data[j] = rotimage[n];
307 }
308 n++;
309 }
310
311 if (!SDDS_SetColumnFromLongs(&table, SDDS_SET_BY_NAME, data, dim[1], columnNames[i]))
312 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
313 }
314 }
315 } else { /* Requesting writing of 2D array */
316 if (transpose) {
317 dim[0] = xDim;
318 dim[1] = yDim;
319 if (SDDS_SetArray(&table, "ImageArray", SDDS_CONTIGUOUS_DATA, rotimage, dim) == 0) {
320 fprintf(stderr, "%s: SDDS Error - unable to stuff array\n", argv[0]);
321 SDDS_PrintErrors(stderr, SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors);
322 }
323 } else {
324 dim[0] = yDim;
325 dim[1] = xDim;
326 if (SDDS_SetArray(&table, "ImageArray", SDDS_CONTIGUOUS_DATA, image, dim) == 0) {
327 fprintf(stderr, "%s: SDDS Error - unable to stuff array\n", argv[0]);
328 SDDS_PrintErrors(stderr, SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors);
329 }
330 }
331 }
332
333 if (!SDDS_WriteTable(&table)) {
334 fprintf(stderr, "%s: SDDS error: unable to write table\n", argv[0]);
335 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
336 }
337
338 if (!SDDS_Terminate(&table)) {
339 fprintf(stderr, "%s: SDDS error: unable to terminate SDDS\n", argv[0]);
340 SDDS_PrintErrors(stderr, (SDDS_EXIT_PrintErrors | SDDS_VERBOSE_PrintErrors));
341 }
342 if (image)
343 free(image);
344 if (rotimage)
345 free(rotimage);
346 if (indexes)
347 free(indexes);
348 if (data)
349 free(data);
350 if (columnNames)
351 free(columnNames);
352 return (0);
353}
354
355/*************************************************************************
356 * FUNCTION : process_cmdline_args()
357 * PURPOSE : Get command line arguments and set flags appropriately.
358 * ARGS in : argc, argv - standard unix
359 * ARGS out : fname - name of image file
360 * GLOBAL : nothing
361 * RETURNS : 0
362 ************************************************************************/
363int process_cmdline_args(int argc, char *argv[], char *infile, char *outfile) {
364 int i, j;
365 int cmderror = 0;
366 int scan_done = 0;
367
368 *infile = '\0';
369 *outfile = '\0';
370
371 /* Process command line options */
372 if (argc < 3)
373 cmderror++;
374 else {
375 strcpy(infile, argv[1]);
376 strcpy(outfile, argv[2]);
377
378 /* Begin parsing any optional args */
379 for (i = 3; i < argc && !cmderror; i++) {
380 for (j = 0; !scan_done && !cmderror && ptable[j].parm; j++) {
381 if (strncmp(ptable[j].parm, argv[i], ptable[j].len) == 0) {
382 switch (ptable[j].id) {
383
384 case PARM_DEBUG:
385 if (++i > argc)
386 cmderror++;
387 else {
388 if (argv[i][0] == '-')
389 cmderror++;
390 else {
391 if (sscanf(argv[i], "%d", &debug) < 1)
392 cmderror++;
393 else
394 scan_done = 1;
395 }
396 }
397 break;
398
399 case PARM_XDIM:
400 if (++i > argc)
401 cmderror++;
402 else {
403 if (argv[i][0] == '-')
404 cmderror++;
405 else {
406 if (sscanf(argv[i], "%d", &xDim) < 1)
407 cmderror++;
408 else
409 scan_done = 1;
410 }
411 }
412 break;
413
414 case PARM_YDIM:
415 if (++i > argc)
416 cmderror++;
417 else {
418 if (argv[i][0] == '-')
419 cmderror++;
420 else {
421 if (sscanf(argv[i], "%d", &yDim) < 1)
422 cmderror++;
423 else
424 scan_done = 1;
425 }
426 }
427 break;
428
429 case PARM_XMIN:
430 if (++i > argc)
431 cmderror++;
432 else {
433 if (argv[i][0] == '-')
434 cmderror++;
435 else {
436 if (sscanf(argv[i], "%lf", &xMin) < 1)
437 cmderror++;
438 else
439 scan_done = 1;
440 }
441 }
442 break;
443 case PARM_XMAX:
444 if (++i > argc)
445 cmderror++;
446 else {
447 if (argv[i][0] == '-')
448 cmderror++;
449 else {
450 if (sscanf(argv[i], "%lf", &xMax) < 1)
451 cmderror++;
452 else {
453 scan_done = 1;
454 useXmax = 1;
455 }
456 }
457 }
458 break;
459 case PARM_YMIN:
460 if (++i > argc)
461 cmderror++;
462 else {
463 if (argv[i][0] == '-')
464 cmderror++;
465 else {
466 if (sscanf(argv[i], "%lf", &yMin) < 1)
467 cmderror++;
468 else
469 scan_done = 1;
470 }
471 }
472 break;
473 case PARM_YMAX:
474 if (++i > argc)
475 cmderror++;
476 else {
477 if (argv[i][0] == '-')
478 cmderror++;
479 else {
480 if (sscanf(argv[i], "%lf", &yMax) < 1)
481 cmderror++;
482 else {
483 scan_done = 1;
484 useYmax = 1;
485 }
486 }
487 }
488 break;
489
490 case PARM_TRANSPOSE:
491 transpose++;
492 scan_done = 1;
493 break;
494 case PARM_MULTICOLUMNMODE:
495 multiColumnMode = 1;
496 scan_done = 1;
497 break;
498
499 case PARM_ASCII:
500 asciiOutput++;
501 scan_done = 1;
502 break;
503
504 case PARM_HELP | PARM_QMARK:
505 usage(argv[0]);
506 scan_done = 1;
507 break;
508
509 case PARM_CONTOUR:
510 contour++;
511 scan_done = 1;
512 break;
513
514 case PARM_2D:
515 array++;
516 scan_done = 1;
517 break;
518
519 default:
520 cmderror++;
521 break;
522 }
523 }
524 }
525 scan_done = 0;
526 }
527 }
528 if (cmderror) {
529 usage(argv[0]);
530 exit(1);
531 }
532 return (0);
533}
534
535/*************************************************************************
536 * FUNCTION : usage()
537 * PURPOSE : Describes command line options available to client.
538 * ARGS in : char *name - name of executable program
539 * ARGS out : none
540 * GLOBAL : nothing
541 * RETURNS : none
542 ************************************************************************/
543
544#define pr fprintf
545
546void usage(char *name) {
547 pr(stderr, "Image conversion to SDDS utility %s\n", VERSION);
548 pr(stderr, "-------------------------------------\n");
549 pr(stderr, "usage: %s <IMAGE infile> <SDDS outfile> [optionlist...]\n", name);
550 pr(stderr, "[-2d] output SDDS file as 2D array\n");
551 pr(stderr, "[-ascii] write SDDS file as ascii (default is binary)\n");
552 pr(stderr, "[-contour] generate SDDS headers for sddscontour tool \n");
553 pr(stderr, "[-multicolumnmode]\n");
554 pr(stderr, "[-?] or [-help] print this message\n");
555 pr(stderr, "[-transpose] transpose image about diagonal\n");
556 pr(stderr, "[-xdim <value>] X dimension of image (default = %d) \n", XDIMENSION);
557 pr(stderr, "[-ydim <value>] Y dimension of image (default = %d) \n", YDIMENSION);
558 pr(stderr, "[-xmin <value>] [-xmax <value>]\n");
559 pr(stderr, "[-ymin <value>] [-ymax <value>]\n");
560 pr(stderr, "\npurpose:\tReads the image data from file <infile>.\n");
561 pr(stderr, "\t\tand write SDDS data to <outfile>.\n");
562}
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...)
int32_t SDDS_SetColumnFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, double *data, int64_t rows,...)
Sets the values for a single data column using double-precision floating-point numbers.
int32_t SDDS_SetArray(SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t *dimension)
Sets the values of an array variable in the SDDS dataset using specified dimensions.
int32_t SDDS_SetColumnFromLongs(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t *data, int64_t rows,...)
Sets the values for a single data column using long integer numbers.
int32_t SDDS_Terminate(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_DefineParameter1(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, void *fixed_value)
Defines a data parameter with a fixed numerical value.
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_DefineSimpleColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data column within the SDDS dataset.
int32_t SDDS_DefineArray(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, int32_t dimensions, const char *group_name)
Defines a data array within the SDDS dataset.
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.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
Definition SDDS_utils.c:432
#define SDDS_STRING
Identifier for the string data type.
Definition SDDStypes.h:85
#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_CHARACTER
Identifier for the character data type.
Definition SDDStypes.h:91
#define SDDS_DOUBLE
Identifier for the double data type.
Definition SDDStypes.h:37