Sponsor:

Your company here, and a link to your site. Click to find out more.

unu-make - Man Page

create a nrrd (or nrrd header) from scratch

Synopsis

unu make [@file ...] [-h] [-i,--input <file ...>] -t,--type <type> -s,--size <sz0 sz1 ...> [-fd,--filedim <dim>] [-sp,--spacing <sp0 sp1 ...>] [-th,--thickness <th0 th1 ...>] [-k,--kind <k0 k1 ...>] [-cn,--centering <c0 c1 ...>] [-l,--label <lb0 lb1 ...>] [-u,--unit <un0 un1 ...>] [-c,--content <content>] [-ls,--lineskip <num>] [-bs,--byteskip <num>] [-e,--encoding <enc>] [-en,--endian <end>] [-kv,--keyvalue <key/val ...>] [-spc,--space <space>] [-orig,--origin <origin>] [-dirs,--directions <v0 v1 ...>] [-mf,--measurementframe <v0 v1 ...>] [-spu,--spaceunit <su0 su1 ...>] [-o,--output <nout>] [-od,--outputdata <name>]

Description

Create a nrrd (or nrrd header) from scratch. The data can be in one or more files, or coming from stdin(3). This provides an easy way of specifying the information about some data as to wrap it in a NRRD file, either to pass on for further unu(1) processing, or to save to disk. Note that with “-h”, this creates a detached nrrd header file, without ever reading or writing data files.

When using multiple datafiles, the data from each is simply concatenated in memory (as opposed to interleaving along a faster axis). Keep in mind that all the options below refer to the finished data segment resulting from joining all the data pieces together, except for “-ls”, “-bs”, and “-e”, which apply (uniformly) to the individual data files. Use the “-fd”, option when the things being joined together are not slices of the final result, but slabs or scanlines. It may be easier to put multiple filenames in a response file; there can be one or more filenames per line of the response file. You can also use a sprintf(3)-style format to identify a numbered range of files, so for example “-i I.%03d 1 90 1” refers to I.001I.002, ... I.090, using the inclusive range from the first to the second integer (following the sprintf(3)-style format), in steps of the third. Can optionally give a fourth integer to serve same role as “-fd”.

NOTE:

For the “-l” (labels), “-u” (units), and “-spu” (space units) options below, you can use a single unquoted period (.) to signify an empty string. This creates a convenient way to convey something that the shell doesn’t make it easy to convey. Shell expansion weirdness also requires the use of quotes around the arguments to “-orig” (space origin), “-dirs” (space directions), and “-mf” (measurement frame).

Uses various components of file and data IO, but currently there is no library function that encapsulates the functionality here.

Options

@file ...

response file(s) containing command-line arguments

-h

Generate header ONLY: don’t write out the whole nrrd, don’t even bother reading the input data, just output the detached nrrd header file (usually with a “.nhdr” extension) determined by the options below. The single constraint is that detached headers are incompatible with using stdin(3) as the data source.

-i <file ...> , --input <file ...>

Filename(s) of data file(s); use “-” for stdin(3). OR, can use sprintf(3)-style format for identifying a range of numbered files, see above for details. (1 or more strings); default: “-

-t <type> , --type <type>

type of data (e.g. “uchar”, “int”, “float”, “double”, etc.)

-s <sz0 sz1 ...> , --size <sz0 sz1 ...>

number of samples along each axis (and implicit indicator of dimension of nrrd) (1 or more size_ts)

-fd <dim> , --filedim <dim>

When using multiple input data files (to “-i”), what is the dimension of the array data in each individual file. By default (not using this option), this dimension is assumed to be one less than the whole data dimension. (unsigned int); default: “0”)

-sp <sp0 sp1 ...> , --spacing <sp0 sp1 ...>

spacing between samples on each axis. Use “nan” for any non-spatial axes (e.g.  spacing between red, green, and blue along axis 0 of interleaved RGB image data) (1 or more doubles)

