MINCSTATS(1)

MINCSTATS(1) ๐Ÿ’–

okay bestie, this is the MINC User's Guide page for mincstats, and honestly? she's a baddie. let's get into it ๐ŸŽ€


โœจ NAME โœจ

mincstats โ€” calculate simple statistics across voxels of a minc file ๐Ÿงฎโœจ


โœจ SYNOPSIS โœจ

mincstats [<options>] <in1>.mnc

โœจ DESCRIPTION โœจ

so basically mincstats crunches some very normal, very useful statistical measures across all the voxels in a minc file. and like, heads up: these are global statistical measures, not voxel-by-voxel ones (if that's what you want, go look at mincaverage, she does that ๐Ÿ’…). by default, all the statistics get calculated. but if you ask for specific ones with a command-line option, then only the ones you asked for get printed. periodt.

okay now here's the part that's genuinely iconic: you can restrict which voxels even get counted in the stats โ€” either by limiting the range of included values, or by using a mask file with a restricted range. and you can specify multiple ranges for the input file or the mask file. for every range of included volume values, and every range of mask values, the relevant stats get printed out โ€” that's n*m values, where n is how many volume ranges you gave and m is how many mask ranges you gave. the way this is done in a single pass through the data?? obsessed. it means specifying multiple ranges is way faster than running the program over and over again. huge for calculating a bunch of regional averages with a VOI mask volume. ๐Ÿซถ

and we gotta give a special shoutout to histograms and their related statistical measures, because this is where things get spicy. the default histogram range goes from the smallest value in the file to the largest. now, in the not-uncommon-but-still-special case where your number of histogram bins exactly matches the number of possible values in the file (think: 256 bins for full-range byte data), the histogram can end up with some odd features when you use that default range. this is because of the discretization of the data getting rebinned into a slightly mismatched histogram ๐Ÿ˜ญ. for the byte data example, the values you actually want are 256 bins and a histogram range that stretches half a bin below the smallest value and half a bin above the largest. use -discrete_histogram to work this out automatically, or use -integer_histogram to get bins of unit width if your input data are inherently integer (label data, for example). and like, in general? be careful rebinning discretized data into a histogram whose bin size is close to the level of discretization. no cap. ๐Ÿ™ˆ


โœจ OPTIONS โœจ

quick vibe check before we dive in: options can be given in abbreviated form (as long as they're unique) and can show up anywhere on the command line. and the order the statistics get printed in is always the same โ€” doesn't matter what order you requested them in. she's consistent like that ๐Ÿ’…

General options

  • -clobber โ€” overwrite an existing file. bold. brave.
  • -noclobber โ€” don't overwrite an existing file (this is the default).
  • -verbose โ€” print out extra information (more than the default).
  • -quiet โ€” print out only the requested numbers.
  • -max_buffer_size_in_kb size โ€” specify the maximum size of the internal buffers (in kbytes). default is 4 MB.

Invalid value options

  • -ignore_nan โ€” exclude invalid values (outside valid range) from statistic calculations. this is the default โœจ
  • -include_nan โ€” treat invalid values as zeros and include them in statistic calculations.
  • -replace_nan value โ€” replace invalid values with the specified value and include the new value in statistic calculations.

Volume range options

  • -floor min1,min2,... โ€” comma-separated list of lower bounds for ranges of data to include in statistic calculation.
  • -ceil max1,max2,... โ€” comma-separated list of upper bounds for ranges of data to include in statistic calculation.
  • -range min1,max1,min2,max2,... โ€” comma-separated list of lower and upper bounds for ranges of data to include in statistic calculation.
  • -binvalue val1,val2,... โ€” comma-separated list of integer values to include in statistic calculation. a range of +/- 0.5 is defined around each specified value.
  • -mask filename.mnc โ€” name of file to be used for masking data included in statistic calculation. for this to have any effect at all, you must specify a mask range with one of the following options ๐Ÿ‘‡
  • -mask_floor min1,min2,...: โ€” like -floor, but applied to the mask file.
  • -mask_ceil max1,max2,... โ€” like -ceil, but applied to the mask file.
  • -mask_range min1,max1,min2,max2,... โ€” like -range, but applied to the mask file.
  • -mask_binvalue val1,val2,... โ€” like -binvalue, but applied to the mask file.

Histogram options

  • -histogram filename โ€” specify the name of a file into which the histogram is written. if multiple ranges or mask ranges are specified, then all the histograms get written into this one file, separated by blank lines. information describing each histogram is written before it, in lines starting with the hash (pound) character. these files can be loaded into gnuplot ๐Ÿ”ฅ
  • -hist_bins number-of-bins โ€” specify the number of bins in the histogram.
  • -bins number-of-bins โ€” synonym for -hist_bins.
  • -hist_floor min โ€” specify lower bound for histogram.
  • -hist_ceil max โ€” specify upper bound for histogram.
  • -hist_range min max โ€” specify a range for the histogram.
  • -integer_histogram โ€” create bins of unit width, centred around integer values. useful for integer data such as labels. the histogram range gets rounded to the nearest integer, then the min is lowered and the max is raised by 0.5. the number of bins is taken as the difference of these two values. note that 0.01 is added to the minimum and subtracted from the maximum prior to the rounding, in order to ensure that a correctly specified range (e.g. [0.5,255.5]) is preserved. and if you want integer bins that are wider than one? you're gonna have to work out the histogram range and number of bins yourself, bestie โ€” this option won't do it for you ๐Ÿ’€
  • -discrete_histogram โ€” attempt to match the histogram to the discretization of the input data. this is appropriate for continuous data that are stored in an integer representation, and for when a bin width close to the discretization is what you want. it's similar to -integer_histogram, except that the histogram range is first converted to voxel values, which are rounded and extended by half a bin on either side. this new voxel range is then converted back to real values. the number of bins is taken as the difference in the voxel value range. note that this does not account for variations in slice-to-slice scaling, so odd histogram effects may still occur ๐Ÿ˜ฌ. this option is intended to give behaviour similar to that of volume_stats.
  • -int_max_bins number-of-bins โ€” specify the largest histogram that can be automatically sized with the above options. this limit prevents accidental creation of huge histograms. this option replaced the old -max_bins option in MINC 1.1.

Basic statistics

  • -all โ€” compute all statistical measures. this is the default.
  • -none โ€” synonym for -count (for similarity to volume_stats). note that although this was necessary for volume_stats, it is not needed here, since specifying any of these options automatically turns off -all.
  • -count โ€” count the number of voxels that are within the range and mask.
  • -percent โ€” print the percentage of voxels within the range and mask.
  • -volume โ€” print the volume of the voxels within the range and mask (in mm-cubed).
  • -min โ€” print the minimum value.
  • -max โ€” print the maximum value.
  • -sum โ€” print the sum of all values.
  • -sum2 โ€” print the sum of the squares of all values.
  • -mean โ€” print the mean.
  • -variance โ€” print the variance.
  • -stddev โ€” print the standard deviation.
  • -skewness โ€” print the sample skewness (3rd moment) .
  • -kurtosis โ€” print the sample kurtosis (4th moment) .
  • -CoM โ€” print the centre of mass. both the voxel coordinate and the world coordinates get printed. the voxel coordinates are printed in file order, whilst the world coordinates are printed in x,y,z order.
  • -com โ€” synonym for -CoM.
  • -world_only โ€” print the centre of mass in world coordinates only.

Histogram statistics

quick note before the list: histogram statistics are derived solely from the histogram counts and bin centres, so results like the median won't be exactly the same as the true value for all included voxels. for example, the error on the median can be as large as half a bin width. and furthermore, if the histogram range is less than that of the included voxels, then the result applies only to the voxels included in the histogram. got it? good ๐Ÿซถ

  • -hist_count โ€” print number of voxels in histogram. this may be different from the number of included and masked voxels if the histogram range is less than the range of the included data.
  • -hist_percent โ€” print percentage of voxels included in histogram.
  • -median โ€” print the histogram median.
  • -majority โ€” print the bin centre (intensity value) for the bin with the most counts.
  • -biModalT โ€” print the bi-modal threshold separating the volume into two classes. the default is to use the otsu method (see options below).
  • -otsu โ€” use the method described in Otsu N, "A Threshold Selection Method from Grey-level Histograms", IEEE Trans on Systems, Man and Cybernetics. 1979, 9:1; 62-66 to calculate the threshold.
  • -kittler โ€” use the Kittler&Illingworth '86 algorithm to calculate the for bimodal threshold. Kittler, J. & Illingworth J., "Minimum error thresholding", Pattern Recognition, vol 19, pp 41-47, 1986.
  • -kapur โ€” use the Kapur et al. '85 algorithm to calculate the bimodal threshold. Kapur, Sahoo & Wong "A new method for Gray-level picture thresholding using the entropy of the histogram", Computer Vision, Graphics, and Image Processing, vol 29, pp 273-285, 1985.
  • -simple โ€” use simple mean-of-means algorithm to calculate the bimodal threshold. this is more computationally expensive than some of the alternatives, and doesn't seem to do a great job. but it does seem more robust than some of the other methods.
  • -pctT โ€” print the threshold needed for a particular critical percentage of the histogram.
  • -entropy โ€” print the Shannon entropy.
H(x) = - Sum(P(i) * log2(P(i))

where P(i) is the bin probability โœจ

๐Ÿซถ Generic options for all commands ๐Ÿซถ

These two are the universal besties โ€” they work with literally every command, no matter what:

  • -help โ€” prints a lil summary of all the command-line options and then dips out. It's giving "cheat sheet, but make it instant." ๐Ÿ’–
  • -version โ€” prints the program's version number and bounces. Perfect for when you're like "wait, which one am I even running??" ๐Ÿฆ‹

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Andrew Janke โ€” the icon, the legend, the moment. โœจ


๐ŸŽ€ COPYRIGHTS ๐ŸŽ€

  • Program: Copyright ยฉ 2000 by Andrew Janke
  • Man page: Copyright ยฉ 2001 by Peter Neelin

And that's the whole vibe, bestie!! ๐Ÿซถ This lil doc is MINCSTATS(1), dated 2004-05-20 at 21:52:09 โ€” yeah, she's vintage, and vintage is iconic, no cap. ๐ŸŒธ Go forth and stats your minc files. Slay. ๐Ÿ’…โญ

๐Ÿ“ฆ where this page comes from