Diff of /README.Rmd [000000] .. [3b2327]

Switch to unified view

a b/README.Rmd
1
---
2
output: github_document
3
---
4
5
<!-- README.md is generated from README.Rmd. Please edit that file -->
6
7
```{r setup, include = FALSE}
8
knitr::opts_chunk$set(
9
  collapse = TRUE,
10
  comment = "#>",
11
  fig.path = "man/figures/README-",
12
  out.width = "100%"
13
)
14
```
15
# lungct
16
17
18
[![Travis-CI Build Status](https://travis-ci.org/muschellij2/lungct.svg?branch=master)](https://travis-ci.org/muschellij2/lungct)
19
20
21
The lungct R package develops an image processing pipeline for computed tomography (CT) scans of the lungs. 
22
23
![lungct logo](inst/extdata/logo.png)
24
25
26
![Image Processing Pipeline](inst/extdata/pipeline.png)
27
28
## Highlights
29
30
* We develop a free and simple segmentation algorithm that is comparable to the proprietary VIDA Diagnostics software
31
32
* We create the first publicly available standard lung template using healthy adults, which is available for download via lungct
33
34
* We show that the standard lung template allows for improved population-level inference of lung CTs using radiomics
35
36
* lungct provides a fully-automated and open-source image processing pipeline for lung CTs, which is accessible to statisticians
37
38
## Installation
39
40
You can install lungct from github with:
41
42
``` r
43
# install.packages("devtools")
44
devtools::install_github("muschellij2/lungct")
45
```
46
47
48
## Segmentation
49
50
To segment the lungs from the CT scan: 
51
52
``` r
53
library(lungct)
54
filename <- "example.nii.gz"
55
mask <- segment_lung(filename)
56
```
57
58
To segment the left and right lungs from the CT scan: 
59
60
``` r
61
img <- ANTsRCore::antsImageRead(filename)
62
mask2 <- segment_lung2(img)
63
```
64
65
## Standard Lung
66
67
The standard lung was created from N=62 healthy controls from [COPDGene](http://www.copdgene.org/) (50\% female, 95\% white, mean age = 62 years, mean BMI = 28.5)
68
69
To load the standard lung: 
70
71
``` r
72
# Read in standard lung template
73
filepath <- system.file(
74
    "extdata", "lung_template_mask.nii.gz", 
75
    package = "lungct")
76
template <- ANTsRCore::antsImageRead(filepath)
77
```
78
79
## Registration
80
81
To register the mask to the standard lung: 
82
83
``` r
84
# Register mask to standard lung
85
reg <- register_lung_mask(
86
    moving_mask = mask, 
87
    fixed_mask = template, 
88
    moving = img, 
89
    sides = c("right","left"),
90
    typeofTransform = "SyN")
91
```
92
93
We recommend the following for lung registration: 
94
95
* Separately register the right and left lungs to account for differences in lung shape and size
96
97
* Perform registration on lung masks to preserve biological variability in Hounsfield units (HU)
98
99
* Use [Symmetric Normalization (SyN)](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2276735/) for nonlinear registration due to its flexibility and success in the [EMPIRE10](https://empire10.grand-challenge.org/) challenge
100
101
102
## Template Creation
103
104
For template creation, we follow the iterative method from [Avants](https://www.ncbi.nlm.nih.gov/pubmed/19818860), 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. 
105
106
![Template Creation](inst/extdata/templatecreation.png)
107
108
```r
109
# Obtain new template
110
template_new <- get_template(
111
    folder_warp = warped_masks, 
112
    folder_comp = transformations)
113
114
# Check convergence     
115
dice <- calculate_DSC(template_init, template_new)
116
```
117
118
## Radiomics
119
120
Radiomics, a field of quantitative imaging where large amounts of features are extracted from medical images, is common for lung CTs. 
121
122
Options in lungct: 
123
124
* radiomics_slice: Calculation on 2D slices in axial, coronal, or sagittal planes
125
126
* radiomics_lung: Calculation on 3D right and left lungs
127
128
* RIA_lung: Calculation of advanced radiomic features, such as GLCM and GLRLM [More info](https://github.com/cran/RIA)
129
130
```r
131
# Calculate radiomics
132
rad <- RIA_lung(
133
    img, mask, 
134
    sides = c("right", "left"), 
135
    features = c("fo", "glcm"), 
136
    bins_in = 16, equal_prob = FALSE, distance = 1, 
137
    statistic = "mean(X, na.rm = TRUE)")
138
```
139
140
141
## COPDGene data usage
142
143
For the lung CT template, the [COPDGene data](http://www.copdgene.org/) was used:
144
145
"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."
146