The algorithm of Demons involves:
1. find the difference at each voxel
position using the fixed image as the reference, the delta=movingimage -
fixedimage (3D, minus in matlab does it element by element.
2. Once it is established the location where the local deformation occur (i.e. there is
%more intensity than expected by using the fixedimage reference), calculate
%the downhill grad in x-, y- and z-directions, get the resultant downhill
gradient (this the the steepest slope to decent the hill).
3. this direction is that of a 'stream' flowing prependicularly to the contours of the
'encergy' (L2 normal in this case) hill, use a step factor to multiply
%this to get the actual actionable stepX (in x-, y- and z-directions) size.
4. then simply compute the new voxel position by taking a step for each
5. simply assign the intensity of the movingimage at (newX, newY,
%newZ) as that at this same coordinate on the fixedimage.
6. repeat until reach the max number of allowed iterations or a stopping criterion.
%Intuitive interpretation of Demons: In the above algorithm, Demons could be seen as a
force pushing the contour of iso-intensity out (like the riddles created
by throwing a stone into the pond). Eventually, the energy (i.e. the square
of the difference) is dissipated by repeatedly calculating the delta energy and smoothing
Rex Cheung (2021). InSPIRE utility to automatically deform a 3D monomodal image (https://www.mathworks.com/matlabcentral/fileexchange/36550-inspire-utility-to-automatically-deform-a-3d-monomodal-image), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!