Skip to content

hmarichal93/tras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,998 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌲 TRAS β€” Tree Ring Analyzer Suite

TRAS Logo

Professional dendrochronology software for automatic tree ring detection and measurement

Accepted as a Software Article at Forestry: An International Journal of Forest Research

Release Downloads License Python arXiv

Overview β€’ Features β€’ Installation β€’ Quick Start β€’ Workflow β€’ Citations


🎯 Overview

TRAS integrates state-of-the-art computer vision and deep learning methods for dendrochronology research. Automatically detect tree rings, measure ring widths, and export data in standard formats β€” all through an intuitive graphical interface, a programmatic Python API, or a command-line tool for batch jobs.

TRAS Main Interface

Three ways to use TRAS:

Interface Command Best for
πŸ–₯️ GUI tras Interactive annotation, single samples, batch folders
⌨️ CLI tras_detect Scripting, reproducible batch pipelines
🐍 Python API from tras.api import detect Custom workflows and integration

✨ Key Features

πŸ”¬ Automatic Detection

  • APD β€” Automatic Pith Detection (~1 s, CPU); methods apd, apd_pcl, apd_dl (YOLO)
  • CS-TRD β€” Classical edge detection (~73 s, CPU) [Linux/macOS only]
  • DeepCS-TRD β€” Deep learning U-Net (~101 s, GPU)
  • INBD β€” Iterative Next Boundary Detection (CVPR 2023, GPU)
Detection Methods

πŸ–ΌοΈ Preprocessing

  • Smart crop with edge warnings
  • Resize (10–100 % scaling)
  • U2Net background removal
  • Full parameter tracking
Preprocessing

πŸ“ Scale Calibration

  • Draw a known-length segment
  • Direct ΞΌm/cm/mm input
  • Auto-adjust on resize
  • Physical-unit exports
Scale Calibration

πŸ“Š Analysis & Export

  • Ring properties (area, perimeter)
  • Radial width measurements
  • Year-based labeling
  • JSON, CSV & .POS formats
Analysis

πŸ“„ Professional PDF Reports

Generate comprehensive reports with a single click:

  • Sample metadata and summary statistics
  • Ring overlay with detected boundaries
  • Multi-panel analysis plots (area, growth rate, radial width)
  • Ready for publication or archival

Report Page 1
Cover Page
Report Page 2
Ring Overlay
Report Page 3
Analysis Plots


πŸ“¦ Installation

Windows users: run every command below from the Anaconda Prompt (search "Anaconda Prompt" in the Start menu), not the regular Command Prompt. CS-TRD is unavailable on Windows β€” use DeepCS-TRD instead.

Prerequisites

1. Download TRAS

Linux / macOS:

export TRAS_VERSION=2.1.9          # update when a newer release is available
wget https://github.com/hmarichal93/tras/archive/refs/tags/v${TRAS_VERSION}.tar.gz
tar -xzf v${TRAS_VERSION}.tar.gz
cd tras-${TRAS_VERSION}

Alternative: download manually from Releases and extract, then cd into the extracted folder.

2. Create the Environment

conda env create -f environment.yml
conda activate tras
pip install -e .

3. Download Model Weights

python tools/download_release_assets.py

Fetches all required model weights, including the APD YOLO weights (downloaded_assets/apd/yolo/all_best_yolov8.pt) used by the apd_dl method.

4. Compile the Devernay Edge Detector (CS-TRD β€” Linux/macOS only, optional)

cd tras/tree_ring_methods/cstrd/devernay
make
cd ../../../..                      # back to the project root

5. Install the INBD Method (optional)

mkdir -p tras/tree_ring_methods/inbd && cd tras/tree_ring_methods/inbd
git clone https://github.com/hmarichal93/INBD.git src
./download_models.sh
cd ../../..                         # back to the project root

πŸš€ Quick Start

πŸ–₯️ GUI

tras                               # launch the GUI
tras /path/to/image.jpg            # launch with an image open
tras --version                     # print the version

The Tools menu has two groups:

  • Single β€” the step-by-step workflow for the currently open image (set scale β†’ preprocess β†’ detect β†’ measure β†’ export).
  • Batch Processing… β€” run detection over an entire folder (see below).

πŸ“ GUI Batch Processing

Tools β†’ Batch Processing… opens a dialog where you pick an input folder and configure the detection settings inline β€” optional physical scale, preprocessing, pith method, and ring method with its parameters. Detection runs in the background with a live progress bar.

For every image, TRAS writes a .json label file. When the batch finishes it also produces:

Output Description
summary.pdf One page per image β€” detected rings overlaid on the image, with the filename as the page title
batch_config.yml The exact settings used, re-loadable by the CLI (tras_detect --config)

πŸ’‘ All outputs are written into the input folder itself, alongside the images. Images that already have a .json are skipped, so an interrupted batch resumes simply by running it again.

⌨️ CLI

tras_detect automatically detects whether the input is a single image or a folder.

Single image:

# Auto-detect pith and rings
tras_detect image.jpg -o output.json

# With custom parameters
tras_detect image.jpg --ring-method deepcstrd --pith-method apd_dl

Batch folder:

# With a YAML config file (recommended)
tras_detect /path/to/images --config config.yml

# With CLI flags only
tras_detect /path/to/images --scale-value 0.0213 --scale-unit mm --ring-method deepcstrd

# Config file overridden by CLI flags
tras_detect /path/to/images --config config.yml --scale-value 0.025 --ring-method cstrd

