-6

How to convert Dicom images with file extension .dcm to Jpg or Png in R

I am attempting the following code in R, but getting error as Error: '...' used in an incorrect context

What is wrong in my below R code.

source("https://neuroconductor.org/neurocLite.R")
neuro_install('dcmtk')
install_dcmtk()
library(dcmtk)
setwd("D:/train/ID00007637202177411956430")
dcm<-readDICOMFile("27.dcm")
dcmj2pnm(dcm, outfile = tempfile(fileext = ".png"),opts = "--write-png", ...)

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
Vikram R S
  • 31
  • 7

1 Answers1

-1

Looking at the code for dcmj2pnm.R (https://github.com/muschellij2/dcmtk/blob/master/R/dcmj2pnm.R), it seems that it expects the first parameter to be a DICOM file name. You seem to be passing it DICOM image in memory, not a file name.

Dave Chen
  • 1,905
  • 1
  • 12
  • 18