convertx(1)
๐ convertx(1) โ The Computational Morphology Toolkit ๐
okay bestie, gather round, because convertx is that girl. she's the one in the CMTK (Computational Morphology Toolkit) friend group who can change your image's file format AND its pixel data type AND casually do a whole glow-up of image operations on the way through. no cap.
โจ NAME โจ
convertx โ like, convert between image file formats and data types? that's literally her whole thing. ๐
๐ฆ SYNOPSIS ๐ฆ
convertx [options] infile outfile
๐ธ DESCRIPTION ๐ธ
so convertx converts between image file formats and pixel data types, and while she's at it she can also apply simple, general-purpose image operations. iconic behavior honestly.
and here's the part that's giving main character energy: you can put an arbitrary number of operations on the command line, and they get applied exactly in the order you gave them. in order. in the order. periodt. โจ
๐ OPTIONS ๐
๐ซถ Global Toolkit Options (these are shared by all CMTK tools)
yes bestie, every CMTK tool has these. they're the communal bestie group chat. ๐ฌ
--helpโ writes the list of basic command line options to standard output. baby's first flag. ๐ฑ--help-allโ writes the COMPLETE list of basic AND advanced command line options to standard output. the deluxe version. ๐ฅ--wikiโ writes the list of command line options to standard output, but formatted in MediaWiki markup. for when you're being wiki-famous. ๐--manโ writes the man page source innroffmarkup to standard output. meta af. ๐--versionโ writes the toolkit version to standard output. identity check! ๐ชช--echoโ writes the current command line to standard output. she repeats you back to yourself. ๐ฃ๏ธ--verbose-level <integer>โ sets the verbosity level. how much do you want her to yap. ๐ข--verbose,-vโ increments the verbosity level by 1. โ ๏ธ this one is deprecated โ it's only supported for backward compatibility, so likeโฆ she's still here for you but don't build your whole personality on it. ๐ฅฒ--threads <integer>โ sets the maximum number of parallel threads (for POSIX threads and OpenMP). multitasking queen. ๐งตโจ
๐๏ธ Image/Transformation Database
--db <string>โ path to the image/transformation database that should be updated with the newly created image. [Default:NONE] ๐
๐ผ๏ธ Input Image Controls
--set-padding <double>โ sets a padding value: literally every pixel in the input image that has this value gets ignored in all subsequent operations. she's on do-not-disturb. ๐ซ--unset-paddingโ unsets the padding value: for all subsequent operations, all pixels are treated according to their value. everyone's invited again. ๐--labelsโ says that the image values are to be treated as discrete labels. this means the appropriate intent code gets set in output files in NIfTI format. ๐ท๏ธ--greyโ says that the image values are to be treated as continuous grey levels. this resets the intent code in files read from NIfTI format. ๐ซ๏ธ
๐ข Data Type Conversion
pick your pixel flavor, bestie:
--charโ 8 bits, signed integer--byteโ 8 bits, unsigned integer--shortโ 16 bits, signed integer--ushortโ 16 bits, unsigned integer--intโ 32 bits signed integer--uintโ 32 bits unsigned integer--floatโ 32 bits floating point--doubleโ 64 bits floating point
๐ซ Value Mappings
--map-values <string>โ applies a mapping function to pixel values. the mapping is defined as'VAL0[,VAL1,...][:NEWVAL]'and it maps valuesVAL0,VAL1, etc. to the new valueNEWVAL. ifNEWVALisn't given, the values get set to padding. ๐ซ--map-values-only <string>โ applies a mapping function to pixel values and replaces unmapped pixels with padding. multiple such mapping rules can be concatenated asRULE0+RULE1[+...], and all the concatenated rules get applied simultaneously. the mapping is defined as'VAL0[,VAL1,...][:NEWVAL]'to map valuesVAL0,VAL1, etc. to the new valueNEWVAL. ifNEWVALisn't given, the values are set to padding. multiple such mapping rules can be concatenated asRULE0+RULE1[+...], and all the concatenated rules will be applied simultaneously. (yes, she said it twice. she MEANT it twice. ๐)--replace-padding <double>โ replaces padded pixel data with the given value. glow up for the ignored girlies. โจ--replace-inf-nan <double>โ replaces all infinite and not-a-number pixels with the given value. she does not tolerateinforNaNdrama. ๐ฎ
๐ Image Flipping
--flip-xโ flip (mirror) along the x-direction--flip-yโ flip (mirror) along the y-direction--flip-zโ flip (mirror) along the z-direction
mirror mirror on the wall, who's the flipped-est of them all ๐ช
๐ญ Image Masking and Thresholding
--mask <string>โ binary mask file name: eliminates all image pixels where the mask is 0. โ ๏ธ masked-out pixels are NOT set to zero โ they get replaced with the currently-set padding value instead. so if you want them forced to zero, run--set-padding 0before--mask. order matters, bestie, it always does. ๐ซ--mask-inverse <string>โ inverse binary mask file name: eliminates all image pixels where the mask is NOT 0. and go read the notes about padding under--maskabove, same deal applies. ๐--thresh-below <double>โ sets all values below the threshold to the threshold value. ๐ก๏ธ--thresh-above <double>โ sets all values above the threshold to the threshold value. ๐ฅ--thresh-below-to-padding <double>โ sets all values below the threshold to the padding value. ๐ซฅ--thresh-above-to-padding <double>โ sets all values above the threshold to the padding value. ๐ซฅ--binarize-thresh <double>โ sets all values below the threshold to 0, and all values equal to or above it to 1. it's giving binary. 0๏ธโฃ1๏ธโฃ--otsu-threshโ binarizes the image to 0/1 using a threshold computed with Otsu's method. the argument is the number of histogram bins for the threshold computation. ๐งฎ--otsu-thresh-nbins <integer>โ binarization using Otsu's method, with a user-defined number of histogram bins for the threshold computation. you're the boss of the bins now. ๐๏ธ--prune-histogram <integer>โ thresholds the image by 'intensity histogram pruning', i.e. for the given argument n (in histogram bins), it determines thresholds such that the 1/n-th fraction of highest and lowest voxels get thresholded. bye to both extremes ๐ช--prune-histogram-high <integer>โ just like--prune-histograms, but only removes high intensities. โ๏ธ--prune-histogram-low <integer>โ just like--prune-histograms, but only removes low intensities. โ๏ธ
๐ Intensity Transformations
--scale-to-range <string>โ scales image intensities to the range'from:to', e.g.'0:255', before conversion to byte data. ๐--histogram-equalizationโ applies histogram equalization. โจ--histogram-equalization-nbins <integer>โ applies histogram equalization with<int>number of bins. ๐งบ--match-histograms <string>โ transforms intensities to match the distribution in the image provided as the argument for this command. twinning fr. ๐ฏ--match-mean-sdev <string>โ scales intensities to match the mean and standard deviation of intensities in the image provided as the argument for this command. statistically matching, we love to see it. ๐
๐ฆ Morphological Operations
--revertโ reverts a binary mask, i.e. exchanges foreground and background. uno reverse card ๐--erode <integer>โ morphological erosion operator (by pixels). ๐ฝ๏ธ--dilate <integer>โ morphological dilation operator (by pixels). ๐--erode-distance <double>โ morphological erosion operator (by distance). often preferable for anisotropic data, jsyk. ๐--erode-distance-multilabel <double>โ morphological erosion operator (by distance) for multi-label maps. ๐ the result will be either byte, unsigned short, or unsigned int data, depending on the index of the largest used label in the input. so she picks her own outfit based on the input, basically.--dilate-distance <double>โ morphological dilation operator (by distance). oftern preferable for anisotropic data. (she typed "oftern" and honestly? she's keeping it. ๐)--connected-componentsโ creates a connected components map with regions numbered by decreasing component size. biggest girlies get the lowest numbers. ๐ข--boundary-mapโ creates a boundary map. ๐ง--multi-boundary-mapโ creates a multi-valued boundary map. ๐ง๐ง--distance-mapโ computes an unsigned Euclidean distance map. the input image is interpreted as a binary mask. ๐--signed-distance-mapโ computes a signed Euclidean distance map (inside = negative, outside = positive). โโ
๐ง Filter Operations
heads up: all the regional filters below take the filter radius in pixels as the parameter. a single integer defines the kernel radius in all three dimensions, and three comma-separated integers define separate radii for the three dimensions. say it with me: 1 or 1,1,1. iykyk. ๐
--median-filter <string>โ median filter. radius in pixels as described above. ๐ฏ--mean-filter <string>โ regional mean filter. radius in pixels as described above. โ๏ธ--fast-mean-filter <string>โ regional mean filter, but fast and in linear time. same radius rules. ๐๏ธ--variance-filter <string>โ regional variance filter. same radius rules. ๐--fast-variance-filter <string>โ fast (linear-time) regional variance filter. same radius rules. ๐๏ธ--third-moment-filter <string>โ regional third moment filter. same radius rules. ๐ฅ--standard-deviation-filter <string>โ regional standard deviation filter. same radius rules. ๐--smoothness-filter <string>โ regional 'smoothness' filter. same radius rules. ๐งด--gaussian-filter-sigma <double>โ filters the image with a Gaussian kernel. this one takes a single real-valued parameter, which specifies the kernel coefficient sigma in world units [e.g., mm]. ๐ซง--gaussian-filter-fwhm <double>โ filters the image with a Gaussian kernel. this one takes a single real-valued parameter, which specifies the kernel full width at half maximum in world units [e.g., mm]. ๐ซง--laplace-filterโ filters the image with an edge-enhancing Laplacian kernel. edge edges edges. ๐ช
๐ธ๏ธ Grid Operations
--downsample-select <string>โ downsamples the image by pixel selection, using per-axis factors'Fx,Fy,Fz'or a single factor'Fxyz'. โ๏ธ--downsample-average <string>โ downsamples the image by averaging, using per-axis factors'Fx,Fy,Fz'or a single factor'Fxyz'. ๐งฎ--resample <double>โ resamples the image to near-isotropic pixels while preserving the image field-of-view. takes one argument: the target resolution in world units [e.g., mm]. ๐
aand that's part 1, bestie!! the page keeps going, so stay tuned for the rest ๐โจ
--resample-exact <double>โ resamples your image so the pixels become exactly isotropic at the resolution you give it, while keeping the image field-of-view matching as closely as humanly possible ๐ it takes one argument: the target resolution in world units (so like,mmbestie) ๐--crop-by-index <string>โ crops the image to a region you specify with six grid index coordinates, handed over as comma-separated integers:x0,y0,z0,x1,y1,z1โ๏ธโจ--crop-by-threshold <double>โ crops the image to whatever region a given threshold decides, and the resulting image will contain all pixels larger than the parameter you passed ๐ธ--crop-by-threshold-write-region <double>โ same threshold-crop vibe, but it writes the cropping region to standard output ๐--crop-by-threshold-write-xform <double>โ again, crop by threshold, except this one writes the cropping transformation to standard output ๐ฅ
๐ AUTHORS ๐
Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko ๐ซถ squad goals fr fr
๐ LICENSE ๐
http://www.fsf.org/licensing/licenses/gpl.html โ that's the whole thing, no cap, go read it ๐
๐ BUGS ๐
Found a bug? Report it at http://nitrc.org/projects/cmtk/ ๐ not me gatekeeping the bug tracker, go tell them bestie
๐ ACKNOWLEDGMENTS ๐
CMTK is developed with support from the NIAAA under Grant AA021697, National Consortium on Alcohol and Neurodevelopment in Adolescence (N-CANDA): Data Integration Component. From April 2009 through September 2011, CMTK development and maintenance was supported by the NIBIB under Grant EB008381 โจ iconic funding behaviour honestly
and that's the whole page, we did it ๐ this bad boy is CMTK 3.3.1p2, dated Jun 24 2026, and it's convertx(1) โ now go crop something, slay ๐
๐๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: cmtk 3.3.1p2+dfsg-4build1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms