Skip to content

AminiLabNU/Multiphoton-Quantitative-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Methods Manuscript Code — Usage Guide

This repository contains MATLAB code used for the Methods/Results analyses accompanying the manuscript "An Integrated Multiphoton Imaging Workflow for Quantitative Analysis of Aortic Tissue Microstructure" Manuscript DOI: TBD.

The DOI for this repository is: https://doi.org/10.5281/zenodo.18234603

  • Volume Fraction/ — collagen/elastin/other volume fractions from 3D multiphoton stacks
  • Collagen/ — collagen fiber waviness/straightness, orientation distributions, porosity/linear density
  • Cell Nuclei/ — nuclear aspect ratio (NAR) and nuclear orientation from 3D segmentations
  • Elastin/ — elastin lamella thickness from 2D cross-sections via manual boundary tracing + circle fits

Each subfolder is intended to be runnable independently (with its own inputs), but files within a subfolder typically call one another.


1) Requirements

MATLAB

Developed/tested with MATLAB R2022b+ (newer should be fine).

Toolboxes commonly required

  • Image Processing Toolbox (e.g., imgaussfilt3, isosurface, bwconncomp, regionprops, adaptthresh, drawpolygon)
  • Statistics and Machine Learning Toolbox (e.g., rmoutliers)

Many scripts include absolute paths (e.g., OneDrive locations). You must edit those config variables to point to your local data directories.


3) Module: Volume Fraction

Goal

Compute volume fractions (VF) of collagen, elastin, and other wall content using fixed intensity thresholds applied consistently across samples.

Expected data layout (example)

<baseCtrl>/<MouseID>/collagen_<P>mmHg.tiff
<baseCtrl>/<MouseID>/elastin_<P>mmHg.tiff

<basePreg>/<MouseID>/collagen_<P>mmHg.tiff
<basePreg>/<MouseID>/elastin_<P>mmHg.tiff

Main scripts

A) make_fixed_thresholds.m (run once)

Purpose: Build fixed thresholds from a balanced subset of Control/Pregnant data.

What you must edit:

  • baseCtrl, basePreg (top of file)
  • pressures, samplesPerGroupPerPressure (optional)

Outputs:

  • VF_thresholds_fixed.mat
  • VF_thresholds_fixed.txt

B) volume_fraction_all_samples.m

Purpose: Apply fixed thresholds to all samples, generate CSV + summary figures.

What you must edit:

  • baseCtrl, basePreg
  • zxlsPath (Excel file for Z-resolution if used)
  • dx, dy (XY pixel size in µm)

Outputs:

  • A results CSV (written by the script)
  • Figures summarizing VF vs pressure and aggregate stacked bars

C) vf_robustness_demo.m

Purpose: Robustness checks (threshold stability, morphology sensitivity) using synthetic/phantom-style tests.


4) Module: Collagen

Goal

Quantify collagen fiber geometry and organization across pressure:

  • Fiber waviness/straightness distributions (often stored as “allWaviness”)
  • Orientation distributions and von Mises / mixture fits
  • Linear density and/or porosity-related metrics

Data assumptions

Most collagen scripts expect per-sample folders containing per-pressure MATLAB files like:

  • results_<P>mmHg.mat

Some scripts create these results files from ctFIRE outputs.

Typical workflow (recommended)

Step 1 — Extract fiber metrics from ctFIRE (creates results_<P>mmHg.mat)

Run:

  • collagen_fiber_extraction_control.m

Inputs (ctFIRE):

  • Plane-wise ctFIRE outputs such as ctFIREout_<P>mmHg*.mat (pattern described in the file header)

Outputs (per sample, per pressure):

  • results_<P>mmHg.mat containing vectors like:
    • allWaviness
    • allTrueLengths
    • allOrientationAngles

This script calls LabelBranchesAM, but it can be commented out or deleted.

Step 2 — Waviness analysis across pressure

Run:

  • straightness_complete_analysis_Circ_and_Axial.m

Purpose:

  • Filters fibers by length
  • Splits by orientation (circumferential vs axial)
  • Fits Beta distributions to waviness
  • Plots group mean ± SEM vs pressure

Important note: If the file begins with a markdown fence (e.g., ```matlab), remove that line before running in MATLAB.

Step 3 — Orientation distributions across pressure

Options depending on what you want to report:

  • compute_fiber_orientation_distribution.m
    Builds angle histograms across pressures from allOrientationAngles stored in results_<P>mmHg.mat.

  • Select_peaks_manual_6parameter.mlx and select_peaks_manual_methods_paper_syntheticIM.m
    Manual peak selection + fitting (two-fiber von Mises style). Use when you want interactive control over peaks.

Step 4 — 3D reconstructions from ctFIRE overlay TIFFs (optional)

Run:

  • get_all_3d_collagen_reconstructions.m

Inputs:

  • Overlay images OL_ctFIRE_<P>mmHg*.tif exported by ctFIRE

Outputs:

  • Multi-page 3D binary TIFF stacks per sample/pressure (see script header)

Step 5 — Density / porosity analyses (optional)

  • porosity_linear_density.m
    Computes total traced length per unit imaged area vs pressure.

  • collagen_porosity_with_width_extraction.m
    End-to-end network analysis combining average fiber width extraction and porosity logic. This script expects to be run from a directory containing group folders.

Other helper functions used by fitting scripts:

  • Error_Calc_6_parameter.m
  • nonlinear_constraints.m
  • amplitude.m

5) Module: Cell Nuclei (NAR)

Goal

Compute nuclear aspect ratio (NAR) and orientation from 3D nuclei segmentations.

Typical workflow

Step 1 — Threshold / segment nuclei

  • threshold_Image.m
    Uses Gaussian smoothing + background subtraction + Otsu thresholding and removes small components.

Input:

  • Original (3D grayscale volume)

Output:

  • binaryImage (3D logical mask)

Step 2 — (Optional) Select subsets of nuclei based on flattened geometry

  • get_Fibrin_centroids.m
    Computes centroids and performs a cylindrical/flattening style radial selection to separate populations.

Step 3 — Convert centroid selection into a binary mask

  • process_centroids.m
    Given a labeled image and centroid list, returns a mask containing the full objects at those centroids.

Step 4 — Compute NAR and orientation

  • nar_all_cells.m
    For each connected surface component (via isosurface + mesh connectivity), fits an ellipsoid and computes:

    • NAR(k) = a/c (major/minor semi-axis)
    • V1_all(k,:) major-axis direction
    • theta_all(k) in-plane angle from XY projection of V1

    Also returns inliers after rmoutliers:

    • NAR2, V1_inliers, theta_inliers, inlier_mask

This calls:

  • calculate_ellipsoid_axes_STL_DATA.m

Step 5 — Summaries/plots

  • nar_violin_plots.m
    Generates violin plots / summary statistics (expects saved .mat files with NAR arrays).

Example driver

  • M33Control.m
    Example “batch” driver for one sample folder containing multiple pressure TIFFs. Edit folderPath and the filename→metadata mapping at the top.

6) Module: Elastin (Lamella thickness)

Goal

Measure elastin lamella thickness from 2D cross-sectional images by:

  1. thresholding/enhancing image (optional),
  2. manually tracing boundaries,
  3. fitting circles to traced boundaries,
  4. computing thickness (outer radius − inner radius).

Typical workflow

Step 1 — Manual boundary tracing (single inner/outer boundary)

  • Extract_Coordinates.m
    • loads a binary image (or thresholds a grayscale image inside the script)
    • prompts for pixel sizes
    • uses drawpolygon to trace inner and outer boundaries
    • saves:
      • innerBoundary.mat
      • outerBoundary.mat

Step 2 — Fit circles + compute thickness (single layer)

  • Run_Coordinates.m
    • loads innerBoundary.mat and outerBoundary.mat
    • uses fitCircleRobust.m + helpers to fit circles
    • prints fitted parameters and thickness
    • plots fitted circles

Multi-layer lamellae

  • Extract_Coordinates_Lamellae.m

    • interactive tracing of multiple inner/outer boundaries
    • saves a consolidated .mat file into Coordinates/
  • Run_coordinates_multiplelayers.m

    • loads a processed coordinate .mat from Coordinates/
    • performs thresholding display and metadata prompts
    • hands off to circle fitting / thickness logic (see file)

Supporting circle-fitting utilities

  • fitCircleRobust.m
  • fitCircleWithFixedCenter.m
  • circleError.m, circleRadiusError.m
  • Circle_Layers.m
  • Lamellae_Thickness.m
  • Combined_Thickness_Distribution.m
  • Finding_Sensitivity.m
  • Thresholding_Sample.m (standalone threshold exploration)

Example .mat inputs are included:

  • Lamellae_Raw_M1_Pregnant_20 mmHg.mat
  • Lamellae_Raw_M2_Control_80mmHg.mat

7) Common issues and troubleshooting

“File not found” or wrong directories

Most scripts assume a specific directory layout and/or absolute paths. Fix by editing the baseDir / folderPath / imagePath variables near the top of the script.

Orientation/angle conventions

Some scripts compute angles in degrees, others plot in radians. When comparing across modules, confirm:

  • angle range (e.g., 0–90 vs 0–180)

rmoutliers behavior

rmoutliers uses defaults; if you need a specific outlier policy for the manuscript, document the method/threshold and pass name-value args explicitly in your final analysis version.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages