How to use the pynetdicom.service_class.ServiceClass 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 / service_class_n.py View on Github external
----------
        req : dimse_primitives.N_ACTION
            The N-ACTION request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_ACTION):
            self._n_action_scp(req, context)
        else:
            raise ValueError(
                "Invalid DIMSE primitive '{}' used with Application Event "
                "Logging".format(req.__class__.__name__)
            )


class DisplaySystemManagementServiceClass(ServiceClass):
    """Implementation of the Display System Management Service Class."""
    statuses = GENERAL_STATUS

    def SCP(self, req, context):
        """The SCP implementation for Display System Management.

        Parameters
        ----------
        req : dimse_primitives.N_GET
            The N-GET request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_GET):
            self._n_get_scp(req, context)
        else:
github pydicom / pynetdicom / pynetdicom / sop_class.py View on Github external
elif uid in _COLOR_PALETTE_CLASSES.values():
        return ColorPaletteQueryRetrieveServiceClass
    elif uid in _DEFINED_PROCEDURE_CLASSES.values():
        return DefinedProcedureProtocolQueryRetrieveServiceClass
    elif uid in _DISPLAY_SYSTEM_CLASSES.values():
        return DisplaySystemManagementServiceClass
    elif uid in _HANGING_PROTOCOL_CLASSES.values():
        return HangingProtocolQueryRetrieveServiceClass
    elif uid in _IMPLANT_TEMPLATE_CLASSES.values():
        return ImplantTemplateQueryRetrieveServiceClass
    elif uid in _INSTANCE_AVAILABILITY_CLASSES.values():
        return InstanceAvailabilityNotificationServiceClass
    elif uid in _MEDIA_CREATION_CLASSES.values():
        return MediaCreationManagementServiceClass
    elif uid in _MEDIA_STORAGE_CLASSES.values():
        return ServiceClass  # Not yet implemented
    elif uid in _NON_PATIENT_OBJECT_CLASSES.values():
        return NonPatientObjectStorageServiceClass
    elif uid in _PRINT_MANAGEMENT_CLASSES.values():
        return PrintManagementServiceClass
    elif uid in _PROCEDURE_STEP_CLASSES.values():
        return ProcedureStepServiceClass
    elif uid in _PROTOCOL_APPROVAL_CLASSES.values():
        return ProtocolApprovalQueryRetrieveServiceClass
    elif uid in _QR_CLASSES.values():
        return QueryRetrieveServiceClass
    elif uid in _RELEVANT_PATIENT_QUERY_CLASSES.values():
        return RelevantPatientInformationQueryServiceClass
    elif uid in _RT_MACHINE_VERIFICATION_CLASSES.values():
        return RTMachineVerificationServiceClass
    elif uid in _STORAGE_CLASSES.values():
        return StorageServiceClass
github pydicom / pynetdicom / pynetdicom / service_class.py View on Github external
class ImplantTemplateQueryRetrieveServiceClass(QueryRetrieveServiceClass):
    """Implementation of the Implant Template QR Service."""
    pass


class NonPatientObjectStorageServiceClass(StorageServiceClass):
    """Implementation of the Non-Patient Object Storage Service"""
    statuses = NON_PATIENT_SERVICE_CLASS_STATUS


class ProtocolApprovalQueryRetrieveServiceClass(QueryRetrieveServiceClass):
    """Implementation of the Protocol Approval QR Service."""
    pass


class RelevantPatientInformationQueryServiceClass(ServiceClass):
    """Implementation of the Relevant Patient Information Query"""
    statuses = RELEVANT_PATIENT_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for the Relevant Patient Information Query
        Service Class.

        Parameters
        ----------
        req : dimse_primitives.C_FIND
            The C-FIND request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the SCP is operating under.
        """
        # Build C-FIND response primitive
        rsp = C_FIND()
github pydicom / pynetdicom / pynetdicom / service_class_n.py View on Github external
----------
        req : dimse_primitives.N_GET
            The N-GET request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_GET):
            self._n_get_scp(req, context)
        else:
            raise ValueError(
                "Invalid DIMSE primitive '{}' used with Display System "
                "Management".format(req.__class__.__name__)
            )


