Learn R Programming

espadon (version 1.11.3)

dicom.set.tag.value: Change TAG value in DICOM raw data

Description

The dicom.set.tag.value function changes, in the DICOM raw data, the values of the TAG whose VR is a string of characters.

Usage

dicom.set.tag.value(
  dicom.raw.data,
  tag,
  tag.value,
  tag.dictionary = dicom.tag.dictionary(),
  ...
)

Value

Returns a raw vector, with new tag values.

Arguments

dicom.raw.data

Raw vector, representing the binary extraction of the DICOM file.

tag

String vector, representing the list of tags whose value is to be changed. See note 1.

tag.value

String vector,representing the list of new tag values.

tag.dictionary

Dataframe, by default equal to dicom.tag.dictionary, whose structure it must keep. This dataframe is used to parse DICOM files.

...

Additional arguments dicom.browser when previously calculated by dicom.browser with argument full.info = TRUE.

Examples

Run this code
# change the value of tags "(0010,0010)" and "(0010,0020)" in the
# dummy raw data toy.dicom.raw ()
new.raw.data <- dicom.set.tag.value (toy.dicom.raw (), 
                                     tag =  c ("(0010,0010)", "(0010,0020)"),
                                     tag.value = c ("unknown", "000001"))
# change control 
data <- dicom.parser (new.raw.data) 
data[data$TAG %in% c ("(0010,0010)", "(0010,0020)"), ]

# save data in a the new file
#############################
# new.file.name <- "new.dcm"
# zz <- file (new.file.name, "wb")
# writeBin (new.raw.data  , zz, size = 1)
# close (zz)

Run the code above in your browser using DataLab