• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# StudyXml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RemoveInstanceFromStudyXmlCommand

 public RemoveInstanceFromStudyXmlCommand(StudyStorageLocation location, StudyXml studyXml, DicomFile file)
     :base("Remove Instance From Study Xml", true)
 {
     _studyLocation = location;
     _file = file;
     _studyXml = studyXml;
 }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:7,代码来源:RemoveInstanceFromStudyXmlCommand.cs


示例2: LoadStudyFromStudyXml

 /// <summary>
 /// Load all of the instances in a given <see cref="StudyXml"/> file into the component for sending.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="studyXml">The <see cref="StudyXml"/> file to load from</param>
 public void LoadStudyFromStudyXml(StudyLocation location, StudyXml studyXml)
 {
     foreach (SeriesXml seriesXml in studyXml)
     {
         LoadSeriesFromSeriesXml(studyXml, location, seriesXml, studyXml.PatientsName, studyXml.PatientId);
     }
 }
开发者ID:nhannd,项目名称:Xian,代码行数:12,代码来源:ImageViewerStorageScu.cs


示例3: TestSopClass

		public void TestSopClass()
		{
			List<DicomFile> images = SetupImages(4);

			string seriesUid = images[0].DataSet[DicomTags.SeriesInstanceUid].ToString();

			images[0].MediaStorageSopClassUid = SopClass.EnhancedCtImageStorageUid;
			images[1].MediaStorageSopClassUid = SopClass.EnhancedMrImageStorageUid;
			images[2].MediaStorageSopClassUid = SopClass.EnhancedSrStorageUid;
			images[3].MediaStorageSopClassUid = SopClass.EnhancedXaImageStorageUid;
		
			StudyXml xml = new StudyXml();
			foreach (DicomFile file in images)
				xml.AddFile(file);
	
			XmlDocument doc = xml.GetMemento(new StudyXmlOutputSettings());

			Assert.AreEqual(xml[seriesUid][images[0].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedCtImageStorageUid);
			Assert.AreEqual(xml[seriesUid][images[1].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedMrImageStorageUid);
			Assert.AreEqual(xml[seriesUid][images[2].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedSrStorageUid);
			Assert.AreEqual(xml[seriesUid][images[3].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedXaImageStorageUid);

			xml = new StudyXml();
			xml.SetMemento(doc);

			Assert.AreEqual(xml[seriesUid][images[0].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedCtImageStorageUid);
			Assert.AreEqual(xml[seriesUid][images[1].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedMrImageStorageUid);
			Assert.AreEqual(xml[seriesUid][images[2].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedSrStorageUid);
			Assert.AreEqual(xml[seriesUid][images[3].DataSet[DicomTags.SopInstanceUid]].SopClass.Uid, SopClass.EnhancedXaImageStorageUid);
		}
开发者ID:khaha2210,项目名称:radio,代码行数:30,代码来源:StudyXmlTests.cs


示例4: CreateStudyZipCommand

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="zipFile">The path of the zip file to create</param>
		/// <param name="studyXml">The <see cref="StudyXml"/> file describing the contents of the study.</param>
		/// <param name="studyFolder">The folder the study is stored in.</param>
		/// <param name="tempFolder">The folder for tempory files when creating the zip file.</param>
		public CreateStudyZipCommand(string zipFile, StudyXml studyXml, string studyFolder, string tempFolder) : base("Create study zip file",true)
		{
			_zipFile = zipFile;
			_studyXml = studyXml;
			_studyFolder = studyFolder;
			_tempFolder = tempFolder;
		}
开发者ID:tcchau,项目名称:ClearCanvas,代码行数:14,代码来源:CreateStudyZipCommand.cs


示例5: CreateTestStudy1

        protected Study CreateTestStudy1()
        {
            var studyUid = "1.2.3";
            var sops = base.SetupMRSeries(4, 5, studyUid);
            var xml = new StudyXml(studyUid);

            var seriesUids = new Dictionary<string, string>();
            var seriesModalities = new Dictionary<string, string>();
            var modalities = new[] { "MR", "MR", "SC", "KO" };

            foreach (var sop in sops)
            {
                //Make the UIDs constant.
                var seriesUid = sop[DicomTags.SeriesInstanceUid].ToString();
                if (!seriesUids.ContainsKey(seriesUid))
                {
                    seriesModalities[seriesUid] = modalities[seriesUids.Count];
                    seriesUids[seriesUid] = string.Format("1.2.3.{0}", seriesUids.Count + 1);
                }

                var modality = seriesModalities[seriesUid];
                seriesUid = seriesUids[seriesUid];

                sop[DicomTags.SeriesInstanceUid].SetString(0, seriesUid);
                sop[DicomTags.Modality].SetString(0, modality);

                var file = new DicomFile("", new DicomAttributeCollection(), sop);
                xml.AddFile(file);
            }

            var study = new Study();
            study.Update(xml);
            return study;
        }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:34,代码来源:TestBase.cs


示例6: ConstructorTest

		public void ConstructorTest()
		{
			StudyXml stream = new StudyXml();

			stream = new StudyXml("1.1.1");

		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:7,代码来源:GeneralStreamingTest.cs


示例7: CreationTest

		public void CreationTest()
		{
			IList<DicomAttributeCollection> instanceList;

			string studyInstanceUid = DicomUid.GenerateUid().UID;

			instanceList = SetupMRSeries(4, 10, studyInstanceUid);

			StudyXml studyXml = new StudyXml(studyInstanceUid);

			string studyXmlFilename = Path.GetTempFileName();

			foreach (DicomAttributeCollection instanceCollection in instanceList)
			{
				instanceCollection[DicomTags.PixelData] = null;

				DicomFile theFile = new DicomFile("test", new DicomAttributeCollection(), instanceCollection);
				SetupMetaInfo(theFile);

				studyXml.AddFile(theFile);

				WriteStudyStream(studyXmlFilename, studyXml);
			}

			StudyXml newXml = LoadStudyStream(studyXmlFilename);

			if (!Compare(newXml, instanceList))
				Assert.Fail("Comparison of StudyXML failed against base loaded from disk");

			if (!Compare(studyXml, instanceList))
				Assert.Fail("Comparison of StudyXML failed against base in memory");

		}
开发者ID:kevinpig,项目名称:MyRepository,代码行数:33,代码来源:GeneralStreamingTest.cs


示例8: RemoveSeriesFromStudyXml

 public RemoveSeriesFromStudyXml(StudyXml studyXml, string seriesUid)
     : base(String.Format("Remove series {0} from study XML of study {1}", seriesUid, studyXml.StudyInstanceUid), true)
 {
     _studyXml = studyXml;
     _seriesUid = seriesUid;
     _studyInstanceUid = studyXml.StudyInstanceUid;
 }
开发者ID:kevinpig,项目名称:MyRepository,代码行数:7,代码来源:RemoveSeriesFromStudyXml.cs


示例9: StudyRulesEngine

		public StudyRulesEngine(ServerRulesEngine studyRulesEngine, StudyStorageLocation location, ServerPartition partition, StudyXml studyXml)
		{
			_studyRulesEngine = studyRulesEngine;
			_studyXml = studyXml;
			_location = location;
			_partition = partition ?? ServerPartition.Load(_location.ServerPartitionKey);
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:7,代码来源:StudyRulesEngine.cs


示例10: InsertOrUpdateStudyCommand

 public InsertOrUpdateStudyCommand(StudyLocation location, StudyXml xml, UpdateReason reason) : base("Insert or Update Study Command")
 {
     _studyInstanceUid = xml.StudyInstanceUid;
     _studyXml = xml;
     _reason = reason;
     _location = location;
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:7,代码来源:InsertOrUpdateStudyCommand.cs


示例11: LoadInstance

		/// <summary>
		/// Load the first instance from the first series of the StudyXml file for a study.
		/// </summary>
		/// <param name="location">The storage location of the study.</param>
		/// <returns></returns>
		protected static DicomFile LoadInstance(StudyStorageLocation location)
		{
			string studyXml = Path.Combine(location.GetStudyPath(), location.StudyInstanceUid + ".xml");

			if (!File.Exists(studyXml))
			{
				return null;
			}

			FileStream stream = FileStreamOpener.OpenForRead(studyXml, FileMode.Open);
			var theDoc = new XmlDocument();
			StudyXmlIo.Read(theDoc, stream);
			stream.Close();
			stream.Dispose();
			var xml = new StudyXml();
			xml.SetMemento(theDoc);
            
			IEnumerator<SeriesXml> seriesEnumerator = xml.GetEnumerator();
			if (seriesEnumerator.MoveNext())
			{
				SeriesXml seriesXml = seriesEnumerator.Current;
				IEnumerator<InstanceXml> instanceEnumerator = seriesXml.GetEnumerator();
				if (instanceEnumerator.MoveNext())
				{
					InstanceXml instance = instanceEnumerator.Current;
					var file = new DicomFile("file.dcm",new DicomAttributeCollection(), instance.Collection)
						{TransferSyntax = instance.TransferSyntax};
					return file;
				}
			}

			return null;
		}
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:38,代码来源:BaseReapplyRulesServiceLockItemProcessor.cs


示例12: OnExecute

		protected override void OnExecute(CommandProcessor theProcessor)
		{
			StudyXml currentXml = LoadStudyXml();

            _newXml = new StudyXml(_studyInstanceUid);
			foreach (SeriesXml series in currentXml)
			{
				string seriesPath = Path.Combine(_rootPath, series.SeriesInstanceUid);
                if (!Directory.Exists(seriesPath))
                {
                    Platform.Log(LogLevel.Info, "RebuildXML: series folder {0} is missing", seriesPath);
                    continue;
                }

			    foreach (InstanceXml instance in series)
			    {
			        string instancePath = Path.Combine(seriesPath, instance.SopInstanceUid + ServerPlatform.DicomFileExtension);
			        if (!File.Exists(instancePath))
			        {
                        Platform.Log(LogLevel.Info, "RebuildXML: file {0} is missing", instancePath);
			        }
			        else
			        {
                        if (!theProcessor.ExecuteSubCommand(this, new InsertInstanceXmlCommand(_newXml, instancePath)))
			                throw new ApplicationException(theProcessor.FailureReason);
			        }
			    }
			}

            if (!theProcessor.ExecuteSubCommand(this, new SaveXmlCommand(_newXml, _rootPath, _studyInstanceUid)))
				throw new ApplicationException(theProcessor.FailureReason);
		}
开发者ID:nhannd,项目名称:Xian,代码行数:32,代码来源:RebuildStudyXmlCommand.cs


示例13: OnExecute

		/// <summary>
		/// Apply the rules.
		/// </summary>
		/// <remarks>
		/// When rules are applied, we are simply adding new <see cref="ServerDatabaseCommand"/> instances
		/// for the rules to the currently executing <see cref="ServerCommandProcessor"/>.  They will be
		/// executed after all other rules have been executed.
		/// </remarks>
		protected override void OnExecute(CommandProcessor theProcessor)
		{
			string studyXmlFile = Path.Combine(_directory, String.Format("{0}.xml", _studyInstanceUid));
			StudyXml theXml = new StudyXml(_studyInstanceUid);

			if (File.Exists(studyXmlFile))
			{
				using (Stream fileStream = FileStreamOpener.OpenForRead(studyXmlFile, FileMode.Open))
				{
					var theMemento = new StudyXmlMemento();

					StudyXmlIo.Read(theMemento, fileStream);

					theXml.SetMemento(theMemento);

					fileStream.Close();
				}
			}
			else
			{
				string errorMsg = String.Format("Unable to load study XML file of restored study: {0}", studyXmlFile);

				Platform.Log(LogLevel.Error, errorMsg);
				throw new ApplicationException(errorMsg);
			}

			DicomFile defaultFile = null;
			bool rulesExecuted = false;
			foreach (SeriesXml seriesXml in theXml)
			{
				foreach (InstanceXml instanceXml in seriesXml)
				{
					// Skip non-image objects
					if (instanceXml.SopClass.Equals(SopClass.KeyObjectSelectionDocumentStorage)
					    || instanceXml.SopClass.Equals(SopClass.GrayscaleSoftcopyPresentationStateStorageSopClass)
					    || instanceXml.SopClass.Equals(SopClass.BlendingSoftcopyPresentationStateStorageSopClass)
					    || instanceXml.SopClass.Equals(SopClass.ColorSoftcopyPresentationStateStorageSopClass))
					{
						// Save the first one encountered, just in case the whole study is non-image objects.
						if (defaultFile == null)
							defaultFile = new DicomFile("test", new DicomAttributeCollection(), instanceXml.Collection);
						continue;
					}

					DicomFile file = new DicomFile("test", new DicomAttributeCollection(), instanceXml.Collection);
					_context.Message = file;
					_engine.Execute(_context);
					rulesExecuted = true;
					break;
				}
				if (rulesExecuted) break;
			}

			if (!rulesExecuted && defaultFile != null)
			{
				_context.Message = defaultFile;
				_engine.Execute(_context);
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:67,代码来源:ApplyRulesCommand.cs


示例14: RemoveSopInstanceFromStudyXmlCommand

 public RemoveSopInstanceFromStudyXmlCommand(StudyXml studyXml, string seriesUid, string sopInstanceUid)
     : base(String.Format("Remove sop {0} from study XML of study {1}", sopInstanceUid, studyXml.StudyInstanceUid), true)
 {
     _studyXml = studyXml;
     _seriesUid = seriesUid;
     _sopInstanceUid = sopInstanceUid;
     _studyInstanceUid = studyXml.StudyInstanceUid;
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:8,代码来源:RemoveSopInstanceFromStudyXmlCommand.cs


示例15: RemoveInstanceFromStudyXmlCommand

 public RemoveInstanceFromStudyXmlCommand(StudyStorageLocation location, StudyXml studyXml, string seriesInstanceUid, string sopInstanceUid)
     : base("RemoveInstanceFromStudyXmlCommand", true)
 {
     _studyLocation = location;
     _seriesInstanceUid = seriesInstanceUid;
     _sopInstanceUid = sopInstanceUid;
     _studyXml = studyXml;
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:8,代码来源:RemoveInstanceFromStudyXmlCommand.cs


示例16: 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


示例17: InsertInstanceXmlCommand

		public InsertInstanceXmlCommand(StudyXml stream, string path)
			: base("Insert into Study XML", true)
		{
			Platform.CheckForNullReference(stream, "StudyStream object");
			Platform.CheckForNullReference(path, "Path to DICOM File");

			_stream = stream;
			_path = path;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:9,代码来源:InsertInstanceXmlCommand.cs


示例18: SaveXmlCommand

        public SaveXmlCommand(StudyXml stream, StudyStorageLocation storageLocation)
            : base("Insert into Study XML", true)
        {
            Platform.CheckForNullReference(stream, "StudyStream object");
            Platform.CheckForNullReference(storageLocation, "Study Storage Location");

            _stream = stream;
            _xmlPath = Path.Combine(storageLocation.GetStudyPath(), storageLocation.StudyInstanceUid + ".xml");
            _gzPath = _xmlPath + ".gz";
        }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:10,代码来源:SaveXmlCommand.cs


示例19: GetInstances

 private IEnumerable<InstanceXml> GetInstances(StudyXml studyXml)
 {
     foreach (SeriesXml seriesXml in studyXml)
     {
         foreach (InstanceXml instanceXml in seriesXml)
         {
             yield return instanceXml;
         }
     }
 }
开发者ID:nhannd,项目名称:Xian,代码行数:10,代码来源:ImageServerStudyLoader.cs


示例20: InsertStudyXmlCommand

		public InsertStudyXmlCommand(DicomFile file, StudyXml stream, StudyStorageLocation storageLocation)
			: base("Insert into Study XML", true)
		{
			Platform.CheckForNullReference(file, "Dicom File object");
			Platform.CheckForNullReference(stream, "StudyStream object");
			Platform.CheckForNullReference(storageLocation, "Study Storage Location");

			_file = file;
			_stream = stream;
			_studyStorageLocation = storageLocation;
		}
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:11,代码来源:InsertStudyXmlCommand.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Style类代码示例发布时间:2022-05-24
下一篇:
C# StudyStorageLocation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap