User Guide Overview
Welcome to the User Guide for the precon3d package! This guide provides comprehensive information on how to utilize the package for transforming mechanical serial sectioning data into valuable volumetric information. Below is an index of the chapters included in this guide, along with a brief overview of each section.
Table of Contents
-
- Understand the process of mechanical serial sectioning and how it relates to the creation of high resolution 3D volumes.
-
- Learn about the concept of tiles, how they can be extracted from CZI files, and their significance in managing large imaging datasets.
-
- Discover how mosaics are formed from tiles, the importance of tile alignment, and creating large montages.
-
- Explore the techniques for aligning consecutive slices using translational transforms.
-
- Read about the modifications made to collect polarized images at 15° increments, and the significance of this data.
-
- Understand the process of resampling data for even spacing and its importance in data analysis.
-
- Learn about the downscaling process, its impact on image resolution, and the importance of isotropic voxels in volumetric data.
-
- Review the capabilities of the
precon3dpackage and its goal of leveraging open-source Python libraries for data reconstruction.
- Review the capabilities of the
Getting Started
To get started with the precon3d package, follow the links in the table of contents to navigate to each chapter. Each section provides detailed information, examples, and references to help you effectively utilize the package for your research needs.
For further assistance or inquiries, please refer to the documentation or contact the support team.
Quickstart
After installing precon3d into your local python enviroment (either clone through git or use pip), follow the instructions below to begin processing data.
Using Fiji (Fiji Is Just ImageJ): Some configuration files will have an entry for your Fiji app (when a Fiji subroutine is used). For Windows, use the path to fiji.exe and for Macs, use the path to the Fiji.app/fiji.
The outline below will give you the general steps for preparing a 3D reconstuction of your serial sectioning data.
- Turn the
.cziimage data into stitched mosiacs. Seeprecon3d stitcher --help - Pad these images and downscale them so they are easier to view and manage. See
precon3d post_stitch --helpandprecon3d downscaler --help - Align the downscaled images. See
precon3d aligner --help
There are useful file management utilites available through
precon3d utility --help
Background
Mechanical Serial Sectioning
Mechanical serial sectioning is a technique used to create high-resolution images of multi-material samples by slicing them into thin sections. Each slice represents a cross-sectional view of the sample, allowing researchers to analyze its internal structures in detail.
Process Overview
-
Slicing the Volume: The sample is mounted and mechanically polished to remove a thin slice of material. Each slice is typically a few micrometers thick, enabling the capture of fine details.
-
Image Acquisition: Each slice is usually imaged using a high-resolution optical microscope. The resulting images are often large mosaics that capture the entirety of the slice.
-
Mosaic Creation: The images obtained from each slice are often stitched together to form a complete mosaic. This mosaic represents the entire slice and contains numerous tiles, each corresponding to a specific region of the slice.
Mechanical serial sectioning is a powerful approach for detailed analysis of complex structures in 3D, enabling advancements in research and development. precon3d is a open-source python package for preparing and reconstructing the data from this unique method.
Tiles
Overview
Tiles are essential components in the analysis of large-scale imaging data, particularly in the context of microscopy. They represent smaller, manageable sections of a larger image or dataset, allowing for efficient processing and analysis. In this section, we will explore how tiles can be extracted from CZI files and the significance of TileRegions and TileArrays in defining these tiles during experiments.
Extracting Tiles from CZI Files
CZI (Carl Zeiss Image) files are a common format used to store multi-dimensional imaging data.
We rely on the PyLibCZI from Allen Institute for Cell Science (AICS), built on top of libCZI from Zeiss.
| Dimensions Defined in libCZI | Dimensions Added by AICS PyLibCZI |
|---|---|
| V - View | M - Mosaic Tile (Mosaic Images Only) |
| H - Phase | Y - Image Height |
| I - Illumination | X - Image Width |
| S - Scene | A - Samples |
| R - Rotation | B - BGR/RGB Images Only |
| T - Time | |
| C - Channel | |
| Z - Z Plane (Height) |
In practice, the image data we are interested in from serial sectioning rely on the SCMYX structure.
Table of CZI Tile Data Structure
| TileRegion vs. TileArray | Dimensions |
|---|---|
| TileRegion, single channel, 4 individual tiles | [{‘X’: (0, 896), ‘Y’: (0, 896), ‘C’: (0, 1), ‘M’: (0, 4), ‘S’: (0, 1)}] |
| TileArray, single channel, 32 individual tiles | [{‘X’: (0, 4512), ‘Y’: (0, 4512), ‘C’: (0, 1), ‘S’: (0, 32)}] |
TileRegions and TileArrays
During the experimental setup, tiles are defined in terms of TileRegions and TileArrays. The differ slightly in terms of definition and are determined during data collection. precon3d attempts to differentiate and automatically process either of these formats.
TileRegion
A TileRegion uses a grid layout: Tiles are arranged in a rigid, rectangular grid format. In this case, the tile data in structured using the M mosaic tile dimension, see Table of CZI Tile Data Structure.
TileArray
A TileArray uses tile coordinates: The tile’s location in space is specified and doesn’t need to be a rigid, rectangular grid. In this case, the tile data in structured using the S scene dimension, see Table of CZI Tile Data Structure.
Shading Correction
In some cases a shading (aka background) correction is necessary.
Figure above is an example shading correction. (left) a smoothed result using BaSiC. (right) a background estimated with non-negative matrix factorization.
Figure above is a stitched mosaic without shading correction applied to tiles (left) vs. a stitched mosaic with shading correction applied to tiles (right). The sample shown here is an Additive Mannufactured Titanium alloy imaged with Polarized Light Microscopy.
Conclusion
Tiles play a crucial role in managing large imaging datasets. By extracting tiles from CZI files and understanding the concepts of TileRegions and TileArrays, the next section Mosaics will build on these ideas.
Mosaic
Overview
The mosaic is the collection of Tiles that together form a comprehensive representation of a larger image or dataset. Each tile contributes to the overall mosaic, allowing for detailed analysis of a specific region of interest.
Tile Alignment
To create a seamless mosaic, the tiles must be accurately aligned. This alignment process typically utilizes the overlap between adjacent tiles, which is usually around 30% at the edges of the images. This overlap ensures that there is sufficient information to accurately stitch the tiles together, minimizing gaps and misalignments in the final mosaic. We found Preibisch (2009) Grid Stitch Plugin for ImageJ performs well. We made some modification to run the plugin either as a python subprocess or run the pariwise registration in python.
The below example from an alpha Ti7Al alloy images with Polarized Light Microscopy illustrates this concept. This mosaic is composed of 20 individual tiles (4 rows by 5 columns).
{#stitched-tiles} Mosaic with original positions. The tiles placed in a mosaic with the original tile positions recorded by the stage during image. Note the regions of overlap are blurred since each tile is misaligned with respect to its neighboring tile.
{#stitched-tiles} Mosaic with corrected positions. The tiles placed in a mosaic with updated tile positions after stitching alignment. Note there is no blurring between indivdual tiles.
{#stitched-tiles}
Mosaic with blended with corrected positions. The tiles have been blended at the edges for seamless mosaic with no edge artifacts from the indivual tiles.
Stitcher
stitcher handles the operation of aligning a set of overlapping tiles into a large montage. The stitcher performs the following functions shown in the figure above:
-
Image Stitching: The stitcher identifies corresponding features in overlapping tiles to determine their alignment. This process involves computing phase correlation. If this fails, it is often due to inadequate overlap or a lack of matching features of interest in the images.
-
Blending: Once the tiles are stitched, the edges must be blended with their neighbors to create a smooth transition. The intensity in the overlapping areas is gradually adjusted between the two images. This process helps eliminate visible seams and artifacts that may arise from the stitching.
By effectively managing the alignment and blending of tiles, stitcher plays a vital role in producing high-quality mosaics that accurately represent the underlying data.
References
Preibisch, S., Saalfeld, S., & Tomancak, P. (2009). Globally optimal stitching of tiled 3D microscopic image acquisitions. Bioinformatics, 25(11), 1463–1465. doi:10.1093/bioinformatics/btp184
Image Alignment/Registration
Overview
Image alignment, also known as image registration, is a critical process in the analysis of multi-slice imaging data. It involves aligning consecutive slices of a specimen to ensure that they accurately represent the same spatial coordinates. This alignment is essential for creating a coherent three-dimensional representation of the specimen and for enabling accurate comparisons between slices.
Importance of Image Alignment
Proper alignment of consecutive slices is crucial for several reasons:
- Consistency: Ensures that features observed in one slice correspond to the same features in adjacent slices, allowing for accurate interpretation of the data.
- 3D Reconstruction: Facilitates the creation of three-dimensional models from two-dimensional slices, enhancing the understanding of the specimen’s structure.
- Quantitative Analysis: Enables reliable quantitative measurements across slices, such as volume calculations or density assessments.
Alignment Techniques
For aligning consecutive slices, we will focus on translational transforms and provide three effective options:
-
Fiji’s TurboReg: TurboReg is a plugin for the Fiji image processing software that allows for fast and accurate registration of images. It uses a translational transform to align images based on their overlapping regions, making it suitable for aligning consecutive slices with minimal computational overhead.
-
PhaseCorr: PhaseCorr is a method that utilizes phase correlation to achieve image registration. It is particularly effective for aligning images that may have slight translations. This technique works in the frequency domain, allowing for robust alignment even in the presence of noise or varying illumination.
-
Feature-Based SIFT: The Scale-Invariant Feature Transform (SIFT) is a feature-based method that detects and describes local features in images. By identifying key points and their descriptors, SIFT can align consecutive slices based on the spatial relationships of these features. Although it is more computationally intensive than the other methods, it can provide high accuracy in challenging alignment scenarios.
Process of Image Alignment
The image alignment process involves the following steps:
-
Preprocessing: Images may undergo preprocessing steps such as conversion to greyscale, noise reduction, contrast enhancement, or normalization to improve the quality of the alignment.
-
Selection of Alignment Method: Choose one of the three alignment methods (TurboReg, PhaseCorr, or SIFT) based on the specific requirements of the dataset and the expected transformations.
-
Application of Transformation: Apply the selected method to align the consecutive slices, ensuring that they are properly registered.
-
Validation: The alignment is validated by visually inspecting the registered images.
Polarized Image Data
In our research, we have modified our system to collect polarized images at 15° increments over a range from 0° to 180° (inclusive). This results in a total of 13 images, each representing a unique angle of polarization.
The ability to capture polarized images is crucial for analyzing the structural and optical properties of materials. By examining how light interacts with the specimen at different angles, researchers can gain insights into its composition and characteristics.
For more detailed information on the methodology and applications of polarized imaging, please refer to the following publication: DOI: 10.1093/mam/ozae044.132.
References
Chao, Paul, Rhianna M. Oakley, and Andrew T. Polonsky. “Application of polarized light microscopy for 3d materials science.” (2024) DOI: 10.1093/mam/ozae044.132.
Resample
Resampling is a crucial process in data analysis that involves adjusting the spacing of data points to achieve even distribution. This technique is particularly important when working with datasets that may have irregular spacing, as it allows for more consistent analysis and interpretation of the data.
By resampling the data, the voxels can become are uniformly spaced, which can enhance the accuracy of subsequent 3D analyses and visualizations.
For more details on the resampling methodology and its applications, please refer to the following publications:
Downscale
Downscaling is the process of resizing images to reduce their resolution. This is often necessary when we need to match the in-plane image resolution to the slice thicknesses of the data. For example, if the original image resolution is 0.5 μm/pixel and the slice thickness is 5 μm, a downscale operation can be performed to decrease the resolution by a factor of 10, resulting in a new resolution of 5 μm/pixel.
Importance of Downscaling
The downscaled volume of data will have isotropic (evenly shaped) voxels with a resolution of 5 μm/voxel (here, the in-plane resolution is adjusted to match the slice thickness). This isotropic resolution is crucial for accurate three-dimensional reconstructions and analyses, as it ensures that the dimensions of the voxels are uniform in all directions.
It is important to note that during the downscaling process, we do not infill any data. As a result, the voxel resolution is inherently limited by the slice thickness. This means that while downscaling can help achieve a more uniform voxel shape, the quality and detail of the data may be constrained by the original slice thickness.
By carefully managing the downscaling process, the datasets can be optimized for analysis while maintaining the integrity of the information contained within the images.
Conclusion
This precon3d package provides routines for turning mechanical serial sectioning data into useful volume information.
precon3d 🧊 -- (PRE)pare serial sectioning montage data for (RECON)struction in (3D)
It leverages open-source Python libraries to facilitate the reconstruction of data from large field-of-view microscopy image stacks. By utilizing these tools, users can efficiently analyze and visualize complex data, enhancing their understanding of the underlying biological structures.
The precon3d package represents our efforts for integration of imaging data processing and analysis, making it easier for scientists to derive meaningful insights from their experiments.