dcmj2pnm: Convert DICOM images to PGM/PPM, PNG, JPEG or BMP using...

Description Usage Arguments Value Examples

View source: R/dcmj2pnm.R

Description

Convert DICOM images to PGM/PPM, PNG, JPEG or BMP using dcmdump from DCMTK

Usage

1
dcmj2pnm(file, outfile = tempfile(fileext = ".png"), opts = "--write-png", ...)

Arguments

file

DICOM file name

outfile

output file name passed to dcmtk_cmd

opts

opts passed to dcmtk_cmd

...

options passed to dcmtk_cmd intern

Value

Character vector of information

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (!have_dcmtk_cmd("dcmj2pnm")) {
  install_dir = tempdir()
  res = try({
    install_dcmtk(install_dir = install_dir)
  })
  if (inherits(res, "try-error")) {
    res = FALSE
  }
  if (!res) {
    source_install_dcmtk(install_dir = install_dir)
  }
  options(dcmtk.path = install_dir)
}
file = system.file("extdata", "example.dcm", package = "dcmtk")
png_file = dcmj2pnm(file)
print(png_file)
print(file.exists(png_file))
print(normalizePath(png_file))
img = png::readPNG(png_file)
plot(1:2, type='n')
image(img)

muschellij2/dcmtk documentation built on March 17, 2021, 9:11 p.m.