本文整理汇总了C#中DicomDataset.Get方法的典型用法代码示例。如果您正苦于以下问题:C# DicomDataset.Get方法的具体用法?C# DicomDataset.Get怎么用?C# DicomDataset.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomDataset
的用法示例。
在下文中一共展示了DicomDataset.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromDataset
public static BitDepth FromDataset(DicomDataset dataset)
{
var allocated = dataset.Get<ushort>(DicomTag.BitsAllocated);
var stored = dataset.Get<ushort>(DicomTag.BitsStored);
var signed = dataset.Get<PixelRepresentation>(DicomTag.PixelRepresentation) == PixelRepresentation.Signed;
return new BitDepth(allocated, stored, GetHighBit(stored, signed), signed);
}
示例2: DicomFileMetaInformation
public DicomFileMetaInformation(DicomDataset dataset)
: this()
{
MediaStorageSOPClassUID = dataset.Get<DicomUID>(DicomTag.SOPClassUID);
MediaStorageSOPInstanceUID = dataset.Get<DicomUID>(DicomTag.SOPInstanceUID);
TransferSyntax = dataset.InternalTransferSyntax;
}
示例3: tryGetImageDateTime
private static bool tryGetImageDateTime(DicomTag dateTag, DicomTag timeTag, DicomDataset dataset,
ref DateTime imageDate, ref DateTime imageTime)
{
var dateValue = dataset.Get<DateTime>(dateTag);
var result = dateValue > DateTime.MinValue;
if (result)
{
imageDate = dateValue;
imageTime = dataset.Get<DateTime>(timeTag);
}
return result;
}
示例4: DicomFileMetaInformation
/// <summary>
/// Initializes a new instance of the <see cref="DicomFileMetaInformation"/> class.
/// </summary>
/// <param name="dataset">
/// The data set for which file meta information is required.
/// </param>
public DicomFileMetaInformation(DicomDataset dataset)
{
this.Version = new byte[] { 0x00, 0x01 };
this.MediaStorageSOPClassUID = dataset.Get<DicomUID>(DicomTag.SOPClassUID);
this.MediaStorageSOPInstanceUID = dataset.Get<DicomUID>(DicomTag.SOPInstanceUID);
this.TransferSyntax = dataset.InternalTransferSyntax;
this.ImplementationClassUID = DicomImplementation.ClassUID;
this.ImplementationVersionName = DicomImplementation.Version;
this.SourceApplicationEntityTitle = CreateSourceApplicationEntityTitle();
}
示例5: DicomFileMetaInformation
public DicomFileMetaInformation(DicomDataset dataset)
: base()
{
Version = new byte[] { 0x00, 0x01 };
MediaStorageSOPClassUID = dataset.Get<DicomUID>(DicomTag.SOPClassUID);
MediaStorageSOPInstanceUID = dataset.Get<DicomUID>(DicomTag.SOPInstanceUID);
TransferSyntax = dataset.InternalTransferSyntax;
ImplementationClassUID = DicomImplementation.ClassUID;
ImplementationVersionName = DicomImplementation.Version;
var machine = Environment.MachineName;
if (machine.Length > 16)
machine = machine.Substring(0, 16);
SourceApplicationEntityTitle = machine;
}
示例6: Add_UniversalResourceElement_Succeeds
public void Add_UniversalResourceElement_Succeeds()
{
var dataset = new DicomDataset();
dataset.Add(DicomTag.URNCodeValue, "abc");
Assert.IsType(typeof(DicomUniversalResource), dataset.First());
Assert.Equal("abc", dataset.Get<string>(DicomTag.URNCodeValue));
}
示例7: SerializeAndDeserializePrivateTags
public void SerializeAndDeserializePrivateTags()
{
var privCreatorDictEntry = new DicomDictionaryEntry(new DicomTag(0x0011, 0x0010), "Private Creator", "PrivateCreator", DicomVM.VM_1, false, DicomVR.LO);
DicomDictionary.Default.Add(privCreatorDictEntry);
DicomPrivateCreator privateCreator1 = DicomDictionary.Default.GetPrivateCreator("TESTCREATOR1");
DicomDictionary privDict1 = DicomDictionary.Default[privateCreator1];
var dictEntry = new DicomDictionaryEntry(DicomMaskedTag.Parse("0011", "xx01"), "TestPrivTagName", "TestPrivTagKeyword", DicomVM.VM_1, false, DicomVR.CS);
privDict1.Add(dictEntry);
var ds = new DicomDataset();
ds.Add(dictEntry.Tag, "VAL1");
ds.Add(DicomTag.SOPClassUID, DicomUID.CTImageStorage);
ds.Add(DicomTag.SOPInstanceUID, "2.25.123");
Assert.Equal(DicomVR.CS, ds.Get<DicomVR>(dictEntry.Tag));
var bytes = SerializeDicom_(ds);
File.OpenWrite("C:\\Temp\\x.dcm").Write(bytes, 0, bytes.Length);
var ds2 = ParseDicom_(bytes);
Assert.Equal(DicomVR.CS, ds2.Get<DicomVR>(dictEntry.Tag));
}
示例8: Add_OtherDoubleElementWithMultipleDoubles_Succeeds
public void Add_OtherDoubleElementWithMultipleDoubles_Succeeds()
{
var dataset = new DicomDataset();
dataset.Add(DicomTag.DoubleFloatPixelData, 3.45, 6.78, 9.01);
Assert.IsType(typeof(DicomOtherDouble), dataset.First());
Assert.Equal(3, dataset.Get<double[]>(DicomTag.DoubleFloatPixelData).Length);
}
示例9: Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds
public void Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds()
{
var dataset = new DicomDataset();
dataset.Add(DicomTag.LongCodeValue, "a", "b", "c");
Assert.IsType(typeof(DicomUnlimitedCharacters), dataset.First());
Assert.Equal("c", dataset.Get<string>(DicomTag.LongCodeValue, 2));
}
示例10: Add_OtherDoubleElementWithMultipleDoubles_Succeeds
public void Add_OtherDoubleElementWithMultipleDoubles_Succeeds()
{
var tag = DicomTag.DoubleFloatPixelData;
var dataset = new DicomDataset();
dataset.Add(tag, 3.45, 6.78, 9.01);
Assert.IsType<DicomOtherDouble>(dataset.First(item => item.Tag.Equals(tag)));
Assert.Equal(3, dataset.Get<double[]>(tag).Length);
}
示例11: Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds
public void Add_UnlimitedCharactersElementWithMultipleStrings_Succeeds()
{
var tag = DicomTag.LongCodeValue;
var dataset = new DicomDataset();
dataset.Add(tag, "a", "b", "c");
Assert.IsType<DicomUnlimitedCharacters>(dataset.First(item => item.Tag.Equals(tag)));
Assert.Equal("c", dataset.Get<string>(tag, 2));
}
示例12: DicomDateTime_FractionalSecondsAndTimezone_SupportedFormat
public void DicomDateTime_FractionalSecondsAndTimezone_SupportedFormat()
{
var dt = DateTime.Now.ToString("yyyyMMddHHmmss.ffffffzzz");
var dataset = new DicomDataset { new DicomDateTime(DicomTag.ScheduledProcedureStepStartDateTime, dt) };
var exception = Record.Exception(() => dataset.Get<DicomDateRange>(DicomTag.ScheduledProcedureStepStartDateTime));
Assert.Null(exception);
}
示例13: Add_UniversalResourceElement_Succeeds
public void Add_UniversalResourceElement_Succeeds()
{
var tag = DicomTag.URNCodeValue;
var dataset = new DicomDataset();
dataset.Add(tag, "abc");
Assert.IsType<DicomUniversalResource>(dataset.First(item => item.Tag.Equals(tag)));
Assert.Equal("abc", dataset.Get<string>(tag));
}
示例14: FromDataset
public static GrayscaleRenderOptions FromDataset(DicomDataset dataset)
{
var bits = BitDepth.FromDataset(dataset);
var options = new GrayscaleRenderOptions(bits);
options.RescaleSlope = dataset.Get<double>(DicomTag.RescaleSlope, 1.0);
options.RescaleIntercept = dataset.Get<double>(DicomTag.RescaleIntercept, 0.0);
if (dataset.Contains(DicomTag.WindowWidth) && dataset.Get<double>(DicomTag.WindowWidth) != 0.0) {
options.WindowWidth = dataset.Get<double>(DicomTag.WindowWidth);
options.WindowCenter = dataset.Get<double>(DicomTag.WindowCenter);
} else if (dataset.Contains(DicomTag.SmallestImagePixelValue) && dataset.Contains(DicomTag.LargestImagePixelValue)) {
var smallElement = dataset.Get<DicomElement>(DicomTag.SmallestImagePixelValue);
var largeElement = dataset.Get<DicomElement>(DicomTag.LargestImagePixelValue);
int smallValue = 0;
int largeValue = 0;
if (smallElement.ValueRepresentation == DicomVR.US) {
smallValue = smallElement.Get<ushort>(0);
largeValue = smallElement.Get<ushort>(0);
} else {
smallValue = smallElement.Get<short>(0);
largeValue = smallElement.Get<short>(0);
}
options.WindowWidth = largeValue - smallValue;
options.WindowCenter = (largeValue + smallValue) / 2.0;
}
options.Monochrome1 = dataset.Get<PhotometricInterpretation>(DicomTag.PhotometricInterpretation) == PhotometricInterpretation.Monochrome1;
return options;
}
示例15: Add_UniversalResourceElementWithMultipleStrings_OnlyFirstValueIsUsed
public void Add_UniversalResourceElementWithMultipleStrings_OnlyFirstValueIsUsed()
{
var dataset = new DicomDataset();
dataset.Add(DicomTag.URNCodeValue, "a", "b", "c");
Assert.IsType(typeof(DicomUniversalResource), dataset.First());
var data = dataset.Get<string[]>(DicomTag.URNCodeValue);
Assert.Equal(1, data.Length);
Assert.Equal("a", data.First());
}