May 13, 2025

Public workspace3D distance measurements & rendering with AIVE results

  • Benjamin Padman1
  • 1UWA
Icon indicating open access to content
QR code linking to this content
Protocol CitationBenjamin Padman 2025. 3D distance measurements & rendering with AIVE results. protocols.io https://dx.doi.org/10.17504/protocols.io.dm6gpdrz8gzp/v1
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working
Created: March 31, 2025
Last Modified: May 13, 2025
Protocol Integer ID: 125737
Funders Acknowledgements:
Aligning Science Across Parkinson’s (ASAP)
Grant ID: ASAP-000350
Disclaimer
DISCLAIMER – FOR INFORMATIONAL PURPOSES ONLY; USE AT YOUR OWN RISK

The protocol content here is for informational purposes only and does not constitute legal, medical, clinical, or safety advice, or otherwise; content added to protocols.io is not peer reviewed and may not have undergone a formal approval of any kind. Information presented in this protocol should not substitute for independent professional judgment, advice, diagnosis, or treatment. Any action you take or refrain from taking using or relying upon the information presented here is strictly at your own risk. You agree that neither the Company nor any of the authors, contributors, administrators, or anyone else associated with protocols.io, can be held responsible for your use of the information contained in or linked to this protocol or any of our Sites/Apps and Services.
Abstract
Procedure for conducting 3D distance measurements and visualizations (with Paraview and Blender Respectively)
Materials
Before start
Triangulating 3D surfaces for AIVE results is straightforward, but there are 2 considerations you may need to address before getting started.

Consideration 1: The membranes might appear to be "open" (unsealed) at the boundaries of the dataset.
This occurs because there is insufficient information beyond the boundary to determine whether the surface should end or continue. This can be prevented by adding an empty border around the dataset, which defines where dataset ends and where membranes should be closed.

Consideration 2: The data orientation might appear to be flipped in X/Y/Z when viewed in 3D.
This can happen because X/Y/Z can be defined differently depending on your 3D program of choice. You can fix that by performing a pre-emptive flip transformation before loading it into your program of choice.

To resolve both of these problems, we provide a script for ImageJ/FIJI, which can perform either of these functions. The script is available on GitHub ("Post-AIVE - PrepDataFor3DEnvironments.ijm"), and the use of this script has been detailed as an optional first section in this protocol.
Prepare the AIVE results for 3D environments
Prepare the AIVE results for 3D environments
Follow this stage if your data appears to be flipped on any axis, or the membrane surfaces appear to be "open" at the boundaries of your dataset:

Open FIJI/ImageJ.

Drag and drop the "Post-AIVE-PrepDataFor3DEnvironments.ijm" script into the FIJI window.
Inspect the script in the macro editor window; there is a section at the top of the script, with parameters that will allow you to adjust the AIVE data before importing into a 3D environment.
  • BorderExpansionDistance - this parameter allows you to add an empty border to all perimeters of the dataset, thus ensuring that all surfaces will be closed. The numerical value defines the "thickness" of this border in pixels.
  • FlippedX - This parameter flips the dataset in the X dimension (0 = no flip; 1 = flip)
  • FlippedY - This parameter flips the dataset in the Y dimension (0 = no flip; 1 = flip)
  • FlippedZ - This parameter flips the dataset in the Z dimension (0 = no flip; 1 = flip)

Note
The X/Y/Z flip directions are defined according to their definition in ImageJ, which may differ from their definition in other 3D viewing platforms.

Once the desired parameters are set, run the script.

Select the directory containing the AIVE results you want to process.

Note
WARNING: This script will over-write the contents of that directory


Optional
3D Reconstruction of AIVE Results in Paraview
3D Reconstruction of AIVE Results in Paraview
Open Paraview.
In the Paraview window, open one of the AIVE result TIFF stacks (File → Open)

If prompted, select the Tiff Series Reader.
In the "Properties" tab, enable the "Use Custom Data Spacing" option.

In each of the 3 text boxes below that option, enter the spatial dimensions of your voxels in X/Y/Z dimensions respectively.

Press the Apply button.
Note
If you intend to use Blender for rendering, try entering the voxel dimensions in micrometers instead of nanometers. Blender initially assumes that the imported dimensions are in meters, so anything larger than a micron would be kilometers in scale!

Blender tends to hide objects in the viewport when they are "kilometers away", so its easier to make this adjustment prior to Blender.

In the "Pipeline Browser" tab, right click the imported dataset.

Select "Contour Filter" (Add Filter → Alphabetical → Contour Filter)

In the "Properties" tab, navigate to the "Isosurfaces" section.
Change the "Value Range" setting to 64.

In the "Properties" tab, navigate to the "Point Locator" section.
Set the "Point Merge Method" setting to Octree Binning.
Set the "Max Number of points per leaf" to 256.

Press the Apply button at the start of the "Properties" tab, and wait for the process to complete.
Wait for the process to complete.
Expected result
A 3D surface will now be visible in Paraview layout window.

The 3D surface can now be exported as an x3d file for Blender: (File → Export Scene)
Mapping 3D Distances Between Surfaces in Paraview
Mapping 3D Distances Between Surfaces in Paraview
Download the custom distance mapping filter (see Materials section)
Open Paraview.
  • Open the Custom Filters manager (Tools → Manage Custom Filters...), and a new dialog will open.
  • Press the "Import" button in the new dialog.
  • Select the downloaded 3D distance map filter ("Distance_Of_A_Mapped_To_Surface_B.cpd")
  • Press OK.
Note
Two different surfaces are required to apply the distance map filter.
To generate these surfaces, follow the instructions outlined in "3D reconstruction of AIVE results" twice, using AIVE results for two different classes of organelle from the same dataset.

To proceed, there must be two different contoured surfaces available the "Pipeline Browser" tab.

In the "Pipeline Browser" tab, right click one of the two contoured surfaces.
Select the 3D distance map filter (Add Filter → Alphabetical → Distance of A Mapped to Surface B).
A new dialog will appear, for selecting the inputs to use for the 3D distance map filter.

Under the "Available Input Ports" section, click the first circle button.
Under the "Select Input" heading, select the surface you intend to measure distances from.

Under the "Available Input Ports" section, click the second circle button.
Under the "Select Input" heading, select the surface you intend to map the distance values to.

Press OK. (This will close the dialog box.)
Press the Apply button in the "Properties" tab.

Wait for the distance measurements to be completed.
To visualize the 3D distance measurements, Left-click the "DistanceofAMappedToSurfaceB" item in the "Pipeline Browser" tab, then change the "Coloring" setting (in the "Properties" tab) to "distance".

The 3D surface will now be colorized to indicate its distance from the reference object.

The minimum and maximum values in the "Color Map Editor" can then be used to adjust the range of distances displayed on the surface.

Note
Exporting this result as an x3d file retains these distance values, which are available as "vertex colors" after import into Blender.

Note
The raw numerical values from distance measurements can also be inspected in SpreadSheet View for quantitative analysis.

Import into Blender for 3D rendering
Import into Blender for 3D rendering
Open Blender
Import the x3d file (File → Import → X3D extensible 3D (.x3d/.wrl))
Set up the scene for rendering by arranging your data, applying your preferred materials, and configuring the lighting & camera.
Render your AIVE result.