mia-2dmyoserial-nonrigid(1)
π mia-2dmyoserial-nonrigid β General Commands Manual π
okay bestie, sit down, grab a strawberry π, because we're about to make a whole perfusion image series line up in time order and it's gonna be so satisfying. the manual page name is literally mia-2dmyoserial-nonrigid, and no, you don't have to say it three times fast.
β¨ NAME β¨
mia-2dmyoserial-nonrigid β Run a serial registration of a series of 2D images.
like. that's the whole job. serial. 2D. images. slay π
β¨ SYNOPSIS β¨
mia-2dmyoserial-nonrigid -i <in-file> -o <out-file> [options]
<PLUGINS:2dimage/fullcost>
so you give it an in-file, you give it an out-file, you sprinkle whatever options your heart desires on top, and the cost function comes in from <PLUGINS:2dimage/fullcost> because that's the plugin family doing the heavy lifting. periodt.
β¨ DESCRIPTION β¨
mia-2dmyoserial-nonrigid runs the non-rigid motion compensation registration of a perfusion image series. that's the whole main character sentence right there.
the registration is run in a serial manner β meaning it only registers images that are in temporal succession, one after the other, no skipping around like it's got free will. then the transformations it picks up along the way get applied accumulated so you eventually reach full registration. it's giving conga line but make it transforms. πͺ©
See:
Wollny, G., Ledesma-Carbayo, M.J., Kellman, P., Santos, A. "A New Similarity Measure for Non-Rigid Breathing Motion Compensation of Myocardial Perfusion MRI ". Proc 30th Annual International IEEE EMBS Conference, pp. 3389-3392. Vancouver, Aug. 2008.
(the double space in "Myocardial Perfusion" is literally the original's and I'm keeping it, iykyk)
β¨ OPTIONS β¨
π File-IO
-i,--in-file=(input, required); stringβ the input perfusion data set. yes it's required, do not ghost it.-o,--out-file=(output, required); stringβ the output perfusion data set. also required. the program needs somewhere to put its art.-R,--registered=regβ file name base for registered fiels. (yes, "fiels". I'm not fixing it, the original said it, we honor it π«Ά)
π¦ Registration
-O,--optimizer=gsl:opt=gd,step=0.1β the optimizer used for minimization. for supported plugins seePLUGINS:minimizer/singlecost.-l,--mg-levels=3β multi-resolution levels.-f,--transForm=spline:rate=16,penalty=[divcurl:weight=0.01]β transformation type. for supported plugins seePLUGINS:2dimage/transform. (yes, capital F intransForm, lived experience π)-r,--ref=-1β reference frame.-1== use image in the middle. middle-child energy, iconic.-k,--skip=0β skip registration of these images at the beginning of the series.
πΈ Help & Info
-V,--verbose=warningβ verbosity of output, print messages of given level and higher priorities. supported priorities starting at lowest level are:traceβ Function call tracedebugβ Debug outputinfoβ Low level messagesmessageβ Normal messageswarningβ Warningsfailβ Report test failureserrorβ Report errorsfatalβ Report only fatal errors
--copyrightβ print copyright information.-h,--helpβ print this help.-?,--usageβ print a short help.--versionβ print the version number and exit.
π Processing
--threads=-1β Maxiumum number of threads to use for processing,This number should be lower or equal to the number of logical processor cores in the machine. (-1: automatic estimation). (and yes, "Maxiumum" and the missing space after "processing," β untouched, as the ancestors wrote it π)
π PLUGINS: 1d/splinebc
spline interpolation boundary conditions. pick your boundary vibe:
mirrorβ Spline interpolation boundary conditions that mirror on the boundary.- (no parameters)
repeatβ Spline interpolation boundary conditions that repeats the value at the boundary.- (no parameters)
zeroβ Spline interpolation boundary conditions that assumes zero for values outside.- (no parameters)
π§ PLUGINS: 1d/splinekernel
kernels for making splines. the secret sauce:
bsplineβ B-spline kernel creation , supported parameters are:d = 3; int in [0, 5]β Spline degree.
omomsβ OMoms-spline kernel creation, supported parameters are:d = 3; int in [3, 3]β Spline degree.
(not me noticing the space before the comma in "creation ," β untouched. bestie behavior β¨)
β PLUGINS: 2dimage/cost
the actual "do these two images match?" measures:
lnccβ local normalized cross correlation with masking support., supported parameters are:w = 5; uint in [1, 256]β half width of the window used for evaluating the localized cross correlation.
lsdβ Least-Squares Distance measure.- (no parameters)
miβ Spline parzen based mutual information., supported parameters are:cut = 0; float in [0, 40]β Percentage of pixels to cut at high and low intensities to remove outliers.mbins = 64; uint in [1, 256]β Number of histogram bins used for the moving image.mkernel = [bspline:d=3]; factoryβ Spline kernel for moving image parzen hinstogram. For supported plug-ins seePLUGINS:1d/splinekernel.rbins = 64; uint in [1, 256]β Number of histogram bins used for the reference image.rkernel = [bspline:d=0]; factoryβ Spline kernel for reference image parzen hinstogram. For supported plug-ins seePLUGINS:1d/splinekernel.
nccβ normalized cross correlation.- (no parameters)
ngfβ This function evaluates the image similarity based on normalized gradient fields. Various evaluation kernels are available., supported parameters are:eval = ds; dictβ plugin subtype. Supported values are:sqβ square of differencedsβ square of scaled differencedotβ scalar product kernelcrossβ cross product kernel
ssdβ 2D imaga cost: sum of squared differences, supported parameters are:autothresh = 0; float in [0, 1000]β Use automatic masking of the moving image by only takeing intensity values into accound that are larger than the given threshold.norm = 0; boolβ Set whether the metric should be normalized by the number of image pixels.
ssd-automaskβ 2D image cost: sum of squared differences, with automasking based on given thresholds, supported parameters are:rthresh = 0; doubleβ Threshold intensity value for reference image.sthresh = 0; doubleβ Threshold intensity value for source image.
π PLUGINS: 2dimage/fullcost
the big ones. the full-cost girlies. these handle multi-resolution processing too.
imageβ Generalized image similarity cost function that also handles multi-resolution processing. The actual similarity measure is given es extra parameter., supported parameters are:cost = ssd; factoryβ Cost function kernel. For supported plug-ins seePLUGINS:2dimage/cost.debug = 0; boolβ Save intermediate resuts for debugging.ref =(input, io)β Reference image. For supported file types seePLUGINS:2dimage/io.src =(input, io)β Study image. For supported file types seePLUGINS:2dimage/io.weight = 1; floatβ weight of cost function.
labelimageβ Similarity cost function that maps labels of two images and handles label-preserving multi-resolution processing., supported parameters are:debug = 0; int in [0, 1]β write the distance transforms to a 3D image.maxlabel = 256; int in [2, 32000]β maximum number of labels to consider.ref =(input, io)β Reference image. For supported file types seePLUGINS:2dimage/io.src =(input, io)β Study image. For supported file types seePLUGINS:2dimage/io.weight = 1; floatβ weight of cost function.
maskedimageβ Generalized masked image similarity cost function that also handles multi-resolution processing. The provided masks should be densly filled regions in multi-resolution procesing because otherwise the mask information may get lost when downscaling the image. The reference mask and the transformed mask of the study image are combined by binary AND. The actual similarity measure is given es extra parameter., supported parameters are:cost = ssd; factoryβ Cost function kernel. For supported plug-ins seePLUGINS:2dimage/maskedcost.ref =(input, io)β Reference image. For supported file types seePLUGINS:2dimage/io.ref-mask =(input, io)β Reference image mask (binary). For supported file types seePLUGINS:2dimage/io.src =(input, io)β Study image. For supported file types seePLUGINS:2dimage/io.src-mask =(input, io)β Study image mask (binary). For supported file types seePLUGINS:2dimage/io.weight = 1; floatβ weight of cost function.
π bestie warning-adjacent note: maskedimage really does want densly filled masks, because if they aren't, the mask info can get lost when the image gets downscaled. that's straight from the page, not me being dramatic. (okay, a little me being dramatic.) π
β¨ PLUGINS: 2dimage/io β¨
okay so this is the whole 2dimage reading-and-writing squad, and bestie, they are all different flavors of "I speak this file format" π
bmpβ BMP 2D-image input/output support. This one can read and write binary images plus 8-bit gray scale images, and it does read-only for 4-bit gray scale images. It ignores the color table entirely and just takes the pixel values as literal gray scale values. no cap.- Recognized file extensions:
.BMP,.bmp - Supported element types:
- binary data
- unsigned 8 bit
- Recognized file extensions:
datapoolβ virtual IO to and from the internal data pool. it's giving "the filesystem is a state of mind" π- Recognized file extensions:
.@
- Recognized file extensions:
dicomβ 2D image io for DICOM.- Recognized file extensions:
.DCM,.dcm - Supported element types:
- signed 16 bit
- unsigned 16 bit
- Recognized file extensions:
exrβ a2dimageio plugin for OpenEXR images.- Recognized file extensions:
.EXR,.exr - Supported element types:
- unsigned 32 bit
- floating point 32 bit
- Recognized file extensions:
jpgβ a2dimageio plugin for jpeg gray scale images. gray scale only, she serves one look and she serves it flawlessly β¨- Recognized file extensions:
.JPEG,.JPG,.jpeg,.jpg - Supported element types:
- unsigned 8 bit
- Recognized file extensions:
pngβ a2dimageio plugin for png images.- Recognized file extensions:
.PNG,.png - Supported element types:
- binary data
- unsigned 8 bit
- unsigned 16 bit
- Recognized file extensions:
rawβ RAW 2D-image output support. this one has a LIST and honestly, iconic range π- Recognized file extensions:
.RAW,.raw - Supported element types:
- binary data
- signed 8 bit
- unsigned 8 bit
- signed 16 bit
- unsigned 16 bit
- signed 32 bit
- unsigned 32 bit
- floating point 32 bit
- floating point 64 bit
- Recognized file extensions:
tifβ TIFF 2D-image input/output support.- Recognized file extensions:
.TIF,.TIFF,.tif,.tiff - Supported element types:
- binary data
- unsigned 8 bit
- unsigned 16 bit
- unsigned 32 bit
- Recognized file extensions:
vistaβ a2dimageio plugin for vista images. same energy, another full bingo card π- Recognized file extensions:
.-,.V,.VISTA,.v,.vista - Supported element types:
- binary data
- signed 8 bit
- unsigned 8 bit
- signed 16 bit
- unsigned 16 bit
- signed 32 bit
- unsigned 32 bit
- floating point 32 bit
- floating point 64 bit
- Recognized file extensions:
π PLUGINS: 2dimage/maskedcost π
cost functions but with masking support, so you get to say "bestie, these pixels are not invited to the party" π
lnccβ local normalized cross correlation with masking support. supported parameters are:w=5; uint in[1, 256]β half width of the window used for evaluating the localized cross correlation.
miβ Spline parzen based mutual information with masking. supported parameters are:cut=0; float in[0, 40]β percentage of pixels to cut at high and low intensities to remove outliers.mbins=64; uint in[1, 256]β number of histogram bins used for the moving image.mkernel=[bspline:d=3]; factory β spline kernel for moving image parzen hinstogram. for supported plug-ins see PLUGINS:1d/splinekernelrbins=64; uint in[1, 256]β number of histogram bins used for the reference image.rkernel=[bspline:d=0]; factory β spline kernel for reference image parzen hinstogram. for supported plug-ins see PLUGINS:1d/splinekernel
nccβ normalized cross correlation with masking support.- (no parameters) β yeah she takes zero arguments and zero notes π
ssdβ Sum of squared differences with masking.- (no parameters)
π¦ PLUGINS: 2dimage/transform π¦
the glow-up department π every one of these can warp your image, and every one of them shares the same two little interpolation besties. let's go.
affineβ Affine transformation (six degrees of freedom). supported parameters are:imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernel
rigidβ Rigid transformations (i.e. rotation and translation, three degrees of freedom). supported parameters are:imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernelrot-center=[[0,0]]; 2dfvector β relative rotation center, i.e.<0.5,0.5>corresponds to the center of the support rectangle.
rotationβ Rotation transformations (i.e. rotation about a given center, one degree of freedom). supported parameters are:imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernelrot-center=[[0,0]]; 2dfvector β relative rotation center, i.e.<0.5,0.5>corresponds to the center of the support rectangle.
splineβ Free-form transformation that can be described by a set of B-spline coefficients and an underlying B-spline kernel. supported parameters are:anisorate=[[0,0]]; 2dfvector β anisotropic coefficient rate in pixels, nonpositive values will be overwritten by the'rate'value..imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernelkernel=[bspline:d=3]; factory β transformation spline kernel.. for supported plug-ins see PLUGINS:1d/splinekernelpenalty= ``; factory β Transformation penalty term. for supported plug-ins see PLUGINS:2dtransform/splinepenaltyrate=10; float in[1, inf)β isotropic coefficient rate in pixels.
translateβ Translation only (two degrees of freedom). supported parameters are:imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernel
vfβ This plug-in implements a transformation that defines a translation for each point of the grid defining the domain of the transformation. supported parameters are:imgboundary=mirror; factory β image interpolation boundary conditions. for supported plug-ins see PLUGINS:1d/splinebcimgkernel=[bspline:d=3]; factory β image interpolator kernel. for supported plug-ins see PLUGINS:1d/splinekernel
π PLUGINS: 2dtransform/splinepenalty π
penalty terms for spline-y transformations β aka the "behave yourself" tax on your warp πΈ
divcurlβ divcurl penalty on the transformation. supported parameters are:curl=1; float in[0, inf)β penalty weight on curl.div=1; float in[0, inf)β penalty weight on divergence.norm=0; bool β set to1if the penalty should be normalized with respect to the image size.weight=1; float in(0, inf)β weight of penalty energy.
β¨ PLUGINS: minimizer/singlecost β¨
Okay bestie, this is the minimizer corner of the plugin universe π β these are the lil algorithms that actually do the minimizing once the cost function has told them how bad things are. Pick your fighter π
π gdas
Gradient descent with automatic step size correction. Yes, it fixes its own step size, it's giving self-sufficient queen energy β¨ Supported parameters:
ftolr=0;doublein[0, inf)β bail out when the relative change of the criterion drops below this π€max-step=2;doublein(0, inf)β the biggest absolute step size allowed, no giant leaps π¦maxiter=200;uintin[1, inf)β stopping rule: the max number of iterations, periodt β±οΈmin-step=0.1;doublein(0, inf)β the tiniest absolute step size allowed, don't get too microscopic π¬xtola=0.01;doublein[0, inf)β stop once the inf-norm of the change applied toxis below this value π
πββοΈ gdsq
Gradient descent but with quadratic step estimation β it guesses the step smarter, we love a thinker π§ Supported parameters:
ftolr=0;doublein[0, inf)β stop if the relative change of the criterion is below this π€gtola=0;doublein[0, inf)β stop if the inf-norm of the gradient is below this value πmaxiter=100;uintin[1, inf)β stopping rule: the maximum number of iterations β±οΈscale=2;doublein(1, inf)β fallback fixed step size scaling, for when the fancy estimate needs a backup dancer πstep=0.1;doublein(0, inf)β initial step size π£xtola=0;doublein[0, inf)β stop if the inf-norm of thex-update is below this value π
π§ͺ gsl
This one is the optimizer plugin built on the multimin optimizers from the GNU Scientific Library (GSL), https://www.gnu.org/software/gsl/ β yes, the legendary one, no cap π Supported parameters:
eps=0.01;doublein(0, inf)β for gradient based optimizers: stop when|grad| < eps; for simplex: stop when the simplex size< epsπ―iter=100;uintin[1, inf)β maximum number of iterations β±οΈopt=gd;dictβ the specific optimizer to be used. The supported values are:simplexβ Simplex algorithm of Nelder and Meadcg-frβ Flecher-Reeves conjugate gradient algorithmcg-prβ Polak-Ribiere conjugate gradient algorithmbfgsβ Broyden-Fletcher-Goldfarb-Shannbfgs2β Broyden-Fletcher-Goldfarb-Shann (most efficient version) β‘gdβ Gradient descent
step=0.001;doublein(0, inf)β initial step size π£tol=0.1;doublein(0, inf)β some tolerance parameter (yes, "some", the manpage said it, I'm just the messenger π)
π nlopt
Minimizer algorithms using the NLOPT library π For a description of the optimizers, go peek at http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms β do your homework, bestie π Supported parameters:
ftola=0;doublein[0, inf)β stopping criterion: the absolute change of the objective value is below this valueftolr=0;doublein[0, inf)β stopping criterion: the relative change of the objective value is below this valuehigher=inf;doubleβ higher boundary, equal for all parameters π§local-opt=none;dictβ the local minimization algorithm that may be required for the main minimization algorithm. The supported values are:gn-directβ Dividing Rectanglesgn-direct-lβ Dividing Rectangles (locally biased)gn-direct-l-randβ Dividing Rectangles (locally biased, randomized)gn-direct-noscalβ Dividing Rectangles (unscaled)gn-direct-l-noscalβ Dividing Rectangles (unscaled, locally biased)gn-direct-l-rand-noscaleβ Dividing Rectangles (unscaled, locally biased, randomized)gn-orig-directβ Dividing Rectangles (original implementation)gn-orig-direct-lβ Dividing Rectangles (original implementation, locally biased)ld-lbfgs-nocedalβ Noneld-lbfgsβ Low-storage BFGSln-praxisβ Gradient-free Local Optimization via the Principal-Axis Methodld-var1β Shifted Limited-Memory Variable-Metric, Rank 1ld-var2β Shifted Limited-Memory Variable-Metric, Rank 2ld-tnewtonβ Truncated Newtonld-tnewton-restartβ Truncated Newton with steepest-descent restartingld-tnewton-precondβ Preconditioned Truncated Newtonld-tnewton-precond-restartβ Preconditioned Truncated Newton with steepest-descent restartinggn-crs2-lmβ Controlled Random Search with Local Mutationld-mmaβ Method of Moving Asymptotesln-cobylaβ Constrained Optimization BY Linear Approximationln-newuoaβ Derivative-free Unconstrained Optimization by Iteratively Constructed Quadratic Approximationln-newuoa-boundβ Derivative-free Bound-constrained Optimization by Iteratively Constructed Quadratic Approximationln-neldermeadβ Nelder-Mead simplex algorithmln-sbplxβ Subplex variant of Nelder-Meadln-bobyqaβ Derivative-free Bound-constrained Optimizationgn-isresβ Improved Stochastic Ranking Evolution Strategynoneβ don't specify algorithm
lower=-inf;doubleβ lower boundary, equal for all parameters π§maxiter=100;intin[1, inf)β stopping criterion: the maximum number of iterations β±οΈopt=ld-lbfgs;dictβ the main minimization algorithm. The supported values are:gn-directβ Dividing Rectanglesgn-direct-lβ Dividing Rectangles (locally biased)gn-direct-l-randβ Dividing Rectangles (locally biased, randomized)gn-direct-noscalβ Dividing Rectangles (unscaled)gn-direct-l-noscalβ Dividing Rectangles (unscaled, locally biased)gn-direct-l-rand-noscaleβ Dividing Rectangles (unscaled, locally biased, randomized)gn-orig-directβ Dividing Rectangles (original implementation)gn-orig-direct-lβ Dividing Rectangles (original implementation, locally biased)ld-lbfgs-nocedalβ Noneld-lbfgsβ Low-storage BFGSln-praxisβ Gradient-free Local Optimization via the Principal-Axis Methodld-var1β Shifted Limited-Memory Variable-Metric, Rank 1ld-var2β Shifted Limited-Memory Variable-Metric, Rank 2ld-tnewtonβ Truncated Newtonld-tnewton-restartβ Truncated Newton with steepest-descent restartingld-tnewton-precondβ Preconditioned Truncated Newtonld-tnewton-precond-restartβ Preconditioned Truncated Newton with steepest-descent restartinggn-crs2-lmβ Controlled Random Search with Local Mutationld-mmaβ Method of Moving Asymptotesln-cobylaβ Constrained Optimization BY Linear Approximationln-newuoaβ Derivative-free Unconstrained Optimization by Iteratively Constructed Quadratic Approximationln-newuoa-boundβ Derivative-free Bound-constrained Optimization by Iteratively Constructed Quadratic Approximationln-neldermeadβ Nelder-Mead simplex algorithmln-sbplxβ Subplex variant of Nelder-Meadln-bobyqaβ Derivative-free Bound-constrained Optimizationgn-isresβ Improved Stochastic Ranking Evolution Strategyauglagβ Augmented Lagrangian algorithmauglag-eqβ Augmented Lagrangian algorithm with equality constraints onlyg-mlslβ Multi-Level Single-Linkage (require local optimization and bounds)g-mlsl-ldsβ Multi-Level Single-Linkage (low-discrepancy-sequence, require local gradient based optimization and bounds)ld-slsqpβ Sequential Least-Squares Quadratic Programming
step=0;doublein[0, inf)β initial step size for gradient free methods π£stop=-inf;doubleβ stopping criterion: function value falls below this value πxtola=0;doublein[0, inf)β stopping criterion: the absolute change of allx-values is below this valuextolr=0;doublein[0, inf)β stopping criterion: the relative change of allx-values is below this value
π EXAMPLE π
Okay so here's the vibe π we're registering the perfusion series given in segment.set to reference image 30. Skip two images at the beginning, use mutual information as the cost function, and penalize the transformation by divcurl with weight 5. Then store the result in registered.set. Slay. β¨
mia-2dmyoserial-nonrigid -i segment.set -o registered.set -k 2 -r 30
image:cost=mi -f spline:rate=5,penalty=[divcurl:weight=5]
π AUTHOR(s) π
Gert Wollny
Go off, Gert π
π COPYRIGHT π
okay bestie, legal era incoming but it's actually cute so stay with me π
This software is Copyright (c) 1999β2015 Leipzig, Germany and Madrid, Spain. π«Ά Like, two whole cities said "this is ours, respectfully." Slay.
It comes with ABSOLUTELY NO WARRANTY β and girl, the original put that in ALL CAPS for a reason. Zero. None. Nada. If it breaks, that's between you and the universe. π
You may redistribute it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 (or later). Note the "or later" β future-proofing behavior, we love to see it. β¨
And if you want the whole deep lore? For more information run the program with the option '--copyright' β it'll spill the entire legal tea itself, no cap. π
okay that's the whole page, bestie, we made it to the end π₯Ήπ
for the receipt: this page lives under the USER COMMANDS section, it's v2.4.7, and it's mia-2dmyoserial-nonrigid(1). screenshot it, bookmark it, tattoo it idk, it's canon now. β¨π¦
mwah, go non-rigid-ly register something iconic ππ
π¦ where this page comes from
- debian bookworm: mia-tools 2.4.7-11+b1 Β· GPL-3.0-or-later
- ubuntu resolute: mia-tools 2.4.7-18 Β· GPL-3.0-or-later
- ubuntu stonking: mia-tools 2.4.7-19build1 Β· 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