MATLAB Utilities: A Decade of Modular Problem-Solving

Open-source collection of microscopy analysis tools demonstrating incremental, organized approach to research software development

Quick Takeaways

Core Idea: Organize research code early (while you have 10 functions, not 1,000) and build foundations that enable future innovation

Philosophy: “Show your warts”—develop in the open, exposing evolution and iterations, not just the polished final result

Impact: Foundation for Hydra Image Processor and Direct 5D Viewer, used at elite research institutions and collaborating laboratories worldwide

Key Lesson: The best time to organize is before you have to—modularity compounds, each reusable function becomes foundation for the next

Timeline: Started 2013, continuous development through 2024 (11+ years), demonstrates sustained research practice

Authenticity: Public from early stages—mistakes, learning moments, and incremental improvements visible in commit history

GitHub → | MATLAB File Exchange →


The Philosophy: Building Foundations While It’s Still Easy

In 2013, I made a decision that would shape how I approach software development: I started tracking and organizing the helper functions I was building for microscopy analysis before they became a tangled mess.

This wasn’t a grand architectural vision. It was a practical choice: organize early, while it’s still easy. Track utilities modularly. Make them reusable. Document as you go.

Over a decade later, this collection has grown into the foundation that enabled Hydra Image Processor and Direct 5D Viewer.

The Challenge: Research Code vs. Research Software

Research environments create a specific software development trap:

The pressure: Get results quickly for the next paper The consequence: Write one-off scripts that solve today’s problem The accumulation: Years of copy-pasted code, modified slightly each time The cost: Bug fixes require editing dozens of files; improvements never propagate

Most researchers accept this as inevitable. I decided to resist it.

MATLAB Utilities represents a different approach: treat research code like production software from day one.

The Solution: Modular, Organized, Shared

Rather than treating utilities as disposable scripts, I organized them into a structured system:

Core Principles:

  • Modular packages - Functionality grouped by purpose (image processing, file I/O, visualization, metadata handling)
  • Unified interfaces - Consistent APIs across utilities (e.g., single reader function for all microscope formats)
  • Version control - Track changes, enable collaboration, maintain history
  • Open development - Public repository showing evolution, including mistakes and iterations

Key Utilities:

MicroscopeData Package

The centerpiece: a unified reader/writer system for microscope images.

The Problem: Each microscope vendor uses different file formats. Analysis scripts become cluttered with format-specific reading code.

The Solution: Single command loads any format:

[image, metadata] = MicroscopeData.Reader();

Metadata stored in JSON files enables consistent reading across formats. Output always returned as standardized 5-D matrix (y, x, z, channel, time) regardless of input format.

Impact: Write analysis code once, apply to any microscope data.

Additional Capabilities

Image Processing:

  • Denoising algorithms optimized for microscopy noise characteristics
  • Multi-scale filtering and enhancement
  • Morphological operations for biological structures

File Format Support:

  • TIFF (including multi-page, OME-TIFF)
  • Keller Lab Block (KLB) compressed format
  • Zeiss CZI, Nikon ND2, and other proprietary formats
  • Integrates Bio-Formats reader under the hood for known formats
  • Key advantage: Users focus on using data, not loading it—regardless of file format

Analysis Tools:

  • Image registration (correcting motion/drift)
  • Color unmixing for multi-fluorophore experiments
  • Segmentation helpers and validation utilities

Visualization & Export:

  • Web export for sharing results
  • Movie creation from time-lapse data
  • Interactive plotting utilities

The Impact: Foundation for Innovation

Enabling Larger Projects

These utilities became the foundation for more ambitious work:

Hydra Image Processor (2019)

  • Built on data structures and interfaces from MATLAB Utilities
  • Unified reading system enabled seamless GPU acceleration
  • Consistent metadata handling made multi-dimensional processing reliable

Direct 5D Viewer (2018)

  • Leveraged the same data formats and metadata standards
  • Shared utilities reduced development time
  • Consistent interfaces enabled tight integration

Dissemination Through MATLAB File Exchange

Making tools accessible matters. All three major projects posted to MATLAB File Exchange for maximum reach:

Hydra Image Processor

  • Version 3.1.3 (December 2024)
  • 22 downloads, 5.0/5.0 rating
  • GPU-accelerated processing accessible to non-CUDA programmers

Direct 5D Viewer

  • Version 2.0 (December 2024)
  • 9 downloads
  • Interactive visualization for 2D-5D datasets

Microscope Utilities

  • Version 2.0.1 (December 2024)
  • 20 downloads
  • Over a decade of functions for microscopy data manipulation

Real-World Usage

Research Deployment:

  • Used at elite research institutions for microscopy analysis workflows
  • Adopted by collaborating laboratories worldwide
  • Foundation for reproducible research pipelines

Educational Value:

  • Shows evolution of research software over time
  • Demonstrates incremental improvement approach
  • Provides examples for common microscopy analysis tasks

Technical Details

Repository Structure

Organization: MATLAB packages (directories prefixed with +) for clean namespacing

Primary Packages:

  • +MicroscopeData - Unified image reading/writing
  • +ImUtils - Image processing utilities
  • +Registration - Drift correction and alignment
  • +Segmentation - Cell/structure segmentation helpers
  • +Visualization - Plotting and display functions
  • +FileUtils - Format conversion and I/O

Source Layout: Code in src/MATLAB with per-package subdirectories

Setup Method: Uses startup.m script to automatically add packages to MATLAB path (rather than copying to MATLAB’s default folders)

  • Preserves version control integration
  • Enables managing multiple related repositories centrally
  • Keeps installation simple and reversible

Development History

Created: July 2018 (repository), with utilities dating back to 2013 Language: MATLAB (99.6%) Contributors: Eric Wait (lead), Andrew Cohen, Mark Winter, Blair Rossetti Active Development: Ongoing maintenance and feature additions

Integration Philosophy

Rather than standalone utilities, these tools are designed to compose:

  • Consistent data formats enable piping between functions
  • Shared metadata structures prevent information loss
  • Modular design allows mixing and matching capabilities

This compositional approach enabled rapid prototyping of complex analysis workflows.


GitHub Repository: github.com/ericwait/matlab-utilities

MATLAB File Exchange:

Technical Stack:

  • MATLAB for scientific computing
  • JSON for metadata standardization
  • Multiple microscope format readers
  • Modular package organization