How to use the pynetdicom.pdu_primitives.ServiceParameter function in pynetdicom

To help you get started, we’ve selected a few pynetdicom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
if value is not None and not 0 < len(value) < 17:
            raise ValueError("Implementation Version Name must be "
                             "between 1 and 16 characters long")

        self._implementation_version_name = value

    def __str__(self):
        """String representation of the class."""
        s = "Implementation Version Name\n"
        s += "  Implementation version name: {0!s}\n".format(
            self.implementation_version_name)
        return s


class AsynchronousOperationsWindowNegotiation(ServiceParameter):
    """
    Representation of the Asynchronous Operations Window Negotiation primitive.

    Allows peer AEs to negotiate the maximum number of outstanding operation
    or sub-operation requests. This negotiation is optional.

    The Asynchronous Operations Window is optional and there may only be a
    single :class:`AsynchronousOperationsWindowNegotiation` item

    Identical for both A-ASSOCIATE-RQ and A-ASSOCIATE-AC.

    Attributes
    ----------
    maximum_number_operations_invoked : int
        The maximum number of asynchronous operations invoked by the AE. A
        value of ``0`` indicates unlimited operations (default ``1``)
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
"or bytes")

        if value is not None and not validate_uid(value):
            LOGGER.error("SOP Class UID is an invalid UID")
            raise ValueError("SOP Class UID is an invalid UID")

        if value and not value.is_valid:
            LOGGER.warning(
                "The SOP Class UID '{}' is non-conformant"
                .format(value)
            )

        self._sop_class_uid = value


class SOPClassExtendedNegotiation(ServiceParameter):
    """
    A representation of the SOP Class Extended Negotiation primitive.

    Allows peer AEs to exchange application information defined by specific
    Service Class specifications. Each Service Class is required to document
    the application information it supports and how this information is
    negotiated between SCUs and SCPs.

    The SOP Class Extended Negotiation is optional and there may only be a
    single :class:`SOPClassExtendedNegotiation` item for each available SOP
    Class UID.

    Identical for both A-ASSOCIATE-RQ and A-ASSOCIATE-AC

    Attributes
    ----------
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
raise ValueError("Maximum Number Operations Performed must be "
                             "greater than 0")

        self._maximum_number_operations_performed = value

    def __str__(self):
        """String representation of the class."""
        s = "Asynchronous Operations Window\n"
        s += "  Maximum number operations invoked: {0:d}\n".format(
            self.maximum_number_operations_invoked)
        s += "  Maximum number operations performed: {0:d}\n".format(
            self.maximum_number_operations_performed)
        return s


class SCP_SCU_RoleSelectionNegotiation(ServiceParameter):
    """
    A representation of the SCP/SCU Role Selection Negotiation primitive.

    Allows peer AEs to negotiate the roles in which they will serve for each
    SOP Class or Meta SOP Class supported on the association. This negotiation
    is optional.

    The association *Requestor* may use one SCP/SCU Role Selection item for
    each SOP Class as identified by its corresponding Abstract Syntax Name and
    shall be one of three role values:

    - *Requestor* is SCU only
    - *Requestor* is SCP only
    - *Requestor* is both SCU/SCP

    If the SCP/SCU Role Selection item is absent the default role for a
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
"or bytes")

        if value is not None and not validate_uid(value):
            LOGGER.error("SOP Class UID is an invalid UID")
            raise ValueError("SOP Class UID is an invalid UID")

        if value and not value.is_valid:
            LOGGER.warning(
                "The SOP Class UID '{}' is non-conformant"
                .format(value)
            )

        self._sop_class_uid = value


class SOPClassCommonExtendedNegotiation(ServiceParameter):
    """
    A representation of the SOP Class Common Extended Negotiation primitive.

    Allows peer AEs to exchange generic application information.

    The SOP Class Common Extended Negotiation is optional and there may only be
    a single :class:`SOPClassCommonExtendedNegotiation` item for each available
    SOP Class UID.

    Identical for both A-ASSOCIATE-RQ and A-ASSOCIATE-AC

    Attributes
    ----------
    sop_class_uid : pydicom.uid.UID, bytes or str
        The UID of the SOP Class
    service_class_uid : pydicom.uid.UID, bytes or str
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
LOGGER.warning(
                "The Implementation Class UID '{}' is non-conformant"
                .format(value)
            )

        self._implementation_class_uid = value

    def __str__(self):
        """String representation of the class."""
        s = "Implementation Class UID\n"
        s += "  Implementation class UID: {0!s}\n" \
             .format(self.implementation_class_uid)
        return s


