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


C# StudyXml类代码示例

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


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


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