当前位置: 首页>>代码示例>>C#>>正文


C# StudyXml.Contains方法代码示例

本文整理汇总了C#中StudyXml.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# StudyXml.Contains方法的具体用法?C# StudyXml.Contains怎么用?C# StudyXml.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StudyXml的用法示例。


在下文中一共展示了StudyXml.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessWorkQueueUid

        private bool ProcessWorkQueueUid(Model.WorkQueue item, WorkQueueUid sop, StudyXml studyXml, IDicomCodecFactory theCodecFactory)
        {
            Platform.CheckForNullReference(item, "item");
            Platform.CheckForNullReference(sop, "sop");
            Platform.CheckForNullReference(studyXml, "studyXml");

            if (!studyXml.Contains(sop.SeriesInstanceUid, sop.SopInstanceUid))
            {
                // Uid was inserted but not in the study xml.
                // Auto-recovery might have detect problem with that file and remove it from the study.
                // Assume the study xml has been corrected and ignore the uid.
                Platform.Log(LogLevel.Warn, "Skipping SOP {0} in series {1}. It is no longer part of the study.", sop.SopInstanceUid, sop.SeriesInstanceUid);

                // Delete it out of the queue
                DeleteWorkQueueUid(sop);
                return true;
            }

            string basePath = Path.Combine(StorageLocation.GetStudyPath(), sop.SeriesInstanceUid);
            basePath = Path.Combine(basePath, sop.SopInstanceUid);
            string path;
            if (sop.Extension != null)
                path = basePath + "." + sop.Extension;
            else
                path = basePath + ServerPlatform.DicomFileExtension;

            try
            {
                ProcessFile(item, sop, path, studyXml, theCodecFactory);

                // WorkQueueUid has been deleted out by the processor

                return true;
            }
            catch (Exception e)
            {
                if (e.InnerException != null && e.InnerException is DicomCodecUnsupportedSopException)
                {
                    Platform.Log(LogLevel.Warn, e, "Instance not supported for compressor: {0}.  Deleting WorkQueue entry for SOP {1}", e.Message, sop.SopInstanceUid);

                    item.FailureDescription = e.InnerException != null ? e.InnerException.Message : e.Message;

                    // Delete it out of the queue
                    DeleteWorkQueueUid(sop);

                    return false;
                }
                Platform.Log(LogLevel.Error, e, "Unexpected exception when compressing file: {0} SOP Instance: {1}", path, sop.SopInstanceUid);
                item.FailureDescription = e.InnerException != null ? e.InnerException.Message : e.Message;

                sop.FailureCount++;

                UpdateWorkQueueUid(sop);

                return false;
            }
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:57,代码来源:CompressStudyItemProcessor.cs

示例2: StudyXmlTestFailure

        public void StudyXmlTestFailure()
        {
            string directory;

            using (var processor = new TestCommandProcessor())
            {
                var studyXml = new StudyXml(DicomUid.GenerateUid().UID);
                var images = SetupMRSeries(2, 5, studyXml.StudyInstanceUid);
                directory = Path.Combine(processor.ProcessorContext.TempDirectory, "StudyXmlTest2");

                DirectoryUtility.DeleteIfExists(directory);

                processor.AddCommand(new CreateDirectoryCommand(directory));

                foreach (var i in images)
                {
                    string file = Path.Combine(directory, i[DicomTags.SopInstanceUid] + ".dcm");
                    processor.AddCommand(new SaveDicomFileCommand(file, new DicomFile(file, new DicomAttributeCollection(), i), false));
                    processor.AddCommand(new InsertInstanceXmlCommand(studyXml, file));
                }

                string file2 = Path.Combine(directory, "Test.dcm");

                processor.AddCommand(new SaveDicomFileCommand(file2, _dicomFile, true));
                processor.AddCommand(new SaveDicomFileCommand(file2, _dicomFile, true));

                Assert.IsFalse(processor.Execute(), processor.FailureReason);
                Assert.IsTrue((images.Count * 2 + 3) == processor.TestContext.CommandsExecuted);

                foreach (var i in images)
                {
                    Assert.IsFalse(studyXml.Contains(i[DicomTags.SeriesInstanceUid], i[DicomTags.SopInstanceUid]));
                }
                
                // Directory should be deleted too
                Assert.IsFalse(Directory.Exists(directory));
            }
        }
开发者ID:kevinpig,项目名称:MyRepository,代码行数:38,代码来源:CommandTests.cs


注:本文中的StudyXml.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。