/// <summary> /// Finds the Presentation Context with the specified Abstract Syntax. If it can't find it, throws an <see cref="DicomException"/>. /// It is useful to throw an exception for for a Scu, so we don't have to keep checking for a valid pcid. /// </summary> /// <param name="abstractSyntax">Abstract Syntax</param> /// <returns>Presentation Context ID</returns> /// <exception cref="DicomException"/> public byte FindAbstractSyntaxOrThrowException(SopClass abstractSyntax) { foreach (DicomPresContext ctx in _presContexts.Values) { if (ctx.AbstractSyntax.Uid == abstractSyntax.Uid) return ctx.ID; } throw new DicomException("Cannot find abstract syntax in presentation context: " + abstractSyntax.ToString()); }
/// <summary> /// Finds the Presentation Context with the specified Abstract Syntax. If it can't find it, throws an <see cref="DicomException"/>. /// It is useful to throw an exception for for a Scu, so we don't have to keep checking for a valid pcid. /// </summary> /// <param name="abstractSyntax">Abstract Syntax</param> /// <returns>Presentation Context ID</returns> /// <exception cref="DicomException"/> public byte FindAbstractSyntaxOrThrowException(SopClass abstractSyntax) { foreach (DicomPresContext ctx in _presContexts.Values) { if (ctx.AbstractSyntax.Uid == abstractSyntax.Uid) { return(ctx.ID); } } throw new DicomException("Cannot find abstract syntax in presentation context: " + abstractSyntax.ToString()); }