MINC/Tutorials/Tutorials01

By the end of this tutorial you should be proficient in the usage of the basic MINC commands such as mincresample, mincreshape and mincmath.

Basic MINC commands edit

Everything you do in MINC is based upon the idealogogy of Unix, that is tackle large problems with a combination of smaller programs that can be combined in many different ways. Whilst this is not the easiest system to learn, you will find it to be extremely flexible if you persevere and take time to learn the various ways that each of the commands can be used.

One of the ways to do this is to exhaustively read the man pages of all of the commands.

  $ man mincinfo

Of course I would not recommend this if you are just beginning to use MINC as at this stage you are probably better to learn by example. However as you become more proficient with the commands you will find this very useful, albeit time consuming. A quick summary of help for each of the base commands can also be obtained at the command line by using the -help flag.

  $ mincinfo -help

This will provide a listing of all the options that a particular command will take with a brief summary of its uses. Further details can always be found in the man page.

Whilst MINC programs are built on the Unix philosophy there is one differentation that is caused by the use of netCDF as the underlying library, pipes are not supported. This means that you cannot join the output of a series of MINC commands together using pipes. Instead you must always output the results of each command to a file. As such most commands follow the following convention:

  $ mincxxx [options] <infile.mnc> <outfile.mnc>

In some cases a MINC command will take multiple input files and as such the command will look like this:

  $ mincxxx [options] <infile1.mnc> [<infile2.mnc> [...]] <outfile.mnc>

You can ascertain as to which of these two most common variations the command follows by using the -help option. The usage information is output at the end of the help.

  $ mincmath -help

At this stage you may be wondering the significance of the [] and <> brackets, this notation is commonly used to describe command line programs input. A [] bracket indicates an optional argument and <> brackets indicate a required argument.


Common options edit

There are a number of options that are common across many of the commands. They are:

  -clobber

This option applies to the output file and should be used if the output file already exsists and you wish to overwrite it. If you do not use this option and the output file already exsists an error message will be printed and the program will exit without doing anything.

  -verbose and -quiet

These options either increase or decrease the amount of output a command will produce. They have not effect on the result of the command merely the amount of information that is echoed to the screen.

  -double, -float, -int, -short, -byte

These options specify the precision with which you desire the output of the current command. MINC has been designed such that at any stage you should not have to concern yourself with the datatype and range that your data is using. Your data is defined as existing as a Real (any positive or negative number) and a mapping is done internally to the current datatype.

 

The above figure demonstrates how an Image with a real (use-visible) range of 0 to 2000 can be mapped into a signed byte data type. Of course during this conversion the data will be discretised to 256 points of precision. It is for this reason that the choice is given to the user to choose the output precision for each MINC command should they wish a greater precision of output at any stage. If no datatype is explicitly chosen the MINC tools will use the datatype of the first input file.

  -signed, -unsigned

Specifes as to whether a signed or an unsigned integer type is to be used for storage of data. Note that in most cases unless the data is being prepared for a specific purpose the user should not have to specify these options as the MINC file will rescale a real image range to either an unsigned or signed type with no loss or gain in performance or accuracy. These two options have no effect when used in conjunction with either -double or -float.

  -copy_header, -nocopy_header

All MINC files have an integrated header that can contain any amount of metadata that is associated with a file. These options specify if this metadata is to be copied to the output file. Generally the default here is to copy the header from the first input file to the output file. There are many cases however in which you would not want to do this, for example if you are making a composite image (average) from a series of input files. In this case you probably do not want the metadata information from the first file including the subjects name, date of birth and other details copied to your output file.