GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/unrrdu/about.c Lines: 38 48 79.2 %
Date: 2017-05-26 Branches: 8 20 40.0 %

Line Branch Exec Source
1
/*
2
  Teem: Tools to process and visualize scientific data and images             .
3
  Copyright (C) 2013, 2012, 2011, 2010, 2009  University of Chicago
4
  Copyright (C) 2008, 2007, 2006, 2005  Gordon Kindlmann
5
  Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998  University of Utah
6
7
  This library is free software; you can redistribute it and/or
8
  modify it under the terms of the GNU Lesser General Public License
9
  (LGPL) as published by the Free Software Foundation; either
10
  version 2.1 of the License, or (at your option) any later version.
11
  The terms of redistributing and/or modifying this software also
12
  include exceptions to the LGPL that facilitate static linking.
13
14
  This library is distributed in the hope that it will be useful,
15
  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
  Lesser General Public License for more details.
18
19
  You should have received a copy of the GNU Lesser General Public License
20
  along with this library; if not, write to Free Software Foundation, Inc.,
21
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
*/
23
24
#include "unrrdu.h"
25
#include "privateUnrrdu.h"
26
27
#define INFO "Information about this program and its use"
28
29
int
30
unrrdu_aboutMain(int argc, const char **argv, const char *me,
31
                 hestParm *hparm) {
32
2
  char buff[AIR_STRLEN_MED], fmt[AIR_STRLEN_MED];
33
1
  char par1[] = "\t\t\t\t"
34
    "\"unu\" is a command-line interface to much of the functionality "
35
    "in \"nrrd\", a C library for raster data processing. Nrrd is one "
36
    "library in the \"Teem\" collection of libraries.  More information "
37
    "about Teem is at <http://teem.sf.net>. A checkout of Teem source "
38
    "is available via:\n "
39
    "svn co http://svn.code.sf.net/p/teem/code/teem/trunk teem\n ";
40
  /* "svn co http://teem.svn.sf.net/svnroot/teem/teem/trunk teem\n "; */
41
1
  char par2[] = "\t\t\t\t"
42
    "Long-term maintenance of this software depends on funding, and "
43
    "funding depends on being able to document who is using it for what.  "
44
    "If unu or Nrrd has helped in your research, including for simple one-off "
45
    "experiments or mundane data hacking, the developers of Teem would love "
46
    "to know. There are multiple ways of communicating this.  "
47
    "In your publications, consider adding a line such as this "
48
    "in the Acknowledgments: "
49
    "\"Data processing performed with the unu tool, "
50
    "part of the Teem toolkit available at "
51
    "http://teem.sf.net\". "
52
    "Alternatively, please email glk@uchicago.edu and briefly describe "
53
    "how Teem software has helped in your work. "
54
    "Please also consider joining the teem-users mailing list: "
55
    "<http://lists.sourceforge.net/lists/listinfo/teem-users>. This is "
56
    "the primary forum for feedback, questions, and feature requests.\n ";
57
1
  char par3[] = "\t\t\t\t"
58
    "A summary list of unu commands is generated by running simply \"unu\". "
59
    "Running a unu command without additional arguments "
60
    "(e.g. \"unu slice\") generates its description and usage information. "
61
    "This includes information (marked with \"* Uses ...\") "
62
    "about the underling Nrrd library calls "
63
    "(e.g. nrrdSlice()) that implement the basic functionality in "
64
    "that unu command.\n ";
65
1
  char par4[] = "\t\t\t\t"
66
    "The utility of unu is mainly as a pre-processing tool for getting "
67
    "data into a type, encoding, format, or dimensions best suited for some "
68
    "visualization or rendering task.  Also, slices and projections are "
69
    "effective ways to visually inspect the contents of a dataset. "
70
    "Especially useful commands include make, resample, crop, slice, "
71
    "project, histo, dhisto, quantize, and save. Unu can process "
72
    "CT and MRI volume datasets, grayscale and color images, "
73
    "time-varying volumes of vector fields (5-D arrays), and more. "
74
    "Currently supported formats are plain text files (2-D float arrays), "
75
    "NRRD, VTK structured points, and PNG and PNM images.  "
76
    "\"unu make -bs -1\" can read from most DICOM files.  "
77
    "\"unu save\" can generate EPS files. "
78
    "Supported encodings are raw, ascii, hex, gzip, and bzip2.\n";
79
1
  char par5[] = "\t\t\t\t"
80
    "Much of the functionality of unu derives from chaining multiple "
81
    "invocations together with pipes (\"|\"), minimizing the "
82
    "need to save out intermediate files. For example, if "
83
    "\"data.raw.gz\" is a gzip'ed 256\tx\t256\tx\t80 volume of raw floats "
84
    "written from a PC, "
85
    "then the following will save to \"zsum.png\" a histogram "
86
    "equalized summation projection along the slowest axis:\n";
87
1
  char par6[] = "\tunu make -i data.raw.gz -t float -s 256 256 80 "
88
    "-e gzip -en little \\\n "
89
    "  | unu project -a 2 -m sum \\\n "
90
    "  | unu heq -b 2000 -s 1 \\\n "
91
    "  | unu quantize -b 8 -o zsum.png"
92
    "\n";
93
  int enc, form, miss;
94
95
  AIR_UNUSED(argc);
96
  AIR_UNUSED(argv);
97
  AIR_UNUSED(me);
98
99
1
  fprintf(stdout, "\n");
100
1
  sprintf(buff, "--- unu: Utah Nrrd Utilities command-line interface ---");
101
1
  sprintf(fmt, "%%%ds\n",
102
          (int)((hparm->columns-strlen(buff))/2 + strlen(buff) - 1));
103
1
  fprintf(stdout, fmt, buff);
104
1
  airTeemVersionSprint(buff);
105
1
  sprintf(fmt, "%%%ds\n",
106
          (int)((hparm->columns-strlen(buff))/2 + strlen(buff) - 1));
107
1
  fprintf(stdout, fmt, buff);
108
1
  fprintf(stdout, "\n");
109
110
1
  _hestPrintStr(stdout, 1, 0, 78, par1, AIR_FALSE);
111
1
  _hestPrintStr(stdout, 1, 0, 78, par2, AIR_FALSE);
112
1
  _hestPrintStr(stdout, 1, 0, 78, par3, AIR_FALSE);
113
1
  _hestPrintStr(stdout, 1, 0, 78, par4, AIR_FALSE);
114
1
  _hestPrintStr(stdout, 1, 0, 78, par5, AIR_FALSE);
115
1
  _hestPrintStr(stdout, 2, 0, 78, par6, AIR_FALSE);
116
117
1
  printf(" Formats available:");
118
  miss = AIR_FALSE;
119
14
  for (form=nrrdFormatTypeUnknown+1; form<nrrdFormatTypeLast; form++) {
120
6
    if (nrrdFormatArray[form]->available()) {
121
6
      printf(" %s", airEnumStr(nrrdFormatType, form));
122
6
    } else {
123
      miss = AIR_TRUE;
124
    }
125
  }
126
1
  printf("\n");
127
1
  if (miss) {
128
    printf("   (not available:");
129
    for (enc=nrrdFormatTypeUnknown+1; enc<nrrdFormatTypeLast; enc++) {
130
      if (!nrrdFormatArray[enc]->available()) {
131
        printf(" %s", airEnumStr(nrrdFormatType, enc));
132
      }
133
    }
134
    printf(")\n");
135
  }
136
137
1
  printf(" Nrrd data encodings available:");
138
  miss = AIR_FALSE;
139
14
  for (enc=nrrdEncodingTypeUnknown+1; enc<nrrdEncodingTypeLast; enc++) {
140
6
    if (nrrdEncodingArray[enc]->available()) {
141
6
      printf(" %s", airEnumStr(nrrdEncodingType, enc));
142
6
    } else {
143
      miss = AIR_TRUE;
144
    }
145
  }
146
1
  printf("\n");
147
1
  if (miss) {
148
    printf("   (not available:");
149
    for (enc=nrrdEncodingTypeUnknown+1; enc<nrrdEncodingTypeLast; enc++) {
150
      if (!nrrdEncodingArray[enc]->available()) {
151
        printf(" %s", airEnumStr(nrrdEncodingType, enc));
152
      }
153
    }
154
    printf(")\n");
155
  }
156
157
1
  printf("\n");
158
  /* NOTE: this is an exceptional unu command that doesn't rely on
159
     privateUnrrdu.h USAGE() macro; so we determine our own return value */
160
1
  return 0;
161
1
}
162
163
UNRRDU_CMD(about, INFO);