Main Content

dicomfind

Find location and value of target attribute in DICOM metadata

    Description

    example

    attributeinfo = dicomfind(info,attribute) finds the location and value of the DICOM metadata field attribute of the DICOM metadata structure info. To extract the DICOM metadata structure from a DICOM file, use dicominfo. You can use dicomfind to help find values for metadata items that are deeply nested in the info structure.

    attributeinfo = dicomfind(filename,attribute) finds the value of the metadata element attribute of the DICOM file filename.

    Examples

    collapse all

    Create a DICOM metadata structure, info, by using the dicominfo function.

    info = dicominfo("rtstruct.dcm");

    Find the value and location in the info structure of the ROINumber metadata field. The dicomfind function returns the results in a table with two columns: Location and Value.

    ROINumber = dicomfind(info,"ROINumber")
    ROINumber=2×2 table
                          Location                      Value
        ____________________________________________    _____
    
        {'StructureSetROISequence.Item_1.ROINumber'}    {[1]}
        {'StructureSetROISequence.Item_2.ROINumber'}    {[2]}
    
    

    Find the value of the ROINumber metadata field and its location in the DICOM metadata structure. Specify the name of the metadata field and the name of the DICOM file. The function returns the results in a table with two columns: Location and Value.

    ROINumber = dicomfind("rtstruct.dcm","ROINumber")
    ROINumber=2×2 table
                          Location                      Value
        ____________________________________________    _____
    
        {'StructureSetROISequence.Item_1.ROINumber'}    {[1]}
        {'StructureSetROISequence.Item_2.ROINumber'}    {[2]}
    
    

    Input Arguments

    collapse all

    DICOM metadata, specified as a structure. You can extract the DICOM metadata structure from a DICOM file by using the dicominfo function.

    Data Types: struct

    Name of the DICOM metadata field, specified as a string scalar or character vector. The spelling and capitalization of attribute must match the full name of a metadata field in the input DICOM metadata structure, info.

    Data Types: string | char

    Name of the DICOM file, specified as a string scalar or character vector.

    Example: "rtstruct.dcm"

    Data Types: string | char

    Output Arguments

    collapse all

    Location and value of the specified DICOM attribute, returned as a table with two columns: Location and Value. The Location column lists the attribute name using dot notation, providing its position within the nested DICOM metadata structure. The Value column lists the value assigned for each instance of the attribute within the DICOM metadata structure.

    Introduced in R2021b