Note
Go to the end to download the full example code
Microbeads to Detect Matrix Deformations¶
This example calculates matrix deformations around a Human Umbilical Vein Endothelial Cells (HUVECs) that invades in a polyethylene glycol (PEG) hydrogel cell as measured and described in [Jorge Barrasa-Fano et al., 2021]. The data is available from the authors website here. Images of microbeads (channel ‘ch01’) between a relaxed and deformed stacks are used to calculate matrix deformations (image on the right).
16 import saenopy
Loading the Stacks¶
Saenopy is very flexible in loading stacks from any filename structure. We replace the number of the channels “ch00” with a channel placeholder “ch{c:01}” to indicate that this refers to the channels and which channel to use as the first channel where the deformations should be detected. We replace the number of the z slice “z000” with a z placeholder “z{z}” to indicate that this number refers to the z slice. We do the same for the deformed state and for the reference stack. Here images of microbeads (channel ‘ch01’) are used to calculate matrix deformation.
33 # load the relaxed and the contracted stack
34 # {z} is the placeholder for the z stack
35 # {c} is the placeholder for the channels
36 # {t} is the placeholder for the time points
37 results = saenopy.get_stacks(
38 'TestDataTFMlabKULeuven\Stressed_z{z}_ch{c:01}.tif',
39 reference_stack='TestDataTFMlabKULeuven\Relaxed_z{z}_ch{c:01}.tif',
40 output_path='3_BeadMeasurement/example_output',
41 voxel_size=[0.567, 0.567, 0.493])
Detecting the Deformations¶
Saenopy uses 3D Particle Image Velocimetry (PIV) with the following parameters to calculate matrix deformations between a deformed and relaxed state.
Piv Parameter |
Value |
---|---|
element_size |
5 |
window_size |
25 |
signal_to_noise |
1.1 |
drift_correction |
True |
62 # define the parameters for the piv deformation detection
63 piv_parameters = {'element_size': 5.0, 'window_size': 25.0, 'signal_to_noise': 1.1, 'drift_correction': True}
64
65
66 # iterate over all the results objects
67 for result in results:
68 # set the parameters
69 result.piv_parameters = piv_parameters
70 # get count
71 count = len(result.stacks)
72 if result.stack_reference is None:
73 count -= 1
74 # iterate over all stack pairs
75 for i in range(count):
76 # get two consecutive stacks
77 if result.stack_reference is None:
78 stack1, stack2 = result.stacks[i], result.stacks[i + 1]
79 # or reference stack and one from the list
80 else:
81 stack1, stack2 = result.stack_reference, result.stacks[i]
82 # and calculate the displacement between them
83 result.mesh_piv[i] = saenopy.get_displacements_from_stacks(stack1, stack2,
84 piv_parameters["window_size"],
85 piv_parameters["element_size"],
86 piv_parameters["signal_to_noise"],
87 piv_parameters["drift_correction"])
88 # save the displacements
89 result.save()