Home

Awesome

<!-- README.md is generated from README.Rmd. Please edit that file -->

lungct

Travis-CI Build Status

The lungct R package develops an image processing pipeline for computed tomography (CT) scans of the lungs.

lungct logo

Image Processing Pipeline

Highlights

Installation

You can install lungct from github with:

# install.packages("devtools")
devtools::install_github("muschellij2/lungct")

Segmentation

To segment the lungs from the CT scan:

library(lungct)
filename <- "example.nii.gz"
mask <- segment_lung(filename)

To segment the left and right lungs from the CT scan:

img <- ANTsRCore::antsImageRead(filename)
mask2 <- segment_lung2(img)

Standard Lung

The standard lung was created from N=62 healthy controls from COPDGene (50% female, 95% white, mean age = 62 years, mean BMI = 28.5)

To load the standard lung:

# Read in standard lung template
filepath <- system.file(
    "extdata", "lung_template_mask.nii.gz", 
    package = "lungct")
template <- ANTsRCore::antsImageRead(filepath)

Registration

To register the mask to the standard lung:

# Register mask to standard lung
reg <- register_lung_mask(
    moving_mask = mask, 
    fixed_mask = template, 
    moving = img, 
    sides = c("right","left"),
    typeofTransform = "SyN")

We recommend the following for lung registration:

Template Creation

For template creation, we follow the iterative method from Avants, using iterations of register_lung_mask, get_template, and calculate_DSC from lungct. However, we define convergence as having a Dice similarity coefficient (DSC) between successive iterations of at least 0.99. We recommend using parallelization for the registration step.

Template Creation

# Obtain new template
template_new <- get_template(
    folder_warp = warped_masks, 
    folder_comp = transformations)

# Check convergence     
dice <- calculate_DSC(template_init, template_new)

Radiomics

Radiomics, a field of quantitative imaging where large amounts of features are extracted from medical images, is common for lung CTs.

Options in lungct:

# Calculate radiomics
rad <- RIA_lung(
    img, mask, 
    sides = c("right", "left"), 
    features = c("fo", "glcm"), 
    bins_in = 16, equal_prob = FALSE, distance = 1, 
    statistic = "mean(X, na.rm = TRUE)")

COPDGene data usage

For the lung CT template, the COPDGene data was used:

"This research used data generated by the COPDGene study, which was supported by NIH grants U01HL089856 and U01HL089897. The COPDGene project is also supported by the COPD Foundation through contributions made by an Industry Advisory Board comprised of Pfizer, AstraZeneca, Boehringer Ingelheim, Novartis, and Sunovion."