Code Monkey home page Code Monkey logo

fidvc's Introduction

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 for more details).

Important pages

Purpose

The following implementation contains the Matlab m-files for our FIDVC algorithm. The FIDVC algorithm determines the 3D displacement fields between consecutive volumetric image stacks. To provide maximum user versatility the current version is the CPU-based version, which runs a little bit slower (~ 5 - 15 minutes/per stack) than the GPU-based implementation. As Matlab’s GPU-based subroutines become more efficient we hope to provide the GPU-based version at a later release date.

Running FIDVC

C Compiler

To run you need a compatible C compiler. Please see (http://www.mathworks.com/support/compilers/R2015a/index.html)

Input 3D Image Stack Requirements

  • To check if the 3D image stack have the required speckle pattern and intensity values for correlation please use our DVC simulator.
  • The 3D image stack need to be saved in a 3 dimensional matrix (intensity values are stored at x, y and z position) in vol.mat* files.
  • We recommend that the input image stack at each dimension should have at least 1.5 times of the subset size as the number of pixels. The default subset size is 128x128x64, so we recommend that the minimum input volume size should be 192x192x96.
  • The size of the input image stack should be divisible by 0.5 times the size of the subset.

Running included example case

  1. Make sure that the main files and the supplemental m files (from file exchange) are added to the path in Matlab.
  2. Download and save the example volume data in the example folder.
  3. Run the exampleRunFile.m file to and compare its displacement outputs to the contour plots in the referenced paper (Bar-Kochba, Toyjanova et al., Exp. Mechanics, 2014)

Health warning!

FIDVC requires a 3D stack to be read in, which depending on the volume size can require a large amount of RAM in Matlab.

Files

  • Main files
  • addDisplacements.m
  • checkConvergenceSSD.m
  • DVC.m
  • filterDisplacements.m
  • funIDVC.m
  • IDVC.m
  • removeOutliers.m
  • volumeMapping.m
  • Supplement m files from the MATLAB file exchange:
  • gridfit.m
  • inpaint_nans.m
  • inpaint_nans3.m
  • mirt3D_mexinterp.cpp
  • mirt3D_mexinterp.m
  • mirt3D_mexinterp.mexw64
  • Example Run files
  • exampleRunFile.m
  • example volume data (vol00.mat, vol01.mat, resultsFIDVC.mat, outputREsults.pdf, matlab_workspace.mat).

FAQ

What are the requirements for the input 3D image stack?

Please refer to input 3D Image Stack Requirements.

Can I use FIDVC for finding displacement fields in 2D images?

No. But you can use qDIC, this is 2D version of FIDVC for finding displacments in 2D images.

Cite

If used please cite: Bar-Kochba E., Toyjanova J., Andrews E., Kim K., Franck C. (2014) A fast iterative digital volume correlation algorithm for large deformations. Experimental Mechanics. doi: 10.1007/s11340-014-9874-2

@article{bar2014fast,
  title={A fast iterative digital volume correlation algorithm for large deformations},
  author={Bar-Kochba, E and Toyjanova, J and Andrews, E and Kim, K-S and Franck, C},
  journal={Experimental Mechanics},
  pages={1--14},
  year={2014},
  publisher={Springer}
}

Contact and support

For questions, please first refer to FAQ and Questions/Issues (make sure to look through the closed Issues too!). Add a new question if similar issue hasn't been reported. We shall help you at the earliest. The author's contact information can be found at Franck Lab.

fidvc's People

Contributors

alandauer avatar francklab avatar jyang526843 avatar mohakpatel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fidvc's Issues

Rigid Registration Pre-Processing

Does the FIDVC algorithm perform any rigid registration pre-processing to align the two volumes prior to their cross-correlation? If not, is this something that could/should be done prior to implementing FIDVC to enhance accuracy of FIDVC? Thanks!

Parrallelization of the FIDVC

Hello,
I wanted to find out if the FIDVC code is parallelizable.
I want to perform a correlation with the distance spacing of 1. This procedure
takes about 21 hours for a 512 by 512 by 192 image volume.
Is there any means where i code tweak the code t perform the correlation on
multiple processors?
Thank you.
Ronald.

Parseinput

Hi,

I am trying to use FIDVC to calculate the deformation of displacements of two MRI images. However, I got confused when I started looking at the code. In the comments you mentioned inputs should be I, sSize, sSpacing and ccThreshold. However, in the code, you added m, mSize, MTF, M on top of what has already existed. Also, I what does parseinput represent?

Thank you,

Tao

mex error with Xcode 13.2.1

Hello. When compiling in Apple M1 machine (version 12.0.1) function mirt3D_mexinterp.cpp with

mex mirt3D_mexinterp.cpp

I get the errors related to conversion of types from 'const mwSize *' to 'const int *'. Has any body got similar errors? Sorry if this has already been reported.

Detail of the output error is as follows:

Building with 'Xcode Clang++'.
Error using mex
/Users/Code/FIDVC-1.2.4_2D/MatlabCode/Supplemental
MFiles/mirt3D_mexinterp.cpp:173:13: error: incompatible pointer types assigning to 'const int *' from 'const mwSize *' (aka 'const
unsigned long *')
Xdims = mxGetDimensions(IN_S);
^~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2021b.app/extern/include/matrix.h:277:25: note: expanded from macro 'mxGetDimensions'
#define mxGetDimensions mxGetDimensions_730

/Users/josemunoz/Dropbox/research/MasterThesis/AngelIBMB/AngleEnriqueJose/Code/FIDVC-1.2.4_2D/MatlabCode/Supplemental
MFiles/mirt3D_mexinterp.cpp:177:12: error: incompatible pointer types assigning to 'const int *' from 'const mwSize *' (aka 'const
unsigned long *')
dims = mxGetDimensions(IN_Z);
^~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2021b.app/extern/include/matrix.h:277:25: note: expanded from macro 'mxGetDimensions'
#define mxGetDimensions mxGetDimensions_730
^
/Users/Code/FIDVC-1.2.4_2D/MatlabCode/Supplemental
MFiles/mirt3D_mexinterp.cpp:203:13: error: no matching function for call to 'mxCreateNumericArray_730'
OUT_F = mxCreateNumericArray(newXndim, newdims, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2021b.app/extern/include/matrix.h:285:30: note: expanded from macro 'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2021b.app/extern/include/matrix.h:955:1: note: candidate function not viable: no known conversion from 'int *'
to 'const mwSize *' (aka 'const unsigned long *') for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2021b.app/extern/include/matrix.h:285:30: note: expanded from macro 'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730

Index exceeds matrix dimensions error message

Hello Mohak, I downloaded the new version of the FIDVC software and run the software with the available example volume data. i made changes to the subset size in the main file and run and the following error keeps appearing

Index exceeds matrix dimensions.

Error in funIDVC>loadFile (line 80)
I = load(fileInfo.filename{idx});

Error in funIDVC (line 54)
I{1} = loadFile(fileInfo,1);

Error in exampleRunFile (line 73)
[u, cc, dm] = funIDVC(filename, sSize, incORcum);

any suggestions?

Thank you.
Ronald Agyei.

What is the range of strain/displacement in which FIDVC is most accurate?

Hi guys,

What is the minimum and maximum strain/displacement FIDVC can accurately resolve? Do you have any results demonstrating the accuracy of FIDVC at various strains, for example, comparing what FIDVC estimated the displacement to be compared to what the true displacement was? Thanks!

Incremental to cumulative displacements follow up

Hi,
This is a follow up on the discussions made on issue 19 dated (Nov 28, 2017), on the computation of cumulative strains from incremental displacements in FIDVC code. I will like to find out if the 3D version of code to convert incremental displacements to cumulative displacements has been developed.
Thank you.
Ragyei.

Error using mex

Dear developers,

I am trying to test FIDVC. I used the example data sets and the example script suggested in README. I however got below error message. May you advice what might be wrong?

Thanks,
X
------------------------------------------ error message ----------------------------------
Error using mex
~/Documents/MATLAB/MatlabS/FIDVC-master/Matlab Code/Supplemental
MFiles/mirt3D_mexinterp.cpp: In function ?void mexFunction(int, mxArray**, int, const
mxArray**)?:
~/Documents/MATLAB/MatlabS/FIDVC-master/Matlab Code/Supplemental
MFiles/mirt3D_mexinterp.cpp:173:11: error: cannot convert ?const size_t* {aka const long
unsigned int*}? to ?const int*? in assignment
Xdims = mxGetDimensions(IN_S);
^
~/XHXIAO/Documents/MATLAB/MatlabS/FIDVC-master/Matlab Code/Supplemental
MFiles/mirt3D_mexinterp.cpp:177:10: error: cannot convert ?const size_t* {aka const long
unsigned int*}? to ?const int*? in assignment
dims = mxGetDimensions(IN_Z);
^
~//Documents/MATLAB/MatlabS/FIDVC-master/Matlab Code/Supplemental
MFiles/mirt3D_mexinterp.cpp:203:75: error: cannot convert ?int*? to ?const size_t* {aka const
long unsigned int*}? for argument ?2? to ?mxArray* mxCreateNumericArray(size_t, const size_t*,
mxClassID, mxComplexity)?
OUT_F = mxCreateNumericArray(newXndim, newdims, mxDOUBLE_CLASS, mxREAL);

Error in mirt3D_mexinterp (line 37)
mex(pathtofile,'-outdir',pathstr);

Error in volumeMapping (line 52)
for i = 1:3, u{i} = mirt3D_mexinterp(u0{i}, m_u0{1}, m_u0{2}, m_u0{3}); end

Error in IDVC (line 89)
I = volumeMapping(I,m,u);

Error in funIDVC (line 70)
[u_, cc{i-1}, dm, m] = IDVC(I,sSize0,u_);

Error in exampleRunFile (line 76)
[u, cc, dm, m] = funIDVC(filename, sSize, incORcum);

Retrieving mesh

Hello,

I was wondering how can I retrieve the mesh coordinates where the displacement field is defined. I am a little bit confused beacause I used the default spacing (8) for a 519x694x120 volume image and the size of the displacement field (for example, u{1}{1}) is 66x88x16 (which is not the length expected for vectors of the form 1:dm:519,1:dm:694 and 1:dm:120). Should the spacing between subsets be a divisor of each of the dimensions in order to get a well defined mesh?

Thank you very much,

Xavier

Problem regrding boundary of the image

Dear sir,

To check your software for my experiment images, I wrap my image with known displacement field to create the stressed image. Then I compare the displacement field with what I applied. My image is a sphere under uniform expansion ( 400 pa).
Your software perfectly matched the distorted image with initial one. But there is a problem on the boundary of sphere. As you can see in the attached pictures, the stress should be 400 pa within the sphere, but there is an significant error on the edges ( you can see the surface plot of the displacement, and the its gradient is different near the boundary due to interpolation) . Since I want the traction, this has caused serous problem for me. (I just attached the middle xy stack for representation)

The first image is the actual and distorted image under uniform expansion
The second image is showing the good match after iterations
The forth is comparison of the actual and FIDVC displacement.
The fifth one showed sigmaxx and the red dots is the periphery of sphere in the middle section.
I really appreciate if you help me to mitigate this issue. I f you think sending my data will help, please let me know.

Thanks in advance
Yours sincerely

1
2
3
4
5

Why displacement changes by using different dm "desired output mesh spacing"

Hello,

I really appreciate if you please clarify the the role of dm = 8 ( desired output mesh spacing). For my images, I'm using the minimum spacing size of [16 16 16], however, when I use different dm=4,8,16, the results will be different. Since the dm has used in addDisplacements function to make new grid, I was wondering if I should consider the same number as the minimum spacing (Because in last step minimum spacing will be used: as a result, in order to get the output of exact nodal displacement (without interpolation), dm should be the same as the last step spacing).

Also, if dm is for output , why the displacement will change by dm choice.

Thanks in advance
Yours sincerely

question on the displacement "u" components

Hi,

I have read the source code and the Bar-Kochba et al. paper. But I still have trouble in understanding what the output matrix "u" means in the results.

I get that:
First column of u{1,1} = displacement in X-direction (it's a 65x65x25 double in the provided example FIDVC-2.mat)
Second column of u{1,1} = displacement in Y-directoin (it's a 65x65x25 double in example FIDVC-2.mat)
Third column of u{1,1} = displacement in Z-direction (it's a 65x65x25 double in the provided example FIDVC-2.mat)
Fourth column of u{1,1} =magnitude of displacement (it's a 65x65x25 double in the provided example FIDVC-2.mat)

However, I don't quite understand why the displacement in each direction has 3 variables (i.e. 65, 65, 25) in its matrix. Shouldn't it be just one column matrix in each direction? I would think that we calculated one displacement at each sub voxel, and this is split into 3 directions / component (single value in each). How does it end up to have 65x65x25 in each direction?

In any case, will be great if you can fully describe the resulting "u" matrix displacement in greater context. what are the meaning of these columns and individual components.

Many thanks in advance,

Cecilia

Post-doc
Geological Engineering
UW Madison

3D visualization

Hi,

I was wondering if the code included a function to visualize the 3D strain/displacement map next to my 3D volume so I can correlate micro architecture and region of high strain.

thank you.

Error in x, y, and z dimensions

Hello again,

Have you performed any studies comparing the accuracy of the algorithm in the xy vs. z directions? Ideally, accuracy would be equivalent in all directions, but results of mine indicate that xy error is approximately 10-20% while z error is 30-40%. I suspect that this is likely due to the nature of reconstructing 3D volumes from slices in the z direction that results in lower accuracy in this direction. Have you made similar observations or is it possible that something may be wrong with my system? Thanks!

3D TFM

It seems that in most of Franck's publications, FIDVC is used with cells seeded atop 3D matrices containing the fluorescent beads. Is it also capable of resolving displacements with cells embedded within the 3D matrix among the fiduciary markers? Thanks!

How do the coordinates in the displacement matrices, u{1}{1:3}, correlate to the coordinates of the original volume?

Hello!

I see that if I have an image that is 512 x 512 x 64, my displacement matrices will be 65 x 65 x 9, which means each dimension of the displacement matrix is the dimension of the volume divided by the spacing size (dm) and then increased by 1:

By default, dm=8, so:

(512/8)+1=65; (512/8)+1=65; (64/8)+1=9.

Why are the dimensions increased by 1? Where do these points exactly correlate to in the original volume? For example, if i have a volume that's 512 x 512 x 64 and set my dm=1, would my displacement matrices be of size 513 x 513 x 65? What position in the original volume would position (513, 513, 65) in the displacement image correspond to if the original image is only 512 x 512 x 64?

Thank you!

error using MEX issue

Hi, please find attached the following error message during my use of the FIDVC code.
Any reason for this?
Thank you.
Ron.


Building with 'g++'.
Error using mex
/scratch/brown/ragyei/DVC_CODE/FIDVC-master_2/FIDVC-master/mirt3D_mexinterp.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/scratch/brown/ragyei/DVC_CODE/FIDVC-master_2/FIDVC-master/mirt3D_mexinterp.cpp:173:11: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
Xdims = mxGetDimensions(IN_S);
^
/scratch/brown/ragyei/DVC_CODE/FIDVC-master_2/FIDVC-master/mirt3D_mexinterp.cpp:177:10: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
dims = mxGetDimensions(IN_Z);
^
/scratch/brown/ragyei/DVC_CODE/FIDVC-master_2/FIDVC-master/mirt3D_mexinterp.cpp:203:75: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray*
mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
OUT_F = mxCreateNumericArray(newXndim, newdims, mxDOUBLE_CLASS, mxREAL);
^

Error in mirt3D_mexinterp (line 37)
mex(pathtofile,'-outdir',pathstr);

Error in volumeMapping (line 52)
for i = 1:3, u{i} = mirt3D_mexinterp(u0{i}, m_u0{1}, m_u0{2}, m_u0{3}); end

Error in IDVC_3 (line 89)
I = volumeMapping(I,m,u);

Error in funIDVC_3 (line 67)
[u_, cc{i-1}, dm, m] = IDVC_3(I,sSize0,u_);

Error in exampleRunFile_3 (line 80)
[u, cc, dm, m] = funIDVC_3(filename, sSize_rows(ii,:), incORcum);

acceleration using gpu

Hello, I'm trying to use FIDVC for the measurement of 3D displacements.

Currently, the calculation is being done by CPU, but I want to use GPU for the fast computation.
How can I use GPU for this package? Thank you.

Computing DVC displacements

Hi,

Thank you for the FIDVC code!
I will be happy for this clarification.
(A) The FIDVC compares corresponding interrogation windows (between undeformed and deformed image volumes) and measures the displacement components du1,du2,and du3 that best matches each respective corresponding interrogation window. I believe these values are then spatially linked to the center of the each corresponding window.

(B) Then to obtain displacements at every specified "dm", the code then performs a linear interpolation between the co-ordinates of the interrogation window centers which have computed values of du1,du2 and du3.

(C) If point (B) is true is it fine to say that in order to get that actual displacement at each point one needs to further decrease the sub-set spacing so that the interpolation does not affect the true interpolation ?

(D) Finally will be advisable to change the minimum subset spacing to a fixed value say 3 instead of it being a function of the sub-set size?

Thanks.
Obonu Klu

Code update and strain map resolution of binary image volumes

Hi, I have a comment and a question,

I was currently using the FIDVC software and encountered an error message I want to bring your attention to. In the checkConvergenceSSD.m line 75 ensures that the idx term evaluated in line 74 does not index a zero else it throws an out of dimension error. I believe the same should be done in line 91 to ensure that if the spacing is 8 voxels then the idx computed in line 90 should not encounter an out of dimension error. This error was not encountered because the minimum subset spacing was 32^3 and the subset spacing was set to 0.5subset_size. however, if we set the subset spacing to 0.25subset_size then I believe that update is necessary.

Secondly, I transformed my 3D image volumes into binary images where fibers are all of value one and matrix is zeros and this became my input for image volumes for the FIDVC code. This is to avert the influence of highly noisy and sporadic intensities in my 3D images. However, I am still not getting highly resolved strain maps. At the moment I am using the most refined parameters available in the FIDVC code(subset size of 32 by 32 by 32 and a subset spacing of 8 voxels). Any further suggestions?

Thanks.
Ron.

calculated surface

Hi,

I have some questions for using your code to convert my beads displacement into force.
First, I did fluorescent beads experiment with cell and observe the bead displacement by confocal microscope. But the number for the z-stack is 39 or 40. ( 8units in x_y=512_512) Could I used your code to process the images?
Second, I have already calculate the bead displacement. Is it possible to use my current bead displacement in the FIDVC (just skip the first part)
Thanks.

Best,
Jason

Question towards the displacement grid positions (m)

Dear Sir or Madam,

I read the answer to the questions "Retrieving mesh" coordinates and "How do the coordinates in the displacement matrices, u{1}{1:3}, correlate to the coordinates of the original volume?", but I still don't quite get it.

Imagine I have a reference and deformed volume of size 256x256x256.
After running FIDVC (output mesh spacing dm=8 and sSize = 64 ->87,5% overlap of the interrogation windows) the resulting displacement fields u{1,1}{1,1 to 1,4} will have a size of 33x33x33 and like mohakpatel stated:
1 : dm : size(I,1)+dm
gives me the positions where the displacement is calculated as m = 1,9,17,25,...,257.

Now, the grid position 257 is the center of the last interrogation window, but outside of my original volume?!
Is this correct or am I minsinterpreting the positions where the displacement grid is calculated?

Regards,

Frank

Registration 3D images using FIDVC

Hello,
I'd like to align 2 stacks of images so I'm wondering whether I can use FIDVC to find the displacement between the two stacks then apply this displacement to one of the images for the registration?
Thank you,

Strain calculations, Total displacements from incremental analysis, and very small bug

Hello,

Thank you for the FIDVC code!

I have a few questions:

  1. Do you have code to calculate strains from the displacement results?
  2. Do you have code to calculate total cumulative displacements from the displacement results for incremental DVC? (I have to use incremental DVC because my first image and last image are very different. However, I would like to calculate the total cumulative displacement and strain for the last image. )
  3. In exampleRunFile.m, I suggest correcting line 88 to: [~,h] = contourf(plotIdx{2}, plotIdx{1}, u{1}{i}(:,:,ceil(size(u{1}{i},3)/2)),25); colorbar
    I used exampleRunFile.m on a rectangular data set, and found that I needed to make this correction due to the contourf input argument order.

Thank you,
Natalie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.