class InstanceAvailabilityNotificationServiceClass(ServiceClass):
    """Implementation of the Instance Availability Service Class"""
    statuses = GENERAL_STATUS

    def SCP(self, req, context):
        """The SCP implementation for Instance Availability Service Class.

        Parameters
        ----------
        req : dimse_primitives.N_CREATE
            The N-CREATE request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_CREATE):
            self._n_create_scp(req, context)
        else:
github pydicom / pynetdicom / pynetdicom / service_class_n.py View on Github external
self._n_event_report_scp(req, context)
        elif isinstance(req, N_GET):
            # Modality Performed Procedure Step Retrieve
            self._n_get_scp(req, context)
        elif isinstance(req, N_SET):
            # Modality Performed Procedure Step
            self._n_set_scp(req, context)
        else:
            raise ValueError(
                "Invalid DIMSE primitive '{}' used with Modality "
                "Performed Procedure Step"
                .format(req.__class__.__name__)
            )


class RTMachineVerificationServiceClass(ServiceClass):
    """Implementation of the RT Machine Verification Service Class"""
    statuses = RT_MACHINE_VERIFICATION_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for RT Machine Verification Service Class.

        Parameters
        ----------
        req : dimse_primitives.N_CREATE or N_SET or N_DELETE or N_GET or N_EVENT_REPORT or N_ACTION
            The N-CREATE, N-SET, N-GET, N-DELETE, N-ACTION or N-EVENT-REPORT
            request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_CREATE):
            self._n_create_scp(req, context)
github pydicom / pynetdicom / pynetdicom / service_class_n.py View on Github external
from pynetdicom.status import (
    GENERAL_STATUS,
    APPLICATION_EVENT_LOGGING_SERVICE_CLASS_STATUS,
    MEDIA_CREATION_MANAGEMENT_SERVICE_CLASS_STATUS,
    PRINT_JOB_MANAGEMENT_SERVICE_CLASS_STATUS,
    PROCEDURE_STEP_STATUS,
    STORAGE_COMMITMENT_SERVICE_CLASS_STATUS,
    RT_MACHINE_VERIFICATION_SERVICE_CLASS_STATUS,
    UNIFIED_PROCEDURE_STEP_SERVICE_CLASS_STATUS,
)


LOGGER = logging.getLogger('pynetdicom.service-n')


class ApplicationEventLoggingServiceClass(ServiceClass):
    """Implementation of the Application Event Logging Service Class"""
    statuses = APPLICATION_EVENT_LOGGING_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for Application Event Logging Service Class.

        Parameters
        ----------
        req : dimse_primitives.N_ACTION
            The N-ACTION request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_ACTION):
            self._n_action_scp(req, context)
        else:
github pydicom / pynetdicom / pynetdicom / service_class.py View on Github external
)
            LOGGER.exception(ex)
            rsp.Status = 0x0000

        # Check Status validity
        if not self.is_valid_status(rsp.Status):
            LOGGER.warning(
                "Unknown 'status' value returned by the handler bound to "
                "'evt.EVT_C_ECHO' - 0x{0:04x}".format(rsp.Status)
            )

        # Send primitive
        self.dimse.send_msg(rsp, context.context_id)


class StorageServiceClass(ServiceClass):
    """Implementation of the Storage Service Class."""
    uid = '1.2.840.10008.4.2'
    statuses = STORAGE_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for the Storage Service Class.

        Parameters
        ----------
        req : dimse_primitives.C_STORE
            The C-STORE request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the SCP is operating under.
        """
        # Build C-STORE response primitive
        rsp = C_STORE()
github pydicom / pynetdicom / pynetdicom / service_class_n.py View on Github external
The N-ACTION or N-EVENT-REPORT request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_EVENT_REPORT):
            self._n_event_report_scp(req, context)
        elif isinstance(req, N_ACTION):
            self._n_action_scp(req, context)
        else:
            raise ValueError(
                "Invalid DIMSE primitive '{}' used with Storage Commitment"
                .format(req.__class__.__name__)
            )


class UnifiedProcedureStepServiceClass(ServiceClass):
    """Implementation of the Unified Procedure Step Service Class"""
    statuses = UNIFIED_PROCEDURE_STEP_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for Unified Procedure Step Service Class.

        Parameters
        ----------
        req : dimse_primitives.N_CREATE or C_FIND or N_SET or N_GET or N_EVENT_REPORT or N_ACTION
            The N-CREATE, C-FIND, N-SET, N-GET, N-ACTION or N-EVENT-REPORT
            request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        # UPS Push: N-CREATE, N-ACTION, N-GET
        # UPS Pull: C-FIND, N-GET, N-SET, N-ACTION
github pydicom / pynetdicom / pynetdicom / service_class_n.py View on Github external
The presentation context that the service is operating under.
        """
        if isinstance(req, N_CREATE):
            self._n_create_scp(req, context)
        elif isinstance(req, N_GET):
            self._n_get_scp(req, context)
        elif isinstance(req, N_ACTION):
            self._n_action_scp(req, context)
        else:
            raise ValueError(
                "Invalid DIMSE primitive '{}' used with Media Creation "
                "Management".format(req.__class__.__name__)
            )


class PrintManagementServiceClass(ServiceClass):
    """Implementation of the Print Management Service Class"""
    statuses = PRINT_JOB_MANAGEMENT_SERVICE_CLASS_STATUS

    def SCP(self, req, context):
        """The SCP implementation for Print Management Service Class.

        Parameters
        ----------
        req : dimse_primitives.N_CREATE or N_SET or N_DELETE or N_GET or N_EVENT_REPORT or N_ACTION
            The N-CREATE, N-SET, N-GET, N-DELETE, N-ACTION or N-EVENT-REPORT
            request primitive sent by the peer.
        context : presentation.PresentationContext
            The presentation context that the service is operating under.
        """
        if isinstance(req, N_CREATE):
            self._n_create_scp(req, context)