File Exchange

image thumbnail

Augmented Lagrangian Digital Volume Correlation (ALDVC)

version 1.0.3 (25 MB) by Jin Yang
Adaptive Lagrangian Digital Volume Correlation - volumetric displacement and strain measurement based on a hybrid local-global approach


Updated 16 Nov 2020

From GitHub

View Version History

View license on GitHub

Augmented Lagrangian Digital Volume Correlation (ALDVC): volumetric displacement and strain measurement based on a hybrid local-global approach. ALDVC is a fast, parallel-computing hybrid DVC algorithm, which combines advantages of local subset method (fast computation speed, and parallel computing) and finite-element-based global method (guarantee global kinematic compatibility and decrease noise).

% ===================================
For full details, and to use this code, please cite our paper:
Yang, J., Hazlett, L., Landauer, A., Franck, C. Augmented Lagrangian Digital Volume Correlation. Experimental Mechanics, 2020 (

Or request full text at:

Code manual is available at:

% ===================================
Advantages of ALDVC algorithm
[1] It’s a fast algorithm using distributed parallel computing.
[2] Global kinematic compatibility is added as a global constraint in the form of augmented Lagrangian, and solved using Alternating Direction Method of Multipliers scheme.
[3] Both displacement fields and affine deformation gradients are correlated at the same time.
[4] No need of much manual experience about choosing displacement smoothing filters.
[5] Being able to compute image sequence with multiple image frames, which is especially quite useful for measuring very large deformations.

% ===================================
% ****** ATTENTION ******
% The "x,y,z" or "1-,2-,3-" coordinates in the ALDVC code always correspond to the 1st, 2nd and 3rd indices of Matlab workspace variable. For example, p_meas(:,1) and p_meas(:,2) are the x- & y-coordinates of scattered points.
% This is a little different from some MATLAB image processing functions. % For example, if a 3D image has size MxNxL, in this code, we always have the image size_x=M, size_y=N, size_z=L. If you use some Matlab computer vision/image post-processing function, for example, 'imagesc3D', or 'imshow3D', or 'surf', it will reads size_x=N, size_y=M, size_z=L.
% Please pay attention to this difference.

% ==================================================
Contact and support
I appreciate your comments and ratings to help me keep improving this code! Please feel free to follow this code, then you will be notified with all the important updates/corrections in the future.

% ==================================================
[1] regularizeNd.

Cite As

Jin Yang (2021). Augmented Lagrangian Digital Volume Correlation (ALDVC) (, GitHub. Retrieved .

Yang, J., Hazlett, L., Landauer, A., Franck, C. Augmented Lagrangian Digital Volume Correlation. Experimental Mechanics, 2020 (

Comments and Ratings (15)

Ruizhe Huang

Thank you for your answer. This problem has been solved

Jin Yang

Hi @Ruizhe, thanks for the reach out. I hope you could double check that you have successfully uploaded your volumetric images (at least one reference undeformed and one deformed volumetric image data sets). Sections 3-6 are in a for-loop which begins from "for ImgSeqNum = 2:length(ImgNormalized)" . If the size of your ImgNormalized is none or just one image data set, this for-loop will be skipped. If you want to share more information of your data sets or issues (e.g., some screen-shots of the errors/warnings), feel free to email to:

Ruizhe Huang

Ruizhe Huang

Hello, Dr. Yang, I am an undergraduate of Hunan University. I had an error using your code: after running the second quarter, sections 3 through 6 were skipped and went straight to the seventh, causing an error. In fact, MATLAB will not run that part no matter how I do it. What is the reason for this?


Jin Yang

@Fuqiang, you don't need to define a new for loop before section 3. Your previous error message is because you missed lines 51-54 (to set "ImgSeqNum=2" or other index number before section 3). I only received one data set called "deformed.rar", I am guessing that's only a deformed volumetric image with 579 stacks. So besides deformed image, it's also necessary to provide reference image stacks. Hope this helps!

富强 郭

I'm really sorry that my matlab programming ability is very limited, I still can't successfully run the code in section3. If I have 579 images, how do I define the for loop statement before section 3? I send the images to your mailbox, could you see if you can use your codes for DVC analysis? If so, can you send me the modified code file, so that I can learn your code further.

Jin Yang

@Fuqiang, the error message said that there is no definition for “ImgSeqNum”. I am guessing you directly ran Section 3 in the for loop, and missed lines 51-52, where “ImgSeqNum” is defined in line 52. If you only have two volumetric images, we will have “ImgSeqNum=2;”. (“ImgSeqNum=1” should be your reference image, that’s line 51 “Img{1} = ImgNormalized{1}; % The first frame is reference”, and “ImgSeqNum=2” should be your deformed image.)

ALDVC code is written to have the capability to deal with image sequences with multiple frames. That’s why there is a for loop (line 52) before Section 3. Sorry about the inconvenience. Feel free to download the code and modify the code based on your own research purpose (cf MIT license).

富强 郭

富强 郭

Hello,Jin Yang,thanks for your answer .But when I run the code in the file (main_DVC.m), I ran into a problem, as shown below. I can't solve it using the example and user manual you gave. Can you tell me what went wrong? Thank you very much.

------------ Section 3 Start ------------
The function or variable'ImgSeqNum' is not recognized.

Error main_ALDVC (line 64)
Img{2} = ImgNormalized{ImgSeqNum}; NewFFTSearchCheck = 0; DVCpara.NewFFTSearch = 0;

Jin Yang

@Fuqiang, Hi, thank you for the reaching out. I don't think you need to do any special pre-processing for your XCT images as long as there are enough patterns there. (DVC pattern can be the straightforward extension of 2D-DIC patterns, e.g., fluorescence beads, collagen fibers, material microstructures, ...).
Hope this file will be helpful: "./DVC_images/GenerateVolMatfile.m" to transform 3D image stacks to volumetric matfiles for ALDVC code. If there is still question, feel free to let me know.

富强 郭

Hello,I am a PhD from Wuhan University,China.Your research results are very valuable. I just got in touch with the research direction of DVC recently. I did an in-situ XCT experiment of concrete samples and got some XCT images. Can I use your code to get the displacement field and strain field of the concrete sample? Do I need to preprocess the XCT image before using your code? ?

Jin Yang

@Achim Hegner, thank you for the feedback! These are really good suggestions! I add these features at the end of the main_ALDVC.m, where you will see this extension section to execute "plotExt_bodyslice.m" file.

In this extension, I summarize various ways to visualize solved displacements and strains:

%%%%%%%%%%% PLOT DISPLACEMENTS %%%%%%%%%%%%%
(I-i) Body view of solved displacements
(I-ii) Slice view of solved displacements
(I-iii) Quiver plot of solved displacements
(I-iv) Cone plot of solved displacements
(I-v) Streamline plot of solvd displacements

%%%%%%%%%%% PLOT STRAINS %%%%%%%%%%%%%
(II-i) Body view of solved strains
(II-ii) Slice view of solved strains

To visualize the orignal image, use the code: figure, imagesc3(Img{1});
-or- figure, imagesc3D(permute(Img{1},[2,1,3]));

For each slice view, xy-coordinates have following plus directions:
% -------- x plus direction ------->
% |
% |
% |y
% |plus
% |direction
% |
% |
% V

I want to comment that in ALDVC code, the 1st, 2nd, 3rd indices correspond to x-, y-, and z-coordinates. For example, the "coordinatesFEM" in "DVCmesh" are [coordx, coordy, coordz] of nodes. The displacements U has the following order: [Ux_pt1,Uy_pt1,Uz_pt1, Ux_pt2,Uy_pt2,Uz_pt2, ...]'; The "F = grad_X(x)-I" has the following order: [F11_pt1,F21_pt1,F31_pt1,F12_pt1,F22_pt1,F32_pt1,F13_pt1,F23_pt1,F33_pt1, ...]';

I also write a new function to help users transform their 3D image stacks to volumetric matlab matfile used in ALDVC code (see Section 0 in the main_ALDVC.m file) .

Achim Hegner

Very nice tool! Thank you so much for charing.
Is there a way to plot the strains at the end for only one slice (2D Image) and not the whole volume? Or a possibility to "slide" through the volume along the z-axis and see the strains?


MATLAB Release Compatibility
Created with R2018a
Compatible with R2018a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!