本文整理汇总了C#中DicomAttributeCollection.RemoveAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# DicomAttributeCollection.RemoveAttribute方法的具体用法?C# DicomAttributeCollection.RemoveAttribute怎么用?C# DicomAttributeCollection.RemoveAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomAttributeCollection
的用法示例。
在下文中一共展示了DicomAttributeCollection.RemoveAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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;
}