Commit 2639f65a authored by Edward Andò's avatar Edward Andò
Browse files

updates to website according to review 2 of paper

parent edc2c676
Pipeline #46725 passed with stages
in 28 minutes and 34 seconds
......@@ -119,7 +119,7 @@ Here is a graphical toolkit to help with initial alignment and other functions s
Example of the first step of `spam-mmr-graphical`
Label toolkit
......@@ -129,12 +129,12 @@ Tools to deal with labelled images (of particles) where 3D images are provided.
In these images, voxels are "labelled" with integer values that indicate what particle they belong to.
Please see the :ref:`labelToolkitTutorial`.
For example we offer a rapid calculation of bounding boxes like ``scipy.ndimage.find_objects`` but faster.
For example we offer a significantly faster (and much less memory demanding) calculation of centres of mass in a labelled image compared to ``scipy.ndimage.center_of_mass``.
Also offered are calculations of:
* the volume of each label
* the centre of mass of each label
* the eigen-vectors and eigen values of the moment of intertia tensor of each label (convenient for orienting simple shapes in 3D)
* the eigen-vectors and eigen values of the moment of inertia tensor of each label (convenient for orienting simple shapes in 3D)
* the length of the half-axes of an ellipse fitting the particle
.. figure:: images/intro/LabelToolkit.jpg
......
......@@ -231,16 +231,34 @@ Some of the coarser texture is preserved, let's try ``register`` on this::
# following from above
reg = spam.DIC.register(VEC4oneb2, VEC4twob2, margin=20, verbose=True, imShowProgress="Z")
# output after 14 iterations:
# Iteration Number:14 dPhiNorm=0.00050 error=92.93 t=[-0.007 2.044 -1.303] r=[3.037 -0.488 0.020] Udiag=[0.994 1.001 1.003]
# -> Converged
# Calculating gradients...done
# Start correlation with Error = 1132.80
# Iteration Number:1 dPhiNorm=0.93459 error=696.78 t=[-0.025 0.840 -0.409] r=[0.185 -0.107 0.025] Udiag=[1.000 1.000 1.002]
# Iteration Number:2 dPhiNorm=0.73644 error=466.08 t=[-0.040 1.482 -0.769] r=[0.419 -0.197 0.031] Udiag=[0.999 1.000 1.003]
# Iteration Number:3 dPhiNorm=0.46145 error=360.41 t=[-0.044 1.852 -1.044] r=[0.691 -0.269 0.013] Udiag=[0.999 1.001 1.003]
# Iteration Number:4 dPhiNorm=0.23819 error=310.43 t=[-0.041 2.023 -1.206] r=[0.982 -0.322 -0.005] Udiag=[0.998 1.001 1.004]
# Iteration Number:5 dPhiNorm=0.10605 error=275.63 t=[-0.032 2.086 -1.286] r=[1.283 -0.361 -0.017] Udiag=[0.998 1.001 1.004]
# Iteration Number:6 dPhiNorm=0.04259 error=243.33 t=[-0.022 2.102 -1.315] r=[1.597 -0.390 -0.024] Udiag=[0.997 1.001 1.004]
# Iteration Number:7 dPhiNorm=0.02284 error=204.96 t=[-0.011 2.100 -1.318] r=[1.937 -0.416 -0.030] Udiag=[0.996 1.001 1.004]
# Iteration Number:8 dPhiNorm=0.02397 error=157.07 t=[-0.003 2.089 -1.311] r=[2.308 -0.441 -0.032] Udiag=[0.995 1.001 1.003]
# Iteration Number:9 dPhiNorm=0.02671 error=113.50 t=[ 0.000 2.072 -1.301] r=[2.665 -0.463 -0.026] Udiag=[0.994 1.001 1.003]
# Iteration Number:10 dPhiNorm=0.02211 error=96.18 t=[-0.003 2.058 -1.299] r=[2.900 -0.478 -0.008] Udiag=[0.994 1.001 1.003]
# Iteration Number:11 dPhiNorm=0.01278 error=93.32 t=[-0.006 2.049 -1.301] r=[2.994 -0.484 0.009] Udiag=[0.994 1.001 1.003]
# Iteration Number:12 dPhiNorm=0.00473 error=92.98 t=[-0.007 2.045 -1.302] r=[3.024 -0.486 0.016] Udiag=[0.994 1.001 1.003]
# Iteration Number:13 dPhiNorm=0.00153 error=92.94 t=[-0.007 2.044 -1.302] r=[3.034 -0.487 0.019] Udiag=[0.994 1.001 1.003]
# Iteration Number:14 dPhiNorm=0.00049 error=92.93 t=[-0.007 2.044 -1.303] r=[3.037 -0.488 0.020] Udiag=[0.994 1.001 1.003]
# (Elapsed Time: 0:01:48)
# -> Converged
.. figure:: images/tutorial/02-DIC/K-V4B2-register.png
:align: center
Difference image for VEC4 data in binning 2 with successive iterations of register
This appears to be a good initial guess. We will save it to a file so that we can run our external DVC script::
The registration is successful, getting below the desired *deltaPhiNorm* of 0.001 after 14 iterations.
The total computation time for this registration of two 275x275x380 volumes was 1 minute and 48 seconds on a 2014 laptop.
This appears to be a good initial guess of the deformation of the sample. We will save it to a file so that we can run our external DVC script::
# following from above
import spam.helpers
......@@ -268,6 +286,8 @@ There are a (large) number of options for the ``spam-ldic`` script which are lis
Please see: :ref:`ldic` for more information on the script.
The choice of a half-window size of 10 pixels in this case is made based on the texture.
The spacing of the measurement nodes is set so the default case, double of the half-window size, so as not to have overlapping correlation windows (see also this_ note).
Furthermore, since (as you've seen) there is a rigid-body motion of a 3° z-rotation that we've captured with the registration, we'll ask for the Phi field to have this rigid motion subtracted from the displacement field.
The following computation takes about 6 minutes on a 2014 laptop.
.. _this: https://ttk.gricad-pages.univ-grenoble-alpes.fr/spam/scripts.html#a-note-on-the-correlation-grid
......@@ -275,11 +295,12 @@ The spacing of the measurement nodes is set so the default case, double of the h
bash> source venv/bin/activate
(venv)bash> spam-ldic # The script
-tsv -tif \ # Ask for TSV file and TIFF file output
-tsv -vtk -tif\ # Ask for TSV file, VTK file, and TIFF file output
-phiFile VEC4-registration-b2.tsv -pfb 2 \ # Load the registration and tell the script that it is a 2x binning lower than the loaded data
-glt 20000 \ # Do not correlate windows with mean grey level below this (see historgram above)
-hws 10 \ # Half-window size of the correlation window
-gpi 10 \ # The number of maximum iterations
-gpi 10 \ # The number of maximum iterations
-regs \ # Compute the Phi field with the rigid part of the registration subtracted
VEC4-01-b1.tif VEC4-02-b1.tif # The two tiff files to load
# output:
......@@ -322,7 +343,7 @@ The spacing of the measurement nodes is set so the default case, double of the h
# SERIES_PHIFILE: False
# TIFF: True
# TSV: True
# VTK: False
# VTK: True
# inFiles: [<_io.TextIOWrapper name='VEC4-01-b1.tif' mode='r' encoding='UTF-8'>, <_io.TextIOWrapper name='VEC4-02-b1.tif' mode='r' encoding='UTF-8'>]
#
# Correlating: VEC4-01-b1-VEC4-02-b1
......@@ -348,11 +369,12 @@ Let's go and see what's in output:
# -rw-r--r-- 1 ed ed 113164 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1-iterations.tif
# -rw-r--r-- 1 ed ed 113164 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1-returnStatus.tif
# -rw-r--r-- 1 ed ed 5624436 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1.tsv
# -rw-r--r-- 1 ed ed 2218369 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1.vtk
# -rw-r--r-- 1 ed ed 113164 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1-Xdisp.tif
# -rw-r--r-- 1 ed ed 113164 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1-Ydisp.tif
# -rw-r--r-- 1 ed ed 113164 Mar 13 03:40 VEC4-01-b1-VEC4-02-b1-Zdisp.tif
Here you can see a big TSV file, which contains all the correlation information for all nodes.
Here you can see big TSV and VTK files, which contains all the correlation information for all nodes.
You can also see a number of other TIFF files, which contain 3D fields encoding the results of the correlation, and a number of "disp" TIFF files which show the displacement field (extracted from each local Φ).
Let's look at the returnStatus file -- here we will load it in Fiji and look at a vertical slice:
......@@ -363,7 +385,7 @@ Let's look at the returnStatus file -- here we will load it in Fiji and look at
The fact that there are some points that have been stopped with the maximum number of iterations 10 is a pity.
Let's relaunch the calculation with more iterations, without the line *-gpi 10* to the command line above.
Now the default number of iterations (which is set to 50) is considered.
Now the default number of iterations (which is set to 50) is considered, so we rerun the *spam-ldic* script above with *-gpi 50*, which practically doesn't increase the computation time since few points require more iterations.
.. figure:: images/tutorial/02-DIC/L-subpixreturnstat-50iterations.png
:align: center
......@@ -379,6 +401,14 @@ Let's load "Zdisp.tif":
Central vertical slice through Z (vertical) displacement field shown with the "fire" LUT.
Values shown are from -4 +4 pixels, and reveal a very clear zone of localised strain.
To see this as a "full" displacement field, the VTK file can be dragged and dropped into ParaView (then activate Glyph mode and threshold on *returnStatus* = 2).
.. figure:: images/tutorial/02-DIC/N-VTK-disp-regsub.jpg
:align: center
:scale: 80%
The resulting *displacement* field (with the rigid-body motion subtracted)
Computing strains from the displacement field
==============================================
......
......@@ -108,7 +108,7 @@ Step 1.3: Aggregates identification
The identification of the aggregates is a bit trickier since the grey value is close to the one of the mortar matrix.
For this reason the threshold is made on the image after the application of a variance filter (or standard deviation)::
# application of the filter
import numpy
import spam.filters
......@@ -122,6 +122,13 @@ For this reason the threshold is made on the image after the application of a va
.. figure:: images/tutorial/06-projection/standardDev.png
Please note that it's also possible to use the variance filter in scipy through the *generic* interface as follows::
standardDev = numpy.sqrt(scipy.ndimage.generic_filter(im.astype(float), numpy.var, footprint=structEl))
but it's more than 100 times slower!
The low variance regions (aggregates and pores) are kept by thresholding the filtered image and the already identified pores are discarded::
# keep the values lower than 1090
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment