public override T Get <T>(int item = -1) { if (_values == null) { _values = base.Get <string[]>().Select(x => DicomUID.Parse(x)).ToArray(); } if (typeof(T) == typeof(DicomTransferSyntax)) { return((T)(object)DicomTransferSyntax.Lookup(_values[item])); } if (typeof(T) == typeof(DicomTransferSyntax[])) { return((T)(object)_values.Select(x => DicomTransferSyntax.Lookup(x)).ToArray()); } if (typeof(T) == typeof(DicomUID) || typeof(T) == typeof(object)) { return((T)(object)_values[item]); } if (typeof(T) == typeof(DicomUID[]) || typeof(T) == typeof(object[])) { return((T)(object)_values); } return(base.Get <T>(item)); }
/// <summary> /// Get the transfer syntax from the specified <paramref name="uid"/> string. /// </summary> /// <param name="uid">String representing transfer syntax UID.</param> /// <returns><see cref="DicomTransferSyntax"/> object corresponding to <paramref name="uid"/>.</returns> /// <remarks><see cref="Parse"/> is a wrapper around <see cref="Lookup"/> for string based <paramref name="uid"/>.</remarks> public static DicomTransferSyntax Parse(string uid) { if (uid == null) { throw new ArgumentNullException(nameof(uid)); } return(Lookup(DicomUID.Parse(s: uid, type: DicomUidType.TransferSyntax))); }
public void CanParseStringWithTrailingBlank() { var uid = DicomUID.Parse("1.2.3.4.5.6.7.8.9.0 "); Assert.Equal("Unknown", uid.Name); Assert.Equal("1.2.3.4.5.6.7.8.9.0", uid.UID); Assert.Equal(DicomUidType.Unknown, uid.Type); }
public void CanParseGeneric() { var uid = DicomUID.Parse <DicomUID>("1.2.3.4.5.6.7.8.9.0"); Assert.Equal("Unknown", uid.Name); Assert.Equal("1.2.3.4.5.6.7.8.9.0", uid.UID); Assert.Equal(DicomUidType.Unknown, uid.Type); }
public void CanParseWithNameAndType() { var uid = DicomUID.Parse(s: "1.2.3.4.5.6.7.8.9.0", name: "UidName", type: DicomUidType.TransferSyntax); Assert.Equal("UidName", uid.Name); Assert.Equal("1.2.3.4.5.6.7.8.9.0", uid.UID); Assert.Equal(DicomUidType.TransferSyntax, uid.Type); }
public void CanParseWithName() { var uid = DicomUID.Parse(s: "1.2.3.4.5.6.7.8.9.0", name: "UidName"); Assert.Equal("UidName", uid.Name); Assert.Equal("1.2.3.4.5.6.7.8.9.0", uid.UID); Assert.Equal(DicomUidType.Unknown, uid.Type); }
public void PrivateInformationCreatorUID_SetterGetter_DataIsMaintained() { var inFile = DicomFile.Open(@"Test Data\CT-MONO2-16-ankle"); var expected = "1.2.3"; inFile.FileMetaInfo.PrivateInformationCreatorUID = DicomUID.Parse(expected); using (var saveStream = new MemoryStream()) { inFile.Save(saveStream); saveStream.Seek(0, SeekOrigin.Begin); var file = DicomFile.Open(saveStream); Assert.Equal(expected, file.FileMetaInfo.PrivateInformationCreatorUID.UID); } }
public static DicomTransferSyntax Parse(string uid) { return(Lookup(DicomUID.Parse(uid))); }