From 29f6b4a04b6bdf32376a485de51c2a1ddc119b7c Mon Sep 17 00:00:00 2001 From: Mohak Patel Date: Wed, 24 Jan 2018 16:14:57 -0500 Subject: [PATCH 1/2] :heavy_plus_sign: Add 'm' grid points 'm' is the grid points at which displacements are output --- Matlab Code/DVC.m | 2 +- Matlab Code/Example/exampleRunFile.m | 5 +++- Matlab Code/IDVC.m | 45 +++++++++++++++++----------- Matlab Code/addDisplacements.m | 2 +- Matlab Code/funIDVC.m | 6 ++-- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Matlab Code/DVC.m b/Matlab Code/DVC.m index 76d07c8..9c60a88 100644 --- a/Matlab Code/DVC.m +++ b/Matlab Code/DVC.m @@ -215,7 +215,7 @@ %% equation 4 -if prod(single(sSize == 32)) || prod(single(sSize == 64)) || prod(single(sSize == 128)) +if prod(single(sSize == 32)) || prod(single(sSize == 16)) sSize = sSize(1); x = cell(1,3); diff --git a/Matlab Code/Example/exampleRunFile.m b/Matlab Code/Example/exampleRunFile.m index f6d3df1..6cc2c95 100644 --- a/Matlab Code/Example/exampleRunFile.m +++ b/Matlab Code/Example/exampleRunFile.m @@ -51,6 +51,9 @@ % u{time}{2} = displacement in y-direction at t=time of size MxNxP % u{time}{3} = displacement in z-direction at t=time of size MxNxP % cc: peak values of the cross-correlation for each interrogation +% dm: meshgrid spacing (8 by default) +% m: The grid points at which displacements are computed. The grid +% points locations are in the same format as 'u'. % % NOTES % ------------------------------------------------------------------------- @@ -69,7 +72,7 @@ filename = 'vol*.mat'; % Estimate displacements via IDVC -[u, cc, dm] = funIDVC(filename, sSize, incORcum); +[u, cc, dm, m] = funIDVC(filename, sSize, incORcum); save('resultsFIDVC.mat','u','cc','dm'); diff --git a/Matlab Code/IDVC.m b/Matlab Code/IDVC.m index 0a39609..771b628 100644 --- a/Matlab Code/IDVC.m +++ b/Matlab Code/IDVC.m @@ -1,4 +1,4 @@ -function [u, cc, dm] = IDVC(varargin) +function [u, cc, dm, m] = IDVC(varargin) % [u, cc] = IDVC(I,sSize,u0,className); % I = filterDisplacements(I0,filterSize,z) applies a low-pass convolution % filter to the displacement field to mitigate divergence based on @@ -25,6 +25,8 @@ % u{4} = magnitude % cc: peak values of the cross-correlation for each interrogation % dm: meshgrid spacing (8 by default) +% m: The grid points at which displacements are computed. The grid +% points locations are in the same format as 'u'. % % NOTES % ------------------------------------------------------------------------- @@ -60,6 +62,8 @@ [converged01, SSE(i-1) , sSize(i,:), sSpacing(i,:)] = checkConvergenceSSD(I,SSE,sSize,sSpacing,convergenceCrit); if ~converged01 + finalSize = sSize(i,:); + [I, m] = parseImages(I,sSize(i,:),sSpacing(i,:)); % run cross-correlation to get an estimate of the displacements @@ -67,7 +71,7 @@ % add the displacements from previous iteration to current waitbar(3/7,wb,'Adding displacements from previous iteration'); - [u, ~, cc] = addDisplacements(u,du,cc,m,dm); + [u, ~, cc, mFinal] = addDisplacements(u,du,cc,m,dm); % filter the displacements using a predictor filter waitbar(4/7,wb,'Filtering Displacements'); @@ -87,11 +91,11 @@ disp(['Elapsed time (iteration ',num2str(i-1),'): ',num2str(toc(ti))]); i = i + 1; end - -end -[u,cc] = parseOutputs(u,cc,dm,padSize); +end +[u,cc,m] = parseOutputs(u,cc,finalSize,padSize,mFinal); +delete(wb); disp(['Convergence at iteration ',num2str(i)]); disp(['Title time: ',num2str(toc(t0))]); end @@ -167,22 +171,27 @@ end -function [u,cc] = parseOutputs(u,cc,filterSpacing,padSize) +function [u,cc,m] = parseOutputs(u,cc,finalsSize,padSize,m) % parses outputs and unpads the displacment field and cc. -unpadSize(1,:) = ceil(padSize(1,:)/filterSpacing); -unpadSize(2,:) = floor((padSize(2,:)+1)/filterSpacing); -% +1 from the extra meshgrid point during the meshing of the DVC algorithm. EBK (10-23-2013) - +% % % % unpadSize(1,:) = ceil(padSize(1,:)/filterSpacing); +% % % % unpadSize(2,:) = floor((padSize(2,:)+1)/filterSpacing); +% % % % % +1 from the extra meshgrid point during the meshing of the DVC algorithm. EBK (10-23-2013) +% % % % +% % % % for i = 1:3 +% % % % u{i} = u{i}(1+unpadSize(1,1):end-unpadSize(2,1),... +% % % % 1+unpadSize(1,2):end-unpadSize(2,2),... +% % % % 1+unpadSize(1,3):end-unpadSize(2,3)); +% % % % end +% % % % u{4} = sqrt(u{1}.^2 + u{2}.^2 + u{3}.^2); +% % % % +% % % % cc = cc(1+unpadSize(1,1):end-unpadSize(2,1),... +% % % % 1+unpadSize(1,2):end-unpadSize(2,2),... +% % % % 1+unpadSize(1,3):end-unpadSize(2,3)); +filterSpacing = finalsSize/2; +u{4} = sqrt(u{1}.^2 + u{2}.^2 + u{3}.^2); for i = 1:3 - u{i} = u{i}(1+unpadSize(1,1):end-unpadSize(2,1),... - 1+unpadSize(1,2):end-unpadSize(2,2),... - 1+unpadSize(1,3):end-unpadSize(2,3)); + m{i} = m{i}-padSize(1,i)-filterSpacing(i); end -u{4} = sqrt(u{1}.^2 + u{2}.^2 + u{3}.^2); - -cc = cc(1+unpadSize(1,1):end-unpadSize(2,1),... - 1+unpadSize(1,2):end-unpadSize(2,2),... - 1+unpadSize(1,3):end-unpadSize(2,3)); end diff --git a/Matlab Code/addDisplacements.m b/Matlab Code/addDisplacements.m index 923bbc2..c74bd8a 100644 --- a/Matlab Code/addDisplacements.m +++ b/Matlab Code/addDisplacements.m @@ -1,4 +1,4 @@ -function [u, du, cc] = addDisplacements(u0,du0,cc0,m0,dm) +function [u, du, cc, m] = addDisplacements(u0,du0,cc0,m0,dm) % u = addDisplacements(u,thr,epsilon) removes outliers using the universal % outlier test based on % diff --git a/Matlab Code/funIDVC.m b/Matlab Code/funIDVC.m index 4928d1e..fc9fd2e 100644 --- a/Matlab Code/funIDVC.m +++ b/Matlab Code/funIDVC.m @@ -1,4 +1,4 @@ -function [u, cc, dm] = funIDVC(varargin) +function [u, cc, dm, m] = funIDVC(varargin) % u = funIDVC(filename, sSize, incORcum) is the main function that performs % IDVC on a time increment of volumetric images. % @@ -40,6 +40,8 @@ % u{time}{4} = magnitude % cc: peak values of the cross-correlation for each interrogation point % dm: meshgrid spacing (8 by default) +% m: The grid points at which displacements are computed. The grid +% points locations are in the same format as 'u'. % % NOTES % ------------------------------------------------------------------------- @@ -62,7 +64,7 @@ %Start DVC disp(['Current file: ' fileInfo.filename{i}]) - [u_, cc{i-1}, dm] = IDVC(I,sSize0,u_); + [u_, cc{i-1}, dm, m] = IDVC(I,sSize0,u_); % Saving iterations of the DVC u{i-1}{1} = -u_{1}; u{i-1}{2} = -u_{2}; u{i-1}{3} = -u_{3}; u{i-1}{4} = u_{4}; From 0a8175f80a3699548aa29c926fbf9ee79e1b7245 Mon Sep 17 00:00:00 2001 From: Mohak Patel Date: Wed, 24 Jan 2018 16:17:09 -0500 Subject: [PATCH 2/2] :hammer: Update ReadMe --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49651c1..eee52f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ The Fast Iterative Digital Volume Correlation Algorithm (FIDVC) is the next generation DVC algorithm providing significantly improved signal-to-noise, and large (finite) deformation (incl. large rotations and image stretches) capture capability at low computational cost (please see [Bar-Kochba, Toyjanova et al., Exp. Mechanics, 2014](http://link.springer.com/article/10.1007/s11340-014-9874-2?sa_campaign=email/event/articleAuthor/onlineFirst) for more details). ### Important pages -* [Download latest version v1.2.3!](https://github.com/FranckLab/FIDVC/releases) +* [Download latest version v1.2.4!](https://github.com/FranckLab/FIDVC/releases) * [Example data](https://drive.google.com/folderview?id=0ByhZqlrbo5srSmU2ZW1TOXpfVkE&usp=sharing) * [FAQ](https://github.com/FranckLab/FIDVC#faq) * [Questions/Issues](https://github.com/FranckLab/FIDVC/issues)