Skip to content

GabrieleSantangelo/LiverProject

Repository files navigation

Liver and Tumor Segmentation Pipeline

This project implements a MATLAB-based pipeline for segmenting the liver and tumors from NIfTI medical images. It includes stages for data loading, extensive preprocessing, segmentation, evaluation, and visualization. All image processing and segmentation tasks are performed using classical image processing algorithms and techniques; no machine learning models are employed.

Key Features & Pipeline Stages

The pipeline processes 3D medical image volumes through several stages:

  1. Data Loading:

    • Loads NIfTI image and label files (e.g., *.nii.gz) using functions like data_io.loadNiiVolumes.
    • Handles .gz decompression.
  2. Preprocessing:

  3. Segmentation:

  4. Evaluation:

  5. Visualization:

Directory Structure

The project is organized using MATLAB packages:

  • +data_io/: Functions for data input/output.
  • +evaluation/: Scripts for evaluating segmentation performance.
  • +histogram_tools/: Utilities for histogram manipulation.
  • +morph_ops/: Functions for morphological operations.
  • +preprocessing/: Scripts for image preprocessing steps.
  • +segmentation/: Algorithms for liver and tumor segmentation.
  • +visualization/: Tools for displaying images, plots, and 3D renderings.
  • data/: Intended for storing NIfTI image and label files (Note: this directory is ignored by Git as per .gitignore).
  • old/: Contains older versions or auxiliary scripts.
  • run_liver_analysis_pipeline.m: Main script to execute the entire pipeline.

How to Run

  1. Ensure you have MATLAB installed with the Image Processing Toolbox. You will also need a NIfTI I/O library (the project uses load_nii, which is common in the neuroimaging community).
  2. Place your NIfTI image and label files (e.g., liver_XX.nii.gz) into a data/imagesTr and data/labelsTr subdirectory respectively, or update the paths in the main configuration section of the script.
  3. Open MATLAB and navigate to the project's root directory.
  4. Run the main pipeline script: run_liver_analysis_pipeline.m.

The script run_liver_analysis_pipeline.m contains a config structure at the beginning where parameters like file paths, algorithm settings, and verbosity can be adjusted.

Results and Methodology

This project achieves liver and tumor segmentation using a sequence of classical image processing techniques. These include:

  • Intensity-based thresholding
  • Histogram analysis and manipulation (normalization, stretching, matching)
  • Morphological operations (erosion, dilation, opening, closing, connected component analysis)
  • Spatial filtering (e.g., bilateral filtering)

No machine learning or deep learning models are used in this pipeline. The segmentation is entirely driven by algorithmic processing of image intensities and spatial relationships. The performance of the pipeline is evaluated using standard metrics like Dice coefficient and Recall, which are reported at the end of the script execution. The specific results will vary depending on the input data and the fine-tuning of parameters within the config structure.

For reference, the algorithm with the current configuration was tested on the following dataset:

Results for Task03_LiverTumor_liver_80

--- Segmentation Metrics ---
Dice Score Liver: 0.9496
Dice Score Tumor: 0.8680
Recall Liver:     0.9533
Recall Tumor:     0.8288
---------------------------

Dependencies

  • MATLAB
  • Image Processing Toolbox (for functions like imhist, imfill, strel, morphological operations, etc.)
  • NIfTI file I/O tools (e.g., "Tools for NIfTI and ANALYZE image" by Jimmy Shen, which provides load_nii).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages