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


C# DicomAttributeCollection.SaveDicomFields方法代码示例

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


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

示例1: UpdateDataSet

		public void UpdateDataSet(DicomAttributeCollection dataset)
		{
			dataset.SaveDicomFields(this);

			if (IsColor)
			{
				dataset[DicomTags.PixelRepresentation].SetEmptyValue(); ;
			}
			else
			{
				dataset[DicomTags.PlanarConfiguration].SetEmptyValue(); ;
			}

			if (PixelSpacing.IsNull && ImagerPixelSpacing.IsNull)
				dataset[DicomTags.PixelAspectRatio].SetStringValue(AspectRatio.ToString());
			
			if (!PixelSpacing.IsNull)
				dataset[DicomTags.PixelSpacing].SetStringValue(PixelSpacing.ToString());
			else
				dataset[DicomTags.PixelSpacing].SetEmptyValue();

			if (!ImagerPixelSpacing.IsNull)
				dataset[DicomTags.ImagerPixelSpacing].SetStringValue(ImagerPixelSpacing.ToString());
			else
				dataset[DicomTags.ImagerPixelSpacing].SetEmptyValue();
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:26,代码来源:PixelDataInfo.cs

示例2: UpdateAttributeCollection

		/// <summary>
		/// Update a <see cref="DicomAttributeCollection"/> with the pixel data contained
		/// within this object and also update pixel data related tags.
		/// </summary>
		/// <remarks>
		/// This method will replace the pixel data attribute in <paramref name="dataset"/>
		/// and update other pixel data related tags within the collection.
		/// </remarks>
		/// <param name="dataset">The collection to update.</param>
		public override void UpdateAttributeCollection(DicomAttributeCollection dataset)
		{
			dataset.SaveDicomFields(this);

			if (dataset.Contains(DicomTags.NumberOfFrames) || NumberOfFrames > 1)
				dataset[DicomTags.NumberOfFrames].SetInt32(0, NumberOfFrames);
			if (dataset.Contains(DicomTags.PlanarConfiguration))
				dataset[DicomTags.PlanarConfiguration].SetInt32(0, PlanarConfiguration);
			if (dataset.Contains(DicomTags.LossyImageCompressionRatio))
				dataset[DicomTags.LossyImageCompressionRatio].SetFloat32(0, LossyImageCompressionRatio);
			if (dataset.Contains(DicomTags.LossyImageCompressionMethod))
				dataset[DicomTags.LossyImageCompressionMethod].SetString(0, LossyImageCompressionMethod);
			if (dataset.Contains(DicomTags.RescaleSlope) || DecimalRescaleSlope != 1.0M || DecimalRescaleIntercept != 0.0M)
				dataset[DicomTags.RescaleSlope].SetString(0, RescaleSlope);
			if (dataset.Contains(DicomTags.RescaleIntercept) || DecimalRescaleSlope != 1.0M || DecimalRescaleIntercept != 0.0M)
				dataset[DicomTags.RescaleIntercept].SetString(0, RescaleIntercept);

			if (dataset.Contains(DicomTags.WindowCenter) || LinearVoiLuts.Count > 0)
				Window.SetWindowCenterAndWidth(dataset, LinearVoiLuts);

			dataset[DicomTags.PixelData] = _pd;

			//Remove the palette color lut, if the pixels were translated to RGB
			if (dataset.Contains(DicomTags.RedPaletteColorLookupTableData)
			    && dataset.Contains(DicomTags.BluePaletteColorLookupTableData)
			    && dataset.Contains(DicomTags.GreenPaletteColorLookupTableData)
			    && !HasPaletteColorLut)
			{
				dataset.RemoveAttribute(DicomTags.BluePaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.BluePaletteColorLookupTableData);
				dataset.RemoveAttribute(DicomTags.RedPaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.RedPaletteColorLookupTableData);
				dataset.RemoveAttribute(DicomTags.GreenPaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.GreenPaletteColorLookupTableData);
			}

			UpdatePixelDataAttribute();
		}
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:47,代码来源:DicomUncompressedPixelData.cs

示例3: UpdateAttributeCollection

        /// <summary>
        /// Update an <see cref="DicomAttributeCollection"/> with pixel data related tags.
        /// </summary>
        /// <param name="dataset">The collection to update.</param>
        public override void UpdateAttributeCollection(DicomAttributeCollection dataset)
        {
            if (dataset.Contains(DicomTags.NumberOfFrames) || NumberOfFrames > 1)
                dataset[DicomTags.NumberOfFrames].SetInt32(0, NumberOfFrames);
            if (dataset.Contains(DicomTags.PlanarConfiguration))
                dataset[DicomTags.PlanarConfiguration].SetInt32(0, PlanarConfiguration);
            if (dataset.Contains(DicomTags.LossyImageCompression) || LossyImageCompression.Length > 0)
                dataset[DicomTags.LossyImageCompression].SetString(0, LossyImageCompression);
            if (dataset.Contains(DicomTags.LossyImageCompressionRatio) || (LossyImageCompressionRatio != 1.0f && LossyImageCompressionRatio != 0.0f)) 
                dataset[DicomTags.LossyImageCompressionRatio].SetFloat32(0, LossyImageCompressionRatio);
            if (dataset.Contains(DicomTags.LossyImageCompressionMethod) || LossyImageCompressionMethod.Length > 0)
                dataset[DicomTags.LossyImageCompressionMethod].SetString(0, LossyImageCompressionMethod);
			if (dataset.Contains(DicomTags.DerivationDescription) || DerivationDescription.Length > 0)
			{
				string currentValue = dataset[DicomTags.DerivationDescription].ToString();

				dataset[DicomTags.DerivationDescription].SetStringValue(DerivationDescription);
				if (!currentValue.Equals(DerivationDescription))
				{
					DicomSequenceItem item = new DicomSequenceItem();
					CodeSequenceMacro macro = new CodeSequenceMacro(item);
					macro.CodeMeaning = "Lossy Compression";
					macro.CodeValue = "113040";
					macro.CodingSchemeDesignator = "DCM";
					macro.ContextGroupVersion = new DateTime(2005,8,22);
					macro.ContextIdentifier = "7203";
					macro.MappingResource = "DCMR";

					dataset[DicomTags.DerivationCodeSequence].AddSequenceItem(item);
				}
			}
        	if (dataset.Contains(DicomTags.RescaleSlope) || DecimalRescaleSlope != 1.0M || DecimalRescaleIntercept != 0.0M)
				dataset[DicomTags.RescaleSlope].SetString(0, RescaleSlope);
			if (dataset.Contains(DicomTags.RescaleIntercept) || DecimalRescaleSlope != 1.0M || DecimalRescaleIntercept != 0.0M)
				dataset[DicomTags.RescaleIntercept].SetString(0, RescaleIntercept);

			if (dataset.Contains(DicomTags.WindowCenter) || LinearVoiLuts.Count > 0)
				Window.SetWindowCenterAndWidth(dataset, LinearVoiLuts);

			//Remove the palette color lut, if the pixels were translated to RGB
			if (dataset.Contains(DicomTags.RedPaletteColorLookupTableData)
			&& dataset.Contains(DicomTags.BluePaletteColorLookupTableData)
			&& dataset.Contains(DicomTags.GreenPaletteColorLookupTableData)
			&& !HasPaletteColorLut)
			{
				dataset.RemoveAttribute(DicomTags.BluePaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.BluePaletteColorLookupTableData);
				dataset.RemoveAttribute(DicomTags.RedPaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.RedPaletteColorLookupTableData);
				dataset.RemoveAttribute(DicomTags.GreenPaletteColorLookupTableDescriptor);
				dataset.RemoveAttribute(DicomTags.GreenPaletteColorLookupTableData);
			}

			dataset.SaveDicomFields(this);
            dataset[DicomTags.PixelData] = _sq;
        }
开发者ID:scottshea,项目名称:monodicom,代码行数:60,代码来源:DicomPixelData.cs


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