dicom.set.tag.value {espadon}R Documentation

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()
)

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.

Value

Returns a raw vector, with new tag values.

Note

1- The list of tags included in the DICOM file are given by the first columns of the dataframe provided by the functions dicom.browser and dicom.parser.

2- The dicom.set.tag.value function may take some processing time. To minimize this time, it is recommended to prepare in advance all the tags to be modified, and use the dicom.set.tag.value function only once, as shown in the example.

Examples

# 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)

[Package espadon version 1.2.0 Index]