/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ /* * $Log: tiff2sdds.c,v $ Revision 1.5 2008/08/22 17:31:13 soliday Updated so that the multicolumn image column names will now use a fixed number of digits by adding zeros in front of the number. Revision 1.4 2005/11/04 22:46:19 soliday Updated code to be compiled by a 64 bit processor. Revision 1.3 2004/12/14 20:40:02 soliday Fixed a memory leak. Revision 1.2 2003/09/02 19:16:08 soliday Cleaned up code for Linux. Revision 1.1 2002/09/19 15:29:21 soliday Added tiff2sdds * */ #include "tiffio.h" #include "SDDS.h" #include "mdb.h" #include "scan.h" #define OPT_REDONLY 0 #define OPT_GREENONLY 1 #define OPT_BLUEONLY 2 #define OPT_SINGLECOLUMNMODE 3 #define N_OPTIONS 4 char *option[N_OPTIONS] = { "redOnly", "greenOnly", "blueOnly", "singleColumnMode", }; char *USAGE="tiff2sdds \n\ [-redOnly] [-greenOnly] [-blueOnly]\n\ [-singleColumnMode]\n\ Program by Robert Soliday. ("__DATE__")\n\n"; int main(int argc, char* argv[]) { SDDS_DATASET SDDS_dataset; SCANNED_ARG *s_arg; TIFF *tif; char *input=NULL, *output=NULL; char **columnNames=NULL; int32_t **data; int32_t *indexes=NULL; long rgb[3]; long i, j, n=0, singleColumnMode=0; SDDS_RegisterProgramName(argv[0]); rgb[0] = rgb[1] = rgb[2] = 1; argc = scanargs(&s_arg, argc, argv); if (argc<3) { fprintf(stderr, "%s", USAGE); return(1); } for (i=1; i