class ImplementationVersionNameNotification(ServiceParameter):
    """
    A representation of a Implementation Version Name Notification primitive.

    The implementation identification notification allows implementations of
    communicating AEs to identify each other at Association establishment time.
    It is intended to provider respective and non-ambiguous identification in
    the event of communication problems encountered between two nodes. This
    negotiation is required.

    Implementation identification relies on two pieces of information:

    - Implementation Class UID (required)
    - Implementation Version Name (optional)

    The Implementation Version Name is optional and there may only be a single
    :class:`ImplementationVersionNameNotification` item.
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
if header_byte & 2 != 0:
                    s += '    Dataset information, last fragment of the ' \
                         'DIMSE message\n'
                # xxxxxx00
                else:
                    s += '    Dataset information, not the last fragment of ' \
                         'the DIMSE message\n'

            # Remaining data
            #s += pretty_bytes(pdv[1][1:], '    ', max_size=512)

        return s


# User Information Negotiation primitives
class MaximumLengthNotification(ServiceParameter):
    """
    A representation of a Maximum Length Negotiation primitive.

    The maximum length notification allows communicating AEs to limit the size
    of the data for each P-DATA indication. This notification is required for
    all DICOM v3.0 conforming implementations.

    This User Information item is required during association negotiation and
    there must only be a single :class:`MaximumLengthNotification` item.

    Attributes
    ----------
    maximum_length_received : int
        The maximum length received value for the Maximum Length sub-item in
        bytes. A value of ``0`` indicates unlimited length (``31682`` bytes
        default).
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
raise TypeError(msg)

        if value is not None and not validate_uid(value):
            LOGGER.error("SOP Class UID is an invalid UID")
            raise ValueError("SOP Class UID is an invalid UID")

        if value and not value.is_valid:
            LOGGER.warning(
                "The SOP Class UID '{}' is non-conformant"
                .format(value)
            )

        self._sop_class_uid = value


class UserIdentityNegotiation(ServiceParameter):
    """Representation of the User Identity Negotiation primitive.

    Allows peer AEs to exchange generic application information.

    The SOP Class Common Extended Negotiation is optional and there may only be
    a single :class:`UserIdentityNegotiation` item.

    In general, a User Identity Negotiation request that is accepted will
    result in association establishment and possibly a server response if
    requested and supported by the peer. If a server response is requested but
    not received then the *Requestor* must decide how to proceed.
    An association rejected due to an authorisation failure will be indicated
    using Rejection Permanent with a Source of "DICOM UL service provided (ACSE
    related function)".

    How the *Acceptor* handles authentication is to be implemented by the
github pydicom / pynetdicom / pynetdicom / pdu_primitives.py View on Github external
self._maximum_length = val
        else:
            LOGGER.error("Maximum Length Received must be numerical")
            raise TypeError("Maximum Length Received must be numerical")

    def __str__(self):
        """String representation of the class."""
        s = "Maximum Length Negotiation\n"
        s += "  Maximum length received: {0:d} bytes\n".format(
            self.maximum_length_received)
        return s


# TODO: Combine ImplementationClass and ImplementationVersion
#   into ImplementationIdentificationNotification
class ImplementationClassUIDNotification(ServiceParameter):
    """A representation of a Implementation Class UID Notification primitive.

    The implementation identification notification allows implementations of
    communicating AEs to identify each other at association establishment time.
    It is intended to provider respective and non-ambiguous identification in
    the event of communication problems encountered between two nodes. This
    negotiation is required.

    Implementation identification relies on two pieces of information:

    - Implementation Class UID (required)
    - Implementation Version Name (optional)

    The Implementation Class UID is required during association negotiation and
    there must only be a single :class:`ImplementationClassUIDNotification`
    item.