コード例 #1
0
        public void TestGetServersByName()
        {
            Initialize1();

            var name1 = ServerDirectory.GetRemoteServerByName("Name1");

            Assert.IsNotNull(name1);
            var name2 = ServerDirectory.GetRemoteServerByName("Name2");

            Assert.IsNotNull(name2);
            Assert.IsNull(ServerDirectory.GetRemoteServerByName(null));
            Assert.IsNull(ServerDirectory.GetRemoteServerByName(String.Empty));
            Assert.IsNull(ServerDirectory.GetRemoteServerByName("abc"));
        }
コード例 #2
0
        public void TestServiceNodeRemoteServices()
        {
            Initialize1();

            var remote = ServerDirectory.GetRemoteServerByName("Name1");

            Assert.IsFalse(remote.IsSupported <IStudyStoreQuery>());
            Assert.IsTrue(remote.IsSupported <IStudyRootQuery>());
            Assert.IsNotNull(remote.GetService <IStudyRootQuery>());

            remote = ServerDirectory.GetRemoteServerByName("Name2");
            Assert.IsFalse(remote.IsSupported <IStudyStoreQuery>());
            Assert.IsFalse(remote.IsSupported <IStudyRootQuery>());

            try
            {
                var service = remote.GetService <IStudyRootQuery>();
                Assert.Fail();
            }
            catch (NotSupportedException)
            {
            }
        }
コード例 #3
0
        public override void Process()
        {
            EnsureMaxUsedSpaceNotExceeded();

            DicomServerConfiguration configuration = GetServerConfiguration();
            var remoteAE = ServerDirectory.GetRemoteServerByName(Request.ServerName);

            if (remoteAE == null)
            {
                Proxy.Fail(string.Format("Unknown destination: {0}", Request.ServerName), WorkItemFailureType.Fatal);
                return;
            }

            if (RetrieveStudy != null)
            {
                _scu = new ImageViewerMoveScu(configuration.AETitle, remoteAE, RetrieveStudy.Patient, RetrieveStudy.Study);
            }
            else if (RetrieveSeries != null)
            {
                _scu = new ImageViewerMoveScu(configuration.AETitle, remoteAE, RetrieveSeries.Patient, RetrieveSeries.Study, RetrieveSeries.SeriesInstanceUids);
            }
            else
            {
                Proxy.Fail("Invalid request type.", WorkItemFailureType.Fatal);
                return;
            }

            Progress.ImagesToRetrieve     = _scu.TotalSubOperations;
            Progress.FailureSubOperations = 0;
            Progress.WarningSubOperations = 0;
            Progress.SuccessSubOperations = 0;
            Progress.IsCancelable         = false;
            Proxy.UpdateProgress();

            _scu.ImageMoveCompleted += OnMoveImage;

            _scu.Retrieve();

            Progress.ImagesToRetrieve     = _scu.TotalSubOperations;
            Progress.SuccessSubOperations = _scu.SuccessSubOperations;
            Progress.FailureSubOperations = _scu.FailureSubOperations;
            Progress.WarningSubOperations = _scu.WarningSubOperations;
            Progress.StatusDetails        = !string.IsNullOrEmpty(_scu.ErrorDescriptionDetails) ? _scu.ErrorDescriptionDetails : _scu.FailureDescription;

            if (_scu.Canceled)
            {
                if (_cancelDueToDiskSpace)
                {
                    var study = RetrieveStudy.Study ?? RetrieveSeries.Study;

                    Platform.Log(LogLevel.Info, "Dicom Retrieve for {0} from {1} was cancelled because disk space has been exceeded", study, remoteAE.AETitle);
                    Progress.IsCancelable = true;
                    throw new NotEnoughStorageException(); // item will be failed
                }
                else if (StopPending)
                {
                    Progress.IsCancelable = true;
                    Proxy.Postpone();
                }
                else
                {
                    Proxy.Cancel();
                }
            }
            else if (_scu.FailureSubOperations > 0 || _scu.Failed)
            {
                Progress.IsCancelable = true;
                Proxy.Fail(!string.IsNullOrEmpty(_scu.ErrorDescriptionDetails) ? _scu.ErrorDescriptionDetails : _scu.FailureDescription, WorkItemFailureType.NonFatal);
            }
            else
            {
                Proxy.Complete();
            }
        }
コード例 #4
0
        public override void Process()
        {
            DicomServerConfiguration configuration = GetServerConfiguration();
            var remoteAE = ServerDirectory.GetRemoteServerByName(Request.DestinationServerName);

            if (remoteAE == null)
            {
                Proxy.Fail(string.Format("Unknown destination: {0}", Request.DestinationServerName), WorkItemFailureType.Fatal);
                return;
            }

            if (AutoRoute != null && Proxy.Item.Priority != WorkItemPriorityEnum.Stat)
            {
                DateTime now           = Platform.Time;
                DateTime scheduledTime = AutoRoute.GetScheduledTime(now, 0);
                if (now != scheduledTime)
                {
                    Proxy.Postpone();
                    Platform.Log(LogLevel.Info, "Rescheduling AutoRoute WorkItem {0} back into the scheduled time window: {1}", Proxy.Item.Oid, Proxy.Item.ProcessTime);
                    return;
                }
            }

            _scu = new ImageViewerStorageScu(configuration.AETitle, remoteAE);

            LoadImagesToSend();

            if (Request.CompressionType != CompressionType.None)
            {
                _scu.LoadPreferredSyntaxes(Request);
            }

            Progress.TotalImagesToSend    = _scu.TotalSubOperations;
            Progress.FailureSubOperations = 0;
            Progress.WarningSubOperations = 0;
            Progress.SuccessSubOperations = 0;
            Progress.IsCancelable         = true;
            Proxy.UpdateProgress();

            _scu.ImageStoreCompleted += OnImageSent;

            _scu.DoSend();

            if (_scu.Canceled)
            {
                if (StopPending)
                {
                    Proxy.Postpone();
                }
                else
                {
                    Proxy.Cancel();
                }
            }
            else if (_scu.Failed || _scu.FailureSubOperations > 0)
            {
                var      settings = new DicomSendSettings();
                TimeSpan delay    = settings.RetryDelayUnits == RetryDelayTimeUnit.Seconds
                                     ? TimeSpan.FromSeconds(settings.RetryDelay)
                                     : TimeSpan.FromMinutes(settings.RetryDelay);

                Proxy.Fail(_scu.FailureDescription, WorkItemFailureType.NonFatal,
                           AutoRoute != null
                               ? AutoRoute.GetScheduledTime(Platform.Time, (int)delay.TotalSeconds)
                               : Platform.Time.Add(delay), settings.RetryCount);
            }
            else
            {
                Proxy.Complete();
            }
        }