divest

Get images out of DICOM format quickly

https://github.com/jonclayden/divest

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    9 of 54 committers (16.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.8%) to scientific vocabulary

Keywords

conversion dicom medical-imaging r

Keywords from Contributors

neuroimaging brain-imaging fmri mri image-registration medical-image-processing bids brain-connectivity brain-mri decoding
Last synced: 6 months ago · JSON representation

Repository

Get images out of DICOM format quickly

Basic Info
  • Host: GitHub
  • Owner: jonclayden
  • License: other
  • Language: C++
  • Default Branch: master
  • Size: 28.2 MB
Statistics
  • Stars: 14
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 3
Topics
conversion dicom medical-imaging r
Created about 9 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog

README.Rmd

```{r, echo=FALSE}
knitr::opts_chunk$set(collapse = TRUE)
```

[![CRAN version](https://www.r-pkg.org/badges/version/divest)](https://cran.r-project.org/package=divest) [![CI Status](https://github.com/jonclayden/divest/actions/workflows/ci.yaml/badge.svg)](https://github.com/jonclayden/divest/actions/workflows/ci.yaml) [![codecov](https://codecov.io/gh/jonclayden/divest/graph/badge.svg?token=515zW7eMSl)](https://app.codecov.io/gh/jonclayden/divest) [![Dependencies](https://tinyverse.netlify.app/badge/divest)](https://tinyverse.netlify.app)

# An R interface to dcm2niix

[DICOM](https://www.dicomstandard.org), for Digital Imaging and Communications in Medicine, is the highly complex standard by which medical imaging devices such as magnetic resonance (MR) and computed tomography (CT) scanners communicate. Importantly for medical imaging research, DICOM defines the format in which images are first created when a subject is scanned. The complexity of DICOM, and the high degree of variation in how it is implemented by hardware vendors, makes it difficult and error-prone to work with. The NIfTI-1 file format has emerged as a simpler, more interoperable standard for medical images, and generally researchers want to convert their images to this format [as soon as possible](https://doi.org/10.1016/j.jneumeth.2016.03.001).

> *divest*, **v.**: rid oneself of something that one no longer wants or requires

The `divest` package is an alternative interface to Chris Rorden's excellent [`dcm2niix` DICOM-to-NIfTI conversion tool](https://github.com/rordenlab/dcm2niix). Code has been contributed to `dcm2niix` to support an in-memory interface that links that tool's speed and reliability to the R-native NIfTI tools provided by the [`RNifti` package](https://github.com/jonclayden/RNifti).

The package is [on CRAN](https://cran.r-project.org/package=divest), and the latest development version of the package can always be installed from GitHub using the `remotes` package.

```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("jonclayden/divest")
```

**Please note that, like `dcm2niix`, the `divest` package is to be used for research purposes only, and is not a clinical tool. It comes with no warranty.**

## Usage

The package's key function is `readDicom`, which scans a directory containing DICOM files, stacks related data into merged 3D or 4D images where appropriate, and returns a list of `niftiImage` objects. For example,

```{r, results="hide"}
library(divest)
path <- system.file("extdata", "raw", package="divest")
images <- readDicom(path, interactive=FALSE, verbosity=-1)
```

The conversion is interactive by default, prompting the user to select which series to convert, but here we simply convert everything non-interactively. The minimal test dataset provided with the package contains two images from each of two acquisitions. (It is incomplete, hence the warnings.) We can see the basic properties of a converted composite image by printing it.

```{r}
# Extract the image with a fourth dimension
i <- which(sapply(images, RNifti::ndim) == 4)
images[[i]]
```

Additional properties of the scanning sequence, such as the magnetic field strength used, are stored in attributes if they can be deduced from the DICOM files.

```{r}
imageAttributes(images[[i]])
```

If desired, functions from the `RNifti` package can be used to inspect and modify the details of the converted NIfTI image, or to write it to file.

```{r}
library(RNifti)
niftiHeader(images[[i]])
```
```{r, eval=FALSE}
writeNifti(images[[i]], "stack")
```

It is also possible to obtain information about the available DICOM series without actually performing the conversion. The `scanDicom` function returns a data frame containing certain information about each series.

```{r}
names(scanDicom(path))
```

Elements of this data frame which can't be determined from the DICOM metadata, for example due to anonymisation, will take the conventional `NA` value to indicate missing data.

DICOM files can be converted to NIfTI files on disk, rather than in memory, by using `convertDicom` rather than `readDicom` (or just setting the `output` option):

```{r, results="hide"}
paths <- convertDicom(path, output=".", interactive=FALSE, verbosity=-1)
```
```{r}
list.files(pattern="\\.nii")
```

Owner

  • Name: Jon Clayden
  • Login: jonclayden
  • Kind: user
  • Location: United Kingdom
  • Company: University College London

Image processing, scientific computing and data science, mostly with R and C++

GitHub Events

Total
  • Release event: 3
  • Watch event: 1
  • Push event: 19
  • Create event: 2
Last Year
  • Release event: 3
  • Watch event: 1
  • Push event: 19
  • Create event: 2

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 1,711
  • Total Committers: 54
  • Avg Commits per committer: 31.685
  • Development Distribution Score (DDS): 0.654
Past Year
  • Commits: 171
  • Committers: 16
  • Avg Commits per committer: 10.688
  • Development Distribution Score (DDS): 0.444
Top Committers
Name Email Commits
Chris Rorden r****n@m****u 592
Jon Clayden c****e@c****g 450
neurolabusc r****n@s****u 385
Ningfei Li n****i@g****m 87
Chris Gorgolewski k****i@g****m 26
Rob Reid r****t@m****u 21
Jaemin Shin j****s@g****m 20
Yaroslav Halchenko d****n@o****m 13
Benjamin Irving b****g@e****k 11
Casper da Costa-Luis c****l@p****g 10
Qianqian Fang f****q@g****m 9
Yujing Huang y****3@m****u 9
Jaemin Shin J****n@g****m 6
Benjamin Irving b****v@g****m 5
Michael Harms m****s@w****u 4
Rob Reid b****n@g****m 3
Ghislain Antony Vaillant g****l 3
Alan Lund a****d@g****m 3
Brice Fernandez (100026991) b****z@g****m 3
Ghislain Antony Vaillant g****l@g****m 3
Isaiah Norton i****n@g****m 3
Jean-Christophe Fillion-Robin j****r@k****m 3
Paul McCarthy p****y@g****m 3
Christopher G. Schwarz s****r@m****u 2
Alexander Li Cohen a****n 2
Dimitri Papadopoulos 3****s 2
Daniel Gomez d****z@p****g 2
Igor Solovey i****y@r****a 2
Pavel Riha p****a@c****z 2
Robert Reid m****3@r****u 2
and 24 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 2
  • Average time to close issues: 3 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 2.5
  • Average comments per pull request: 3.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nwulms (1)
  • muschellij2 (1)
Pull Request Authors
  • jeroen (2)
  • muschellij2 (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 612 last-month
  • Total docker downloads: 21,777
  • Total dependent packages: 1
  • Total dependent repositories: 2
  • Total versions: 25
  • Total maintainers: 1
cran.r-project.org: divest

Get Images Out of DICOM Format Quickly

  • Versions: 25
  • Dependent Packages: 1
  • Dependent Repositories: 2
  • Downloads: 612 Last month
  • Docker Downloads: 21,777
Rankings
Docker downloads count: 12.5%
Forks count: 14.1%
Stargazers count: 15.1%
Dependent packages count: 18.1%
Average: 18.3%
Dependent repos count: 19.1%
Downloads: 31.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • RNifti >= 0.3.0 imports
  • Rcpp >= 0.11.0 imports
  • covr * suggests
  • jsonlite * suggests
  • testthat * suggests
.github/workflows/ci.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite