CRAN Task View: Medical Image Analysis

Maintainer:Brandon Whitcher, Jon Clayden, John Muschelli
Contact:bwhitcher at
Contributions:Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see the Contributing guide.
Citation:Brandon Whitcher, Jon Clayden, John Muschelli (2022). CRAN Task View: Medical Image Analysis. Version 2022-03-17. URL
Installation:The packages from this task view can be installed automatically using the ctv package. For example, ctv::install.views("MedicalImaging", coreOnly = TRUE) installs all the core packages or ctv::update.views("MedicalImaging") installs all packages that are not yet installed and up-to-date. See the CRAN Task View Initiative for more details.

Medical images are produced by systems such as magnetic resonance imaging (MRI), computed tomography (CT) and positron emission tomography (PET) scanners. They are often three-dimensional, and sometimes also have a dimension that varies with time or orientation. Moreover, they typically include important metadata relating to the details of the scan and the image’s spatial relationship with the scan subject. This information is stored with the images in one of several file formats designed for the domain.

The packages in this task view are designed to read and write these files, visualize medical images and process them in various ways. Some of them are applicable to conventional images as well, and some general-purpose image-processing package can also be used with medical image data. The image intensities, stored per pixel or voxel (3D pixel), generally map naturally into an R array, which is a standard data structure and therefore suitable for interoperable working with base R and other code.

Data Input/Output


The industry standard format, for data coming off a clinical imaging device, is DICOM (Digital Imaging and Communications in Medicine). The DICOM “standard” is very broad and very complicated. Roughly speaking each DICOM-compliant file is a collection of fields organized into two four-byte sequences (group,element) that are represented as hexadecimal numbers and form a tag . The (group,element) combination announces what type of information is coming next. There is no fixed number of bytes for a DICOM header. The final (group,element) tag should be the “data” tag (7FE0,0010), such that all subsequent information is related to the image(s). In practice, there are many vendor-specific quirks associated with real DICOM files, which makes consistent handling a major challenge.


Although the industry standard for medical imaging data is DICOM, another format has come to be heavily used in the image analysis community. The ANALYZE format was originally developed in conjunction with an image processing system (of the same name) at the Mayo Foundation. An ANALYZE (7.5) format image is comprised of two files, the “hdr” and “img” files, that contain information about the acquisition and the image data itself, respectively. A more recent adaption of this format is known as NIfTI-1 and is a product of the Data Format Working Group (DFWG) from the Neuroimaging Informatics Technology Initiative (NIfTI). The NIfTI-1 data format is almost identical to the ANALYZE format, but offers a few improvements: merging of the header and image information into one file (.nii), re-organization of the 348-byte fixed header into more relevant categories and the possibility of extending the header information.

Other formats

There are a number of other formats that are specific to certain other software packages or applications.


Magnetic Resonance Imaging (MRI)

Diffusion MRI

Functional MRI

Structural MRI


Magnetic Resonance Spectroscopy (MRS)

MRS uses the same basic scanner technology as MRI, but focuses on using it to obtain chemical spectra. This is used to measure concentrations of various chemical compounds including, in the medical context, metabolites with important biochemical roles.

General Image Processing

Positron Emission Tomography (PET)

Electroencephalography (EEG)

CRAN packages

Core:adimpro, divest, dti, edfReader, eegkit, fmri, mmand, Morpho, mritc, neuroim, neuRosim, occ, oro.dicom, oro.nifti,, RNifti, RNiftyReg, Rvcg, tractor.base.
Regular:bayesImageS, brainR, cifti, DICOMread, dmri.tracking, freesurferformats, gifti, imbibe,, PTAk, qMRI, raveio, spant.
Archived:adaptsmoFMRI, AnalyzeFMRI, fslr.

Related links

Other resources