コード例 #1
0
ファイル: defaultsNrrd.c プロジェクト: rblake/seg3d2
void
nrrdDefaultGetenv(void) {
  
  /* these two pre-date Def --> Default rename */
  if (-1 == nrrdGetenvBool(/**/ &nrrdDefaultWriteBareText, NULL,
                           nrrdEnvVarDefaultWriteBareTextOld)) {
    nrrdGetenvBool(/**/ &nrrdDefaultWriteBareText, NULL,
                   nrrdEnvVarDefaultWriteBareText);
  }
  if (-1 == nrrdGetenvEnum(/**/ &nrrdDefaultCenter, NULL, nrrdCenter,
                           nrrdEnvVarDefaultCenterOld)) {
    nrrdGetenvEnum(/**/ &nrrdDefaultCenter, NULL, nrrdCenter,
                   nrrdEnvVarDefaultCenter);
  }
  /* these post-date the Def --> Default rename */

  nrrdGetenvEnum(/**/ &nrrdDefaultWriteEncodingType, NULL, nrrdEncodingType,
                 nrrdEnvVarDefaultWriteEncodingType);
  nrrdGetenvUInt(/**/ &nrrdDefaultWriteCharsPerLine, NULL,
                 nrrdEnvVarDefaultWriteCharsPerLine);
  nrrdGetenvUInt(/**/ &nrrdDefaultWriteValsPerLine, NULL,
                 nrrdEnvVarDefaultWriteValsPerLine);
  nrrdGetenvDouble(/**/ &nrrdDefaultKernelParm0, NULL,
                   nrrdEnvVarDefaultKernelParm0);
  nrrdGetenvDouble(/**/ &nrrdDefaultSpacing, NULL,
                   nrrdEnvVarDefaultSpacing);

  return;
}
コード例 #2
0
ファイル: env.c プロジェクト: CIBC-Internal/teem
int
unrrdu_envMain(int argc, const char **argv, const char *me,
               hestParm *hparm) {
  FILE *out;

  AIR_UNUSED(argc);
  AIR_UNUSED(argv);
  AIR_UNUSED(me);
  out = stdout;

  hestInfo(out, me, _unrrdu_envInfoL, hparm);
  fprintf(out, "\n");

  _hestPrintStr(out, 0, 0, hparm->columns,
                ("Each variable in the listing below starts with the name of "
                 "the environment variable (\"NRRD_...\"), what type of value "
                 "it represents (e.g. \"int\", \"bool\"), what the "
                 "environment variable is currently set to, what the "
                 "corresponding Nrrd global variable is set to, and a "
                 "description of the variable."),
                AIR_FALSE);
  fprintf(out, "\n");

  _hestPrintStr(out, 0, 0, hparm->columns,
                ("Bool variables may be set to true simply by setting the "
                 "environment variable; setting the value to \"true\" or "
                 "\"false\" sets the bool accordingly.  Enum variables may "
                 "be set by setting the environment variable to any string "
                 "that parses as one of the enum values.  Int and unsigned "
                 "int variables are set via a string parse-able as a numeric "
                 "value."),
                AIR_FALSE);
  fprintf(out, "\n");

  /* UNRRDU_QUIET_QUIT functionality implemented in privateUnrrdu.h */
  _hestPrintStr(out, 0, 0, hparm->columns,
                ("In addition to the the \"NRRD_\" environment variables, "
                 "there is this one, " UNRRDU_QUIET_QUIT_ENV ", which "
                 "determines whether unu exits "
                 "quietly (without error and usage info) when it fails "
                 "because an input nrrd read immediately hit EOF (as "
                 "happens when many unu invocations are piped together). "
                 "This is currently detected by seeing if the error message "
                 "ends with \n \"" UNRRDU_QUIET_QUIT_STR "\"."),
                AIR_FALSE);
  fprintf(out, "\n");

  fprintf(out, "%s: ", UNRRDU_QUIET_QUIT_ENV);
  if (getenv(UNRRDU_QUIET_QUIT_ENV)) {
    fprintf(out, "is set (to what doesn't matter); quiet-quit enabled\n");
  } else {
    fprintf(out, "is NOT set; quiet-quit NOT enabled\n");
  }
  fprintf(out, "\n");

  _unrrdu_envBool(out,
                  nrrdEnvVarStateKeyValuePairsPropagate,
                  nrrdStateKeyValuePairsPropagate,
                  "nrrdStateKeyValuePairsPropagate",
                  "When true, key/value pairs are copied from input "
                  "nrrd to output nrrd just like other basic info that hasn't "
                  "just been modified (e.g. type, dimension, block size).",
                  hparm->columns);
  _unrrdu_envEnum(out,
                  nrrdCenter, nrrdEnvVarDefaultCenter,
                  nrrdDefaultCenter,
                  "nrrdDefaultCenter",
                  "The type of sample centering to use when none has been "
                  "set but one has to be chosen for some operation "
                  "(e.g. resampling).",
                  hparm->columns);
  _unrrdu_envEnum(out,
                  nrrdEncodingType, nrrdEnvVarDefaultWriteEncodingType,
                  nrrdDefaultWriteEncodingType,
                  "nrrdDefaultWriteEncodingType",
                  "When writing nrrds, what encoding to use. Only "
                  "\"unu save\" affords explicit control of output encoding.",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarStateKindNoop,
                  nrrdStateKindNoop,
                  "nrrdStateKindNoop",
                  "When true, Nrrd makes not even the slightest effort to be "
                  "smart about setting the \"kind\" field of an axis after "
                  "some operation that modified its samples.",
                  hparm->columns);
  _unrrdu_envInt(out,
                 nrrdEnvVarStateVerboseIO,
                 nrrdStateVerboseIO,
                 "nrrdStateVerboseIO",
                 "The verbosity level of Nrrd input/output operations.",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarStateBlind8BitRange,
                  nrrdStateBlind8BitRange,
                  "nrrdStateBlind8BitRange",
                  "When true, the determined range of 8-bit data will always "
                  "be [0,255] (for uchar) or [-128,127] (for signed char), "
                  "instead of actually looking into the data to find its "
                  "range.",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarDefaultWriteBareText,
                  nrrdDefaultWriteBareText,
                  "nrrdDefaultWriteBareText",
                  "When false, text files used for saving nrrds start with "
                  "comment (\"# ...\") lines containing nrrd fields.",
                  hparm->columns);
  _unrrdu_envEnum(out,
                  nrrdType, nrrdEnvVarStateMeasureType,
                  nrrdStateMeasureType,
                  "nrrdStateMeasureType",
                  "For measurements (\"unu project\") like sum and product, "
                  "the type of the output result, when one hasn't been "
                  "explicitly requested.",
                  hparm->columns);
  _unrrdu_envInt(out,
                 nrrdEnvVarStateMeasureModeBins,
                 nrrdStateMeasureModeBins,
                 "nrrdStateMeasureModeBins",
                 "When measuring mode but without a given histogram, how many "
                 "bins to use in the temporary internal histogram.",
                  hparm->columns);
  _unrrdu_envEnum(out,
                  nrrdType, nrrdEnvVarStateMeasureHistoType,
                  nrrdStateMeasureHistoType,
                  "nrrdStateMeasureHistoType",
                  "Output type for most measurements of histograms, when one "
                  "hasn't been explicitly requested",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarStateAlwaysSetContent,
                  nrrdStateAlwaysSetContent,
                  "nrrdStateAlwaysSetContent",
                  "If true, the output content string is set even when the "
                  "input content string is not set.",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarStateDisableContent,
                  nrrdStateDisableContent,
                  "nrrdStateDisableContent",
                  "If true, output content is never set.",
                  hparm->columns);
  _unrrdu_envUInt(out,
                  nrrdEnvVarDefaultWriteCharsPerLine,
                  nrrdDefaultWriteCharsPerLine,
                  "nrrdDefaultWriteCharsPerLine",
                  "When using text encoding, maximum # characters allowed "
                  "per line.",
                  hparm->columns);
  _unrrdu_envUInt(out,
                  nrrdEnvVarDefaultWriteValsPerLine,
                  nrrdDefaultWriteValsPerLine,
                  "nrrdDefaultWriteValsPerLine",
                  "When using text encoding, maximum # values allowed "
                  "per line",
                  hparm->columns);
  _unrrdu_envBool(out,
                  nrrdEnvVarStateGrayscaleImage3D,
                  nrrdStateGrayscaleImage3D,
                  "nrrdStateGrayscaleImage3D",
                  "If true, reading a 2-D grayscale image results in a "
                  "3-D image with a single sample (size=1) on the first "
                  "(fastest) axis.",
                  hparm->columns);

#if 0
  /* GLK is ambivalent about the continued existence of these ... */
  nrrdGetenvDouble(/**/ &nrrdDefaultKernelParm0,
                   nrrdEnvVarDefaultKernelParm0);
  nrrdGetenvDouble(/**/ &nrrdDefaultSpacing,
                   nrrdEnvVarDefaultSpacing);
#endif

  /* NOTE: this is an exceptional unu command that doesn't rely on
     privateUnrrdu.h USAGE() macro; so we determine our own return value */
  return 0;
}