MINCLOOKUP(1)
π minclookup β the manual, but make it make sense
okay bestie, buckle up, because this is the MINC User's Guide page for minclookup(1) and it's genuinely one of the most useful little gremlins in the whole toolkit. it does lookup table conversions on minc files. that's it. that's the whole vibe. β¨
β¨ NAME β¨
minclookup β perform lookup table conversions on minc files
π SYNOPSIS π
minclookup [<options>] <in1>.mnc <out>.mnc
like. two files. in and out. options go wherever, we're not picky.
π¦ DESCRIPTION π¦
so here's the tea: minclookup does a lookup table operation on each and every voxel of a minc file. a lookup table is literally just a list of input values with matching output values. every voxel of the input file gets found in the lookup table, and the corresponding output value gets written out. and the output values can be scalar or vector values β so for example, a colour lookup table would have four columns: one column for input values, and one column for each of red, green and blue output values. iconic behaviour, honestly. π
lookup tables come in two flavours: continuous or discrete.
a continuous lookup table is for treating voxel values as continuous (real) values and converting values by doing interpolation between the values given in the lookup table. a discrete lookup table treats input values as integers and deals with them as completely independent entries, doing no interpolation.
the most common use of continuous lookup tables is for converting intensity values into RGB colours. and to make the lookup tables simpler, the input values are all rescaled into the range zero to one. by default, the smallest value in the file maps to zero and the largest maps to one. this value is then found in the lookup table, usually between two entries in the table (the table is always sorted in ascending order of input values β no cap). linear interpolation is then done on each output column and the resultant value (or values) is written to the output file. if there is more than one output value per input value, then the dimension vector_dimension is added to the output file with length equal to the number of output columns in the lookup table. and for input values outside the range zero to one? the nearest table value is used. simple as.
discrete lookup tables are usually used for remapping label values. each input value is treated as an integer (it is not rescaled) and if it is found in the lookup table, then the corresponding value (or values) is written to the output file. if it is not found, then a null value is written out (zero by default). no interpolation is done with discrete lookup tables β to get a non-null output value, there must be an entry in the table. periodt. π
π OPTIONS π
quick lil note before we dive in: options can be specified in abbreviated form (as long as they are unique) and can be given anywhere on the command line. we love flexibility. π«Ά
πΈ General options πΈ
-2β Create a MINC 2.0 format output file.-clobberβ Overwrite an existing file.-noclobberβ Don't overwrite an existing file (default).-no_clobberβ Synonym for-noclobber.-verboseβ Print out progress information for each chunk of data copied (default).-quietβ Do not print out progress information.-buffer_sizesize β Specify the maximum size of the internal buffers (in kbytes). Default is 10 MB.-filetypeβ Create an output file with the same type as the first input file (default).-byteβ Store each voxel as an 8-bit integer.-shortβ Store each voxel as a 16-bit integer.-intβ Store each voxel as a 32-bit integer.-longβ Superseded by-int.-floatβ Store each voxel in 32-bit floating point format.-doubleβ Store each voxel in 64-bit floating point format.-signedβ Create an output file with data stored in a signed type. This option is meaningless when used with floating point data formats, which are always signed.-unsignedβ Create an output file with data stored in an unsigned type. This option is meaningless when used with floating point data formats.-valid_rangemin max β Scale integer voxel values to fall between the values min and max. By default integer voxel values will be scaled to use the entire range of the base type. This option is meaningless when used with floating point data formats.
π Lookup table options π
-grayβ Use a gray lookup table to write out RGB values (default).-greyβ Synonym for-gray.-hotmetalβ Use a hot-metal lookup table to write out RGB values.-spectralβ Use a spectral (rainbow) lookup table to write out RGB values.-invertβ Invert the lookup table so that the maximum value maps to zero and the minimum value maps to one. Applies only to continuous lookup tables.-noinvertβ Do not invert the lookup table β the minimum maps to zero and the maximum maps to one (default).-rangemin max β Specify the range of values that should map to the range of the lookup table (default is the full range of the input file).-minimummin β Specify the input value that maps to the minimum value in the lookup table.-maximummax β Specify the input value that maps to the maximum value in the lookup table.-lookup_table[file | -] β Specify the name of a file containing the lookup table. If-is given, the lookup table is read from the standard input. The file must have at least two columns: The first column gives the input values; the other columns give the corresponding output values. For a continuous lookup table, the first column should contain a value between zero and one inclusive. Explicit entries for both zero and one should usually be given. For a discrete lookup table, the first column should contain integer values. If more than one output column is given, then the output file will have the dimensionvector_dimensionwith a length equal to the number of output columns. The lines of the table will be sorted if necessary so that the first column is in ascending order.-lut_stringlookup-table-string β Specify the complete lookup table as a single string. The semicolon character";"is used to separate lines.-continuousβ The lookup table is continuous (see description above): Input values are treated as continuous (real) values and are rescaled to the range zero to one before being looked up; interpolation is done between values in the table. This is the default behaviour.-discreteβ The lookup table is discrete (see description above): Input values are treated as integers and no interpolation is done between input values.-null_valuenull-value-string β Specify a null value to be used with discrete lookup tables when a value is not found in the lookup table. This value must be specified as a comma-separated list of values, with the same number of values as output columns in the lookup table.
β Generic options for all commands β
-helpβ Print summary of command-line options and exit.-versionβ Print the program's version number and exit.
π EXAMPLES π
okay these are the fun part, let's go. π₯
to get hot-metal RGB images from an MRI file:
minclookup -hotmetal input.mnc output.mnc
to convert the labels in a minc label file, use -discrete:
minclookup -discrete -lookup_table lookupfile \
in_labels.mnc out_labels.mnc
where lookupfile is a file containing entries to map label 2 to 4 and label 3 to 5:
2 4
3 5
you could also specify this lookup table on the command line:
minclookup -discrete -lut_string '2 4;3 5' \
in_labels.mnc out_labels.mnc
to get a grey RGB file, with red for values less than the minimum and green for values greater than the minimum, you can give two zero entries and two one entries. the first zero is used for negative values, the second zero is used for interpolation to the next entry. there is no ambiguity about how to handle a value of exactly zero because the first and last values of the table are handled in a special way to make sure that they are treated as within range if this sort of two-entry situation occurs.
minclookup -lookup_table - input.mnc output.mnc <<EOF
0 1 0 0
0 0 0 0
1 1 1 1
1 0 1 0
EOF
to invert a scalar image, you could use minclookup:
minclookup -lut_string '0 1;1 0' in.mnc out.mnc
ngl that last one is genuinely the cutest trick in the whole page. inverting an image with like twelve characters of lookup table? we love a low-effort slay. π
π AUTHOR π
Peter Neelin
π COPYRIGHTS π
Copyright Β© 1995 by Peter Neelin
and that's the whole page bestie!! you ate that π before you go β this one's stamped from the MINC User's Guide, and the footer vibes say the source date was $Date: 2004-05-20 21:52:08 $ on the MINCLOOKUP(1) page. so yeah, a little vintage, still iconic, still works. go convert some voxels. π¦β¨
π¦ where this page comes from
- debian bookworm: minc-tools 2.3.00+dfsg-10 Β· as_is
- debian trixie: minc-tools 2.3.00+dfsg-12 Β· as_is
- nixpkgs unstable: minc-tools 2.3.06-unstable-2024-11-28
- ubuntu jammy: minc-tools 2.3.00+dfsg-8 Β· as_is
- ubuntu noble: minc-tools 2.3.00+dfsg-10build2 Β· as_is
- ubuntu questing: minc-tools 2.3.00+dfsg-12
- ubuntu resolute: minc-tools 2.3.00+dfsg-15 Β· NTP
- ubuntu stonking: minc-tools 2.3.00+dfsg-17 Β· NTP
- Copyright 1996 Peter Neelin, McConnell Brain Imaging Centre
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms