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 by default)
2. Once it is established the location where the local deformation occur (i.e. there is more intensity than expected by using the fixed image reference), calculate the downhill grad in x-, y- and z-directions, get the resultant downhill
gradient (this os the steepest slope to decent the hill i.e. how a stream will flow down a hill).
3. this direction is that of a 'stream' flowing at right angle to the contours of the 'energy' (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 voxel.
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
%In this interpretation, the symmetric force in symmetric force
%Demons implementation is more of a computational divice than having a
Rex Cheung (2021). InSPIRE utility to deform a 3D image (https://www.mathworks.com/matlabcentral/fileexchange/36401-inspire-utility-to-deform-a-3d-image), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!