-th <th0 th1 ...> , --thickness <th0 th1 ...>

thickness of region represented by one sample along each axis. As with spacing, use “nan” for any non-spatial axes. (1 or more doubles)

-k <k0 k1 ...> , --kind <k0 k1 ...>

what “kind” is each axis, from the nrrdKind airEnum (e.g. space, time, 3-vector, 3D-masked-symmetric-matrix, or “none” to signify no kind) (1 or more strings)

-cn <c0 c1 ...> , --centering <c0 c1 ...>

kind of centering (node or cell) for each axis, or “none” to signify no centering) (1 or more strings)

-l <lb0 lb1 ...> , --label <lb0 lb1 ...>

short string labels for each of the axes (1 or more strings)

-u <un0 un1 ...> , --unit <un0 un1 ...>

short strings giving units for each of the axes (1 or more

-c <content> , --content <content>

Specifies the content string of the nrrd, which is built upon by many nrrd functions to record a history of operations (string)

-ls <num> , --lineskip <num>

number of ascii lines to skip before reading data (int) default: “0

-bs <num> , --byteskip <num>

number of bytes to skip (after skipping ascii lines, if any) before reading data. Can use “-bs -1” to skip a binary header of unknown length in raw-encoded data (longint) default: “0

-e <enc> , --encoding <enc>

encoding of input data. Possibilities include:

  • raw” raw encoding
  • ascii” ascii values, one scanline per line of text, values within line are delimited by space, tab, or comma
  • hex” two hex digits per byte
  • gzip”, “gz” gzip compressed raw data
  • bzip2”, “bz2” bzip2 compressed raw data

default: “raw

-kv <key/val ...> , --keyvalue <key/val ...>

key/value string pairs to be stored in nrrd. Each key/value pair must be a single string (put it in ""s if the key or the value contain spaces). The format of each pair is “key:=value”, with no spaces before or after “:=”. (1 or more strings)

-spc <space> , --space <space>

identify the space (e.g. “RAS”, “LPS”) in which the array conceptually lives, from the nrrdSpace airEnum, which in turn determines the dimension of the space. Or, use an integer>0 to give the dimension of a space that nrrdSpace doesn’t know about. By default (not using this option), the enclosing space is set as unknown. (string)

-orig <origin> , --origin <origin>

(NOTE: must quote vector) the origin in space of the array: the location of the center of the first sample, of the form “(x,y,z)” (or however many coefficients are needed for the chosen space). Quoting the vector is needed to stop interpretation from the shell (string)

-dirs <v0 v1 ...> , --directions <v0 v1 ...>

(NOTE: must quote whole vector list) The “space directions”: the vectors in space spanned by incrementing (by one) each axis index (the column vectors of the index-to-world matrix transform), OR, “none” for non-spatial axes. Give one vector per axis. (Quoting around whole vector list, not individually, is needed because of limitations in the parser) (string)

-mf <v0 v1 ...> , --measurementframe <v0 v1 ...>

(NOTE: must quote whole vector list) Each vector is a column vector of the matrix which transforms from coordinates in measurement frame (in which the coefficients of vectors and tensors are given) to coordinates of world space (given with “-spc”). This is not a per-axis field: the column vectors comprise a D-by-D square matrix, where D is the dimension of world space. (string)

-spu <su0 su1 ...> , --spaceunit <su0 su1 ...>

short strings giving units with which the coefficients of the space origin and direction vectors are measured. (1 or more strings)

-o <nout> , --output <nout>

output filename. If “-h” has been used, the output file is always a detached header. Otherwise, use extension “.nrrd” to signal creation of self-contained nrrd, and “.nhdr” to signal creating of a detached header with (single) data file. (string); default: “-

-od <name> , --outputdata <name>

when not using “-h” and saving to a “.nhdr” file, using this option allows you to explicitly name the data file, instead of (by default, not using this option) having it be the same filename base as the header file. (string)

See Also

unu(1), sprintf(3)

Referenced By

unu(1).

May 2021