dicomupdate
Description
updates the values of the target attributes of the DICOM metadata structure
newinfo
= dicomupdate(info
,attributeInfo
)info
, and returns the updated metadata structure,
newinfo
. The attributeInfo
argument specifies
the locations and new values of the target attributes.
Examples
Update Field in DICOM Metadata Structure
Create the DICOM metadata structure by reading it from a DICOM file.
info = dicominfo("RTSTRUCT-VS-SEG-001.dcm");
Find the value of a metadata field and its location in the DICOM metadata structure. The dicomfind
function returns a table with two columns: Location
and Value
. Each element of the table is a cell array.
ROINumber_info = dicomfind(info,"ROINumber")
ROINumber_info=4×2 table
Location Value
____________________________________________ _____
{'StructureSetROISequence.Item_1.ROINumber'} {[1]}
{'StructureSetROISequence.Item_2.ROINumber'} {[2]}
{'StructureSetROISequence.Item_3.ROINumber'} {[3]}
{'StructureSetROISequence.Item_4.ROINumber'} {[4]}
Specify a new value for the Value
field of the second ROInumber
.
ROINumber_info.Value{2} = 4
ROINumber_info=4×2 table
Location Value
____________________________________________ _____
{'StructureSetROISequence.Item_1.ROINumber'} {[1]}
{'StructureSetROISequence.Item_2.ROINumber'} {[4]}
{'StructureSetROISequence.Item_3.ROINumber'} {[3]}
{'StructureSetROISequence.Item_4.ROINumber'} {[4]}
Update the DICOM metadata structure info
by specifying the table that contains the new value for the second ROInumber
field. The dicomupdate
function creates a new, updated DICOM metadata structure.
newInfo = dicomupdate(info,ROINumber_info);
Check that the newInfo
structure contains the updated value.
ROINumber_info = dicomfind(newInfo,"ROINumber")
ROINumber_info=4×2 table
Location Value
____________________________________________ _____
{'StructureSetROISequence.Item_1.ROINumber'} {[1]}
{'StructureSetROISequence.Item_2.ROINumber'} {[4]}
{'StructureSetROISequence.Item_3.ROINumber'} {[3]}
{'StructureSetROISequence.Item_4.ROINumber'} {[4]}
Update DICOM Metadata Structure with New Value
Create a DICOM metadata structure by using the dicominfo
function.
info = dicominfo("RTSTRUCT-VS-SEG-001.dcm");
Find the value and location in the info
structure of the ROINumber
metadata field by using the dicomfind
function.
ROINumber = dicomfind(info,"ROINumber")
ROINumber=4×2 table
Location Value
____________________________________________ _____
{'StructureSetROISequence.Item_1.ROINumber'} {[1]}
{'StructureSetROISequence.Item_2.ROINumber'} {[2]}
{'StructureSetROISequence.Item_3.ROINumber'} {[3]}
{'StructureSetROISequence.Item_4.ROINumber'} {[4]}
Update the ROINumber
field in the DICOM metadata structure, info
, by specifying the name of the field and its new value.
newInfo = dicomupdate(info,ROINumber=4);
Check that the newInfo
structure contains the updated field. Notice that the metadata structure contains updated values for all instances of the specified attribute.
ROINumber_info = dicomfind(newInfo,"ROINumber")
ROINumber_info=4×2 table
Location Value
____________________________________________ _____
{'StructureSetROISequence.Item_1.ROINumber'} {[4]}
{'StructureSetROISequence.Item_2.ROINumber'} {[4]}
{'StructureSetROISequence.Item_3.ROINumber'} {[4]}
{'StructureSetROISequence.Item_4.ROINumber'} {[4]}
Input Arguments
info
— DICOM metadata
structure
DICOM metadata, specified as a structure. You can extract the DICOM metadata
structure from a DICOM file using the dicominfo
function.
Data Types: struct
attributeInfo
— Location and new value of target attribute
table
Location and new value of the target attribute, specified as a table.
attribute
— Name of target DICOM metadata field
string scalar | character vector
Name of the target DICOM metadata field, specified as a string scalar or character vector.
Example: "ROINumber"
Data Types: string
| char
value
— New value for DICOM metadata attribute
numeric array | character vector | string scalar
New value for the DICOM metadata attribute, specified as a numeric array, string scalar, or character vector.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
Output Arguments
newinfo
— Updated DICOM metadata
structure
Updated DICOM metadata, returned as a structure.
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2021bR2024b: Support for thread-based environments
dicomupdate
now supports thread-based
environments.
See Also
dicomanon
| dicomfind
| dicomread
| dicomreadVolume
| dicomdict
| dicomdisp
| dicominfo
| dicomlookup
| dicomwrite
| dicomuid
| dicomFile
(Medical Imaging Toolbox) | updateAttribute
(Medical Imaging Toolbox)
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)