Author: Shinji Tokunaga, Masafumi Funakoshim, Toshiyuki Araki
Date: 2025-06-05

# Introduction to AiES: Axon integrity Evaluation System

#### Shinji Tokunaga, Masafumi Funakoshim, Toshiyuki Araki

#### 2025-06-05

Abstract

AiES is a free and open-source R-package for (high-throughput) axonal integrity analysis of micrographs such as murine dorsal root ganglia explant cultures. AiES offers tools to segment neurites, extract quantitative features, generate SVM models, and quantify axon integrity.AiES is available under the 3-Clause BSD license.

# Introduction

The AiES package provides an integrated workflow for axon image analysis, including feature extraction, machine learning classification, and quantitative assessment.
The main functions are:

- `axDistmap()`: Extracts morphological features from axon images.
- `axSvm()`: Builds an SVM classifier using extracted features.
- `axQnt()`: Quantifies Axon Integrity Index (AII) and Degeneration Index (DI) for new data using a trained SVM.

# Typical Workflow

## 1. Feature Extraction from Images (`axDistmap`)

The axDistmap() function creates distance maps and binary images from TIFF image files, extracting relevant features.

    library(AiES)

    # Specify a sample image folder included in the package
    img_dir1 <- system.file("extdata", "Degenerate_Images", package = "AiES")
    img_dir2 <- system.file("extdata", "Intact_Images", package = "AiES")

    # Extract features from multiple folders (recursive search)
    axDistmap(
    folder_paths = c(img_dir1, img_dir2), # Multiple folders supported
    subBack = 30,
    resizeW = 900,
    output_path = tempdir()
    )

This function processes all TIFF files in the selected directory, generating for each image:

- A distance map image
- A binary image (optional)
- A text file containing feature data

## 2. Building an SVM Classifier (`axSvm`)

The axSvm() function built an SVM model using the extracted features.

    # Specify feature data folders
    Degenerate_dir <- system.file("extdata", "Degenerate_txt", package = "AiES")
    Intact_dir <- system.file("extdata", "intact_txt", package = "AiES")

    # Train an SVM classifier
    axSvm(
    degenerate_path = Degenerate_dir,
    intact_path = Intact_dir,
    output_data_path = tempdir(),
    output_model_path = tempdir(),
    nCst = 3, nGmm = 0.1, nCrss = 5
    )

This function generates:

- An extracted data file for machine learning
- A trained SVM model file

## 3. Quantitative Analysis (`axQnt`)

The axQnt() function uses the created SVM model to calculate the Axon Integrity Index and Degeneration Index for new image data.

    # Specify a sample image folder included in the package
    img_dir1 <- system.file("extdata", "Degenerate_Images", package = "AiES")
    img_dir2 <- system.file("extdata", "Intact_Images", package = "AiES")

    # Quantify AII/DI for new image data
    result <- axQnt(
    input_dir = c(img_dir1, img_dir2), # Multiple folders supported
    svm_model_path = system.file("extdata", "svm_example_model.svm", package = "AiES"),
    output_dir = tempdir()
    )

    # Visualize the results
    library(ggplot2)
    ggplot(result, aes(x = AxonIntegrityIndex)) +
    geom_histogram(binwidth = 0.1, fill = "blue", alpha = 0.7) +
    ggtitle("AII Distribution")

This function generates:

- A summary CSV file containing the Axon Integrity Index and Degeneration Index for each image
- (Optional) Single image prediction data files

# Advanced Usage

## Exporting All Features

    # Export all EBImage features plus Circularity
    axDistmap(
    folder_paths = img_dir,
    allFeatures = TRUE,
    output_path = tempdir()
    )

# Summary

With AiES, you can perform feature extraction, machine learning, and quantitative analysis in a seamless workflow.
For more details, see the help pages for each function (e.g., `?axDistmap`, `?axSvm`, `?axQnt`).

# Source code and issues

You can find the development version of AiES on GitHub.

For bug reports and feature requests, please use the GitHub Issues page.