Switch to unified view

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