Skip to main content

A toolkit for medical image subregion analysis

Project description

Breast Fibroglandular Tissue Segmentation and Analysis Toolkit

Build/Test Status Code Status Documentation
Coverage Status Documentation Status

Welcome to Fibroglandular Tissue Segmentation and Analysis Toolkit (FGTSA).

FGTSA toolkit is a Python package, which is able to detect/segment Fibroglandular Tissue regions and calculate relevant quantitative imaging biomarkers (e.g., background parenchymal enhancement, BPE) in breast MRI scans, which are highly associated with breast cancer risk, treatment response and prognosis.

FGTSA toolkit is designed and developed by Zhenwei Shi, Zihan Cao and other AI/CS scientists from Media Lab. Also, the work is supported and guided by well experienced radiologists MD Zaiyi Liu and MD Changhong Liang from the radiology department of Guangdong Provincial People's Hospital.

Installation

pip install FGTSA

Features

  • Medical image data pre-processing, including data load, crop, normalization and so on.
  • Bias field correction in breast MRI
  • Pixel-level segmentation of FGT by machine learning algorithms
  • Region detection of skin and chest wall in breast MRI
  • Automatic calculation of BPE

Tutorial

1. Package loading

import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
from FGTSA import bias_field_correction_main, fgt_seg_main, BPE_calc_main

2. Load image and mask

Some local directories are set before processing. Also, BPE is usually calculated in contralateral breast that is without lesion, therefore FGTSA toolkit requires clients to provide lesion position information. More details, see FGTSA.

ID Position
1001 R
1002 L
# id ==> patient ID posi
# set loacl paths 
raw_c0_image_path = Path(r"./image_c0_id.nii.gz")
raw_peak_image_path = Path(r"./image_peak_id.nii.gz")
# bias field correction
bfc_image_path = Path(r"./bfc_image_id.nii.gz")
# FGT mask result
fgt_mask_res_path = Path(r"./fgt_mask_id.nii.gz")
# lesion position information
lesion_info_path = Path(r"./lesion_local_info.csv")
# bpe result output
bpe_res_path = Path(r"./bpe_calc_res.csv")

3. Bias field correction

Due to poor radio frequency coil uniformity, gradient-driven eddy currents, or patient’s anatomy inside and outside the field of view, intensity inhomogeneity often occurs in MRI scans. FGTSA uses a popular N4 algorithm for correcting low frequency intensity non-uniformity present in MRI image data known as a bias or gain field.

bfc_img_nparr = bias_field_correction_main(raw_c0_image_path, bfc_image_path)

4. FGT segmentation

FGTSA uses Fuzzy c-Means clustering (FCM) as a default method, which is a commonly used method for FGT segmentation. Note that, we are also developing other algorithms that will be released soon.

fgt_seg_mask_nparr = fgt_seg_main(bfc_image_path, fgt_mask_res_path)

5. BPE calculation

The enhancement of normal fibroglandular tissue observed at contrast-enhanced breast MRI is known as background parenchymal enhancement (BPE). The degree of BPE is typically assessed in four qualitative categories (minimal, mild, moderate, or marked) in clinical practice, which is required reporting during MRI interpretation in Breast Imaging Reporting and Data System (BI-RDS, fifth edition). FGTSA provides elaborate calculation for BPE report in percentage. The formular BPE expression is as follows:

$$BPE=\frac{\sum_{i=1}^{N}\frac{S_{1,i}-S_{0,i}}{S_{0,i}}}{N}$$

bpe_res_df = BPE_calc_main(raw_c0_image_path, raw_peak_image_path, lesion_info_path, fgt_mask_res_path, bpe_res_path)

Output:

ID Health_Side_BPE H10perBPE_Volume H25perBPE_Volume H50perBPE_Volume H75perBPE_Volume
1001 0.1198211 10417 4601 1021 262

Disclaimer

FGTSA is still under development. Although we have tested and evaluated the workflow under many different situations, it may have errors and bugs unfortunately. Please use it cautiously. If you find any, please contact us and we would fix them ASAP.

Main Developers

  • Dr. Zhenwei Shi 1, 2
  • MSc. Zihan Cao 2, 3
  • MSc. Zhihe Zhao 2, 4
  • MD. Xiaomei Huang 2, 5
  • Dr. Chu Han 1, 2
  • MD. Changhong Liang 1, 2
  • MD. Zaiyi Liu 1, 2

1 Department of Radiology, Guangdong Provincial People's Hospital (Guangdong Academy of Medical Sciences), Southern Medical University, China
2 Guangdong Provincial Key Laboratory of Artificial Intelligence in Medical Image Analysis and Application, China
3 Institute of Computing Science and Technology, Guangzhou University, China
4 School of Medicine, South China University of Technology, China
5 Department of Medical Imaging, Nanfang Hospital, Southern Medical University, China

Contact

We are happy to help you with any questions. Please contact Zhenwei Shi. Email: shizhenwei@gdph.org.cn

We welcome contributions to FGTSA Toolkit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

FGTSA-1.0.2-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page