Skip to main content

Test PyPI version

fibermorph

Interactive toolkit for analyzing hair fiber morphology

fibermorph provides powerful image analysis tools for studying hair curvature and cross-sections, with both an intuitive graphical interface and a command-line interface for advanced users.

The easiest way to use fibermorph is through the interactive web interface:

# Create a conda environment with Python 3.11
conda create -n fibermorph_env python=3.11
conda activate fibermorph_env

# Install fibermorph with the GUI
pip install "fibermorph[gui]"

# Launch the interactive GUI
fibermorph-gui

This opens an interactive web interface where you can:

  • 📤 Upload images: Single or multiple TIFF files, or provide a URL to download
  • 🔬 Choose analysis type: Curvature or Section analysis
  • ⚙️ Configure parameters: Adjust settings with interactive controls
  • 💾 Download results: Get CSV summary data and ZIP file with all analysis outputs

✨ Try it online: https://fibermorph.streamlit.app/

📦 Installation

# Create environment (Python 3.10-3.12 supported)
conda create -n fibermorph_env python=3.11
conda activate fibermorph_env

# Install with GUI
pip install "fibermorph[gui]"

Alternative: pip with virtual environment

# Create virtual environment
python3.11 -m venv fibermorph_env

# Activate the environment
# On macOS/Linux:
source fibermorph_env/bin/activate
# On Windows:
fibermorph_env\Scripts\activate

# Install fibermorph with GUI
pip install "fibermorph[gui]"

Supported Python versions: 3.10, 3.11, 3.12. We recommend Python 3.11 for the best compatibility.

Note: Python 3.13 support is planned but not yet available due to dependency compatibility issues.

Optional extras

pip install "fibermorph[raw]"    # enable RAW image conversion via rawpy
pip install "fibermorph[viz]"    # install matplotlib-based visualization helpers
pip install "fibermorph[gui]"    # install Streamlit GUI (recommended!)

Extras can be combined, e.g. pip install "fibermorph[raw,viz,gui]".

🖥️ Command Line Interface (Advanced Users)

For automation, scripting, and batch processing, fibermorph provides a powerful CLI:

Quick test with demo data

fibermorph --demo_real_curv --output_directory ~/fibermorph_demo_curv
fibermorph --demo_real_section --output_directory ~/fibermorph_demo_section

Analyze your own data

Curvature analysis:

fibermorph --curvature \
  --input_directory /path/to/images \
  --output_directory /path/to/results \
  --resolution_mm 132 \
  --jobs 2

Section analysis:

fibermorph --section \
  --input_directory /path/to/images \
  --output_directory /path/to/results \
  --minsize 30 \
  --maxsize 180 \
  --resolution_mu 4.25 \
  --jobs 2

Install the package

  1. After having activated your new virtual environment, you can simply run pip install fibermorph. You can find the latest release here on this GitHub page and on the fibermorph PyPI page.
  2. You have successfully installed fibermorph. The package is now ready for use. Enter fibermorph -h or fibermorph --help to see all the flags. You can keep reading to try out the demos and read instructions on the various modules within the package.

Demo data

Before using this on any of your own data, it's recommended that you test that you test whether fibermorph is working properly on your machine. There are a few demo modules you can use to check whether fibermorph is running correctly.

Testing with real data

You can test both the curvature and section modules with real data that is downloaded automatically when you run the --demo_real modules.

In both cases, all you need to do is specify a folder path where the images and results can be created with ---output_directory or -o. This folder can be existing, but you can also establish a new folder by including it in the new path.

Both modules will download the demo data into a new folder tmpdata within the path you gave. Then, fibermorph will run the curvature or section analysis, and the results will be saved in a new folder results_cache at this same location. It is recommended that you specify a path with a new folder name to keep everything organized.

Testing curvature analysis

--demo_real_curv

This flag will run a demo of fibermorph curvature analysis with real data. You will need to provide a folder for the demo data to be downloaded.

To run the demo, you will input something like: fibermorph --demo_real_curv --output_directory /Users/<UserName>/<ExistingPath>/<NewFolderName

Testing section analysis

--demo_real_section

This flag will run a demo of fibermorph section analysis with real data. You will need to provide a folder for the demo data to be downloaded.

To run the demo, you will input something like: fibermorph --demo_real_section --output_directory /Users/<UserName>/<ExistingPath>/<NewFolderName

Curvature

To calculate curvature from grayscale TIFF images of hair fibers, the flag --curvature is used with the following flags in addition to input and output directories:

--resolution_mm       	Integer. Number of pixels per mm for
						curvature analysis.
						Default is 132.
--window_size  [ ...] 	Float or integer or None. Desired size for
						window of measurement
						for curvature analysis in pixels or mm (given
						the flag --window_unit). If nothing is entered, the default
						is None and the entire hair will be used to for the curve fitting."
--window_unit {px,mm}	String. Unit of measurement for window of
						measurement for curvature
                      	analysis. Can be 'px' (pixels) or 'mm'. Default is 'px'.
-W, --within_element  	Boolean. Default is False. Will create
						an additional directory with
                      	spreadsheets of raw curvature measurements for each hair if the
                      	--within_element flag is included.
-s, --save_image      	Default is False. Will save intermediate
						curvature/section processing images if
						--save_image flag is included.

So, to run a curvature analysis, you would enter e.g.

fibermorph --curvature --input_directory /Users/<UserName>/<ImageFolderPath> --output_directory /Users/<UserName>/<ExistingPath>/ --window_size 0.5 --window_unit mm --resolution_mm 132 --save_image --within_element --jobs 2

Section

To calculate cross-sectional properties from grayscale TIFF images of hair fibers, the flag --section is used with the following flags:

--resolution_mu       Float. Number of pixels per micron for section analysis. Default is 4.25.
--minsize             Integer. Minimum diameter in microns for sections. Default is 20.
--maxsize             Integer. Maximum diameter in microns for sections. Default is 150.

An example command would be:

fibermorph --section --input_directory /Users/<UserName>/<ImageFolderPath> --output_directory /Users/<UserName>/<ExistingPath>/ --minsize 20 --maxsize 150 --resolution_mu 4.25 --jobs 2

Converting raw images to grayscale TIFF

This package features an additional auxiliary module to convert raw images to grayscale TIFF files if necessary: --raw2gray

In addition to the input and output directories, the module needs the user to specify what file extension it should be looking for.

--file_extension      Optional. String. Extension of input files to use in input_directory when
                      using raw2gray function. Default is .RW2.

A user could enter, for example:

fibermorph --raw2gray --input_directory /Users/<UserName>/<ImageFolderPath> --output_directory /Users/<UserName>/<ExistingPath>/<NewFolderName> --file_extension .RW2 --jobs 4

Metadata

Release files for fibermorph 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fibermorph 1.0.1
File Size Uploaded
fibermorph-1.0.1.tar.gz 110.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fibermorph 1.0.1
File Interpreter ABI Platform
fibermorph-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 234.7 kB

Release files / fibermorph-1.0.1.tar.gz

Download URL fibermorph-1.0.1.tar.gz
Size 110.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7c7cee959abaca8cade389f98791b7b220be58be7140a6f8d5e09b0683ee9285
BLAKE2b-256 checksum
How to use checksums
9785862269a1a069fff7a633f0fa65638d89b649036cdb2eeea9f398f9bb7316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2025.

Transparency log

Release files / fibermorph-1.0.1-py3-none-any.whl

Download URL fibermorph-1.0.1-py3-none-any.whl
Size 123.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c659867ede8656d0b0f04a5c4c5a0b8b209176703efe38a96042de35a44a1b17
BLAKE2b-256 checksum
How to use checksums
446011bccec361a1cf780943ced75c308e0fd3e89ad051f0f083f34359093d68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2025.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page