Outputs:

  • Single image β†’ <stem>_detected.json (or your custom -o path)
  • Batch folder β†’ tras_out/<stem>.json, <stem>.csv, and <stem>.pdf per image

Required for CLI batch processing: a physical scale must be provided, either via the config file or via --scale-value and --scale-unit.

See examples/cli/process_config.yml for a complete configuration template.


πŸ“– Workflow

πŸ“‹ Step-by-step guide (single image)

These per-image tools live under the Tools β†’ Single submenu. To process a whole folder at once, use Tools β†’ Batch Processing… instead (see GUI Batch Processing).

  1. πŸ“ Load Image β€” File β†’ Open or drag-and-drop a wood cross-section image
  2. πŸ“ Set Scale (optional) β€” Tools β†’ Single β†’ Set Image Scale; draw a known-length line or enter it directly
  3. πŸ–ΌοΈ Preprocess (optional) β€” Tools β†’ Single β†’ Preprocess Image; crop, resize, or remove background
  4. 🎯 Detect Rings β€” Tools β†’ Single β†’ Tree Ring Detection
    • Pith: APD auto (apd, apd_pcl, apd_dl) or manual click
    • Method: CS-TRD (Linux/macOS), DeepCS-TRD, or INBD
  5. πŸ“ Add Metadata β€” Tools β†’ Single β†’ Sample Metadata; harvested year, sample code, notes
  6. πŸ“ Measure Width (optional) β€” Tools β†’ Single β†’ Measure Ring Width; define a radial transect
  7. πŸ“Š View Properties β€” Tools β†’ Single β†’ Ring Properties; review measurements
  8. πŸ’Ύ Export β€” JSON, CSV (all data), or .POS (CooRecorder format)

🧠 Training Custom Models

TRAS supports loading user-trained models for INBD and DeepCS-TRD to improve detection on your specific datasets. See the Training Custom Models guide for step-by-step instructions.


βš™οΈ Configuration

TRAS stores its configuration in ~/.trasrc. You can customize:

  • Default shape colors (wood theme)
  • Keyboard shortcuts
  • Detection method defaults
  • UI preferences

πŸ“‹ Requirements

  • Python β‰₯ 3.9
  • PyQt5
  • OpenCV
  • PyTorch (for DeepCS-TRD)
  • Shapely 1.7.0

See pyproject.toml for the complete dependency list.


πŸ“š Citations

If you use TRAS in your research, please cite the relevant papers below.

πŸ“– BibTeX entries

UruDendro

@article{UruDendro,
  author    = {Henry Marichal and Diego Passarella and Christine Lucas and Ludmila Profumo and VerΓ³nica Casaravilla and MarΓ­a Noel Rocha Galli and Serrana Ambite and Gregory Randall},
  title     = {UruDendro, a public dataset of 64 cross-section images and manual annual ring delineations of \textit{Pinus taeda L.}},
  journal   = {Annals of Forest Science},
  volume    = {82},
  number    = {1},
  pages     = {25},
  year      = {2025},
  issn      = {1297-966X},
  doi       = {10.1186/s13595-025-01296-5},
  url       = {https://doi.org/10.1186/s13595-025-01296-5}
}

APD β€” Automatic Pith Detection

@inproceedings{apd,
  isbn = {978-3-031-78447-7},
  year = {2025},
  pages = {1--15},
  title = {Automatic Wood Pith Detector: Local Orientation Estimation and Robust Accumulation},
  author = {Marichal, Henry and Passarella, Diego and Randall, Gregory},
  booktitle = {International Conference on Pattern Recognition (ICPR)}
}

CS-TRD β€” Cross-Section Tree Ring Detection

@article{ipol.2025.485,
    title   = {{CS-TRD: a Cross-Section Tree Ring Detection Method}},
    author  = {Marichal, Henry and Passarella, Diego and Randall, Gregory},
    journal = {{Image Processing On Line}},
    volume  = {15},
    pages   = {78--107},
    year    = {2025},
    note    = {\url{https://doi.org/10.5201/ipol.2025.485}}
}

DeepCS-TRD β€” Deep Learning Tree Ring Detection

@InProceedings{10.1007/978-3-032-10185-3_3,
author="Marichal, Henry
and Casaravilla, Ver{\'o}nica
and Power, Candice
and Mello, Karolain
and Mazarino, Joaqu{\'i}n
and Lucas, Christine
and Profumo, Ludmila
and Passarella, Diego
and Randall, Gregory",
editor="Rodol{\`a}, Emanuele
and Galasso, Fabio
and Masi, Iacopo",
title="DeepCS-TRD, a Deep Learning-Based Cross-Section Tree Ring Detector",
booktitle="Image Analysis and Processing -- ICIAP 2025",
year="2026",
publisher="Springer Nature Switzerland",
address="Cham",
pages="29--41",
isbn="978-3-032-10185-3"
}

🀝 Contributing

Contributions are welcome! Feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

πŸ“„ License

GPL-3.0-only

πŸ“§ Contact

πŸ™ Acknowledgments

  • Based on the original LabelMe annotation tool by Kentaro Wada
  • U2Net model for background removal from xuebinqin/U-2-Net

TRAS β€” Tree Ring Analyzer Suite

Advancing dendrochronology research through intelligent automation

πŸ“– Documentation β€’ πŸ› Report Bug β€’ πŸ’‘ Request Feature

Made with 🌲 for the dendrochronology community

About

[Forestry 2026] TRAS: An Interactive Software for Tracing Tree Ring Cross Sections

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages