示例#1
0
        protected override void OnReceiveNCreateRequest(byte presentationID, ushort messageID,
                                                        DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset)
        {
            DicomUID sopClass = Associate.GetAbstractSyntax(presentationID);

            if (affectedClass == DicomUID.BasicFilmSessionSOPClass)
            {
                if (_session != null)
                {
                    Log.Error("{0} -> Attempted to create second Basic Film Session on association", LogID);
                    SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified);
                    return;
                }

                _session = new DcmFilmSession(sopClass, affectedInstance, dataset);

                SendNCreateResponse(presentationID, messageID, affectedClass, _session.SOPInstanceUID, null, DcmStatus.Success);
                return;
            }

            if (affectedClass == DicomUID.BasicFilmBoxSOPClass)
            {
                if (_session == null)
                {
                    Log.Error("{0} -> A Basic Film Session does not exist for this association", LogID);
                    SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified);
                    return;
                }

                DcmFilmBox box = _session.CreateFilmBox(affectedInstance, dataset);
                if (!box.Initialize())
                {
                    SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified);
                    return;
                }

                SendNCreateResponse(presentationID, messageID, affectedClass, box.SOPInstanceUID, dataset, DcmStatus.Success);
                return;
            }

            SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified);
        }