SPAM Software Functions for Large Image Manipulation and Particle Identification
Creators
Description
Several Python function have been developed and implemented in spam
, an open-source python tool for quantitative data analysis for 2D images and 3D volumes for mechanics applications that has developed around x-ray and neutron tomography.
In particular, the function address problems related to the manipualtion of large datasets, as well as particle identification.
Large images manipulation
splitImage:
The function divides a 3D numpy array (image) into smaller blocks with specified divisions along the Z, Y, and X axes, and adds a margin around each block. It returns a dictionary where each key represents a block's position, containing the block's origin and the padded block itself. The function ensures that divisions and margins are appropriately set, and it prints parameters if verbose is enabled.
rebuildImage:
The function reassembles the blocks created by splitImage back into a single 3D image, removing the margins. It takes lists of the blocks and their corresponding coordinates, along with the margin and mode ('grey' for greyscale or 'label' for labelled arrays). The function ensures proper alignment and combines the blocks, optionally preserving labels, and provides progress updates if verbose is enabled.
Particle identification and labelling
detectUnderSegmentation:
The function calculates the undersegmentation coefficient for each particle in a labeled 3D image. It is defined as the ratio of the convex volume to the actual volume, helping identify particles that are undersegmented.
detectOverSegmentation:
The function computes the oversegmentation coefficient for each particle, defined as the ratio between the characteristic length of the maximum contact area and a characteristic length of the particle. It also identifies the neighboring label with the maximum contact area.
fixUndersegmentation:
The function addresses undersegmentation by performing a watershed segmentation with a higher local threshold for problematic labels. It uses normalized greyscale images and specified target labels to refine the segmentation.
fixOversegmentation:
The function resolves oversegmentation by merging each target label with its neighboring label, identified by the oversegmentation coefficient. It uses a labeled 3D image and the shared labels to perform the merging process.
Files
Files
(32.9 kB)
Name | Size | Download all |
---|---|---|
md5:326072eba2b021e5c8ac6a030737236c
|
17.6 kB | Download |
md5:7b18ab63ce09d5569d41c59dc92955f9
|
15.3 kB | Download |
Additional details
Related works
- Is part of
- Journal article: 10.21105/joss.02286 (DOI)
Funding
Software
- Repository URL
- https://gitlab.com/spam-project/spam/-/tree/master/src/spam?ref_type=heads
- Programming language
- Python