Пример #1
0
def add_dict_entries(new_entries_dict):
    """Update pydicom's DICOM dictionary with new non-private entries.

    Parameters
    ----------
    new_entries_dict : dict
        Dictionary of form:
        {tag: (VR, VM, description, is_retired, keyword),...}
        where parameters are as described in add_dict_entry

    Raises
    ------
    ValueError
        If one of the entries is a private tag.

    See Also
    --------
    add_dict_entry
        Simpler function to add a single entry to the dictionary.

    Examples
    --------
    >>> from pydicom import Dataset
    >>> new_dict_items = {
    ...        0x10021001: ('UL', '1', "Test One", '', 'TestOne'),
    ...        0x10021002: ('DS', '3', "Test Two", '', 'TestTwo'),
    ... }
    >>> add_dict_entries(new_dict_items)
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    >>> ds.TestTwo = ['1', '2', '3']

    >>> add_dict_entry(0x10021001, "UL", "TestOne", "Test One")
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    """

    if any([BaseTag(tag).is_private for tag in new_entries_dict]):
        raise ValueError(
            'Private tags cannot be added using "add_dict_entries" - '
            'use "add_private_dict_entries" instead')

    # Update the dictionary itself
    DicomDictionary.update(new_entries_dict)

    # Update the reverse mapping from name to tag
    new_names_dict = dict([(val[4], tag)
                           for tag, val in new_entries_dict.items()])
    keyword_dict.update(new_names_dict)
Пример #2
0
def add_dict_entries(
    new_entries_dict: Dict[int, Tuple[str, str, str, str, str]]
) -> None:
    """Update the DICOM dictionary with new non-private entries.

    Parameters
    ----------
    new_entries_dict : dict
        :class:`dict` of form:
        ``{tag: (VR, VM, description, is_retired, keyword), ...}``
        where parameters are as described in :func:`add_dict_entry`.

    Raises
    ------
    ValueError
        If one of the entries is a private tag.

    See Also
    --------
    add_dict_entry
        Add a single entry to the dictionary.

    Examples
    --------

    >>> from pydicom import Dataset
    >>> new_dict_items = {
    ...        0x10021001: ('UL', '1', "Test One", '', 'TestOne'),
    ...        0x10021002: ('DS', '3', "Test Two", '', 'TestTwo'),
    ... }
    >>> add_dict_entries(new_dict_items)
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    >>> ds.TestTwo = ['1', '2', '3']

    """

    if any([BaseTag(tag).is_private for tag in new_entries_dict]):
        raise ValueError(
            'Private tags cannot be added using "add_dict_entries" - '
            'use "add_private_dict_entries" instead')

    # Update the dictionary itself
    DicomDictionary.update(new_entries_dict)

    # Update the reverse mapping from name to tag
    keyword_dict.update({val[4]: tag for tag, val in new_entries_dict.items()})
Пример #3
0
def add_dict_entries(new_entries_dict):
    """Update pydicom's DICOM dictionary with new entries.

    Parameters
    ----------
    new_entries_dict : dict
        Dictionary of form:
        {tag: (VR, VM, description, is_retired, keyword),...}
        where parameters are as described in add_dict_entry

    See Also
    --------
    add_dict_entry
        Simpler function to add a single entry to the dictionary.

    Examples
    --------
    >>> from pydicom import Dataset
    >>> new_dict_items = {
    ...        0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
    ...        0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'),
    ... }
    >>> add_dict_entries(new_dict_items)
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    >>> ds.TestTwo = ['1', '2', '3']

    >>> add_dict_entry(0x10011001, "UL", "TestOne", "Test One")
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    """

    # Update the dictionary itself
    DicomDictionary.update(new_entries_dict)

    # Update the reverse mapping from name to tag
    new_names_dict = dict([(val[4], tag)
                           for tag, val in new_entries_dict.items()])
    keyword_dict.update(new_names_dict)
Пример #4
0
def add_dict_entries(new_entries_dict):
    """Update pydicom's DICOM dictionary with new entries.

    Parameters
    ----------
    new_entries_dict : dict
        Dictionary of form:
        {tag: (VR, VM, description, is_retired, keyword),...}
        where parameters are as described in add_dict_entry

    See Also
    --------
    add_dict_entry
        Simpler function to add a single entry to the dictionary.

    Examples
    --------
    >>> new_dict_items = {
            0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
            0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'),
            }
    >>> add_dict_entries(new_dict_items)
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    >>> ds.TestTwo = ['1', '2', '3']

    add_dict_entry(0x10011001, "UL", "TestOne", "Test One")
    >>> ds = Dataset()
    >>> ds.TestOne = 'test'
    """

    # Update the dictionary itself
    DicomDictionary.update(new_entries_dict)

    # Update the reverse mapping from name to tag
    new_names_dict = dict([(val[4], tag)
                           for tag, val in new_entries_dict.items()])
    keyword_dict.update(new_names_dict)
Пример #5
0

DicomDictionary.update({

    0x00000000: ('UL', '1', "CommandGroupLength", ''),
    0x00000002: ('UI', '1', "Affected SOP class", ''),
    0x00000003: ('UI', '1', "RequestedSOPClassUID", ''),
    0x00000100: ('US', '1', "CommandField", ''),
    0x00000110: ('US', '1', "MessageID", ''),
    0x00000120: ('US', '1', "MessageIDBeingRespondedTo", ''),
    0x00000600: ('AE', '1', "MoveDestination", ''),
    0x00000700: ('US', '1', "Priority", ''),
    0x00000800: ('US', '1', "DataSetType", ''),
    0x00000900: ('US', '1', "Status", ''),
    0x00000901: ('AT', '1', "OffendingElement", ''),
    0x00000902: ('LO', '1', "ErrorComment", ''),
    0x00000903: ('US', '1', "ErrorID", ''),
    0x00001000: ('UI', '1', " AffectedSOPInstanceUID", ''),
    0x00001001: ('UI', '1', "RequestedSOPInstanceUID", ''),
    0x00001002: ('US', '1', "EventTypeID", ''),
    0x00001005: ('AT', '1', "AttributeIdentifierList", ''),
    0x00001008: ('US', '1', "ActionTypeID", ''),
    0x00001020: ('US', '1', "NumberOfRemainingSuboperations", ''),
    0x00001021: ('US', '1', "NumberOfCompletedSuboperations", ''),
    0x00001022: ('US', '1', "NumberOfFailedSuboperations", ''),
    0x00001023: ('US', '1', "NumberOfWarningSuboperations", ''),
    0x00001030: ('AE', '1', "MoveOriginatorApplicationEntityTitle", ''),
    0x00001031: ('US', '1', "MoveOriginatorMessageID", ''),

})