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_kbsize โ 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_nanvalue โ replace invalid values with the specified value and include the new value in statistic calculations.
Volume range options
-floormin1,min2,... โ comma-separated list of lower bounds for ranges of data to include in statistic calculation.-ceilmax1,max2,... โ comma-separated list of upper bounds for ranges of data to include in statistic calculation.-rangemin1,max1,min2,max2,... โ comma-separated list of lower and upper bounds for ranges of data to include in statistic calculation.-binvalueval1,val2,... โ comma-separated list of integer values to include in statistic calculation. a range of +/- 0.5 is defined around each specified value.-maskfilename.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_floormin1,min2,...: โ like-floor, but applied to the mask file.-mask_ceilmax1,max2,... โ like-ceil, but applied to the mask file.-mask_rangemin1,max1,min2,max2,... โ like-range, but applied to the mask file.-mask_binvalueval1,val2,... โ like-binvalue, but applied to the mask file.
Histogram options
-histogramfilename โ 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_binsnumber-of-bins โ specify the number of bins in the histogram.-binsnumber-of-bins โ synonym for-hist_bins.-hist_floormin โ specify lower bound for histogram.-hist_ceilmax โ specify upper bound for histogram.-hist_rangemin 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 by0.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 ofvolume_stats.-int_max_binsnumber-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_binsoption in MINC 1.1.
Basic statistics
-allโ compute all statistical measures. this is the default.-noneโ synonym for-count(for similarity tovolume_stats). note that although this was necessary forvolume_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
- 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 2001 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