DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomDataSet Class / Validate Method
Example

In This Topic
    Validate Method (DicomDataSet)
    In This Topic
    Validate all DicomAttributes within the DicomDataset
    Syntax
    'Declaration
     
    
    Public Sub Validate() 
    public void Validate()
    Remarks
    Throws a DicomValidationException on the first invalid DicomAttribute
    Example
    try 
    {
        DicomDataSet ds = new DicomDataSet("Invalid_DicomDataset.dcm");
        ds.Validate();
    }
    catch (DicomValidationException ex)
    {
        var group = Convert.ToUInt16(ex.Group);
        var element = Convert.ToUInt16(ex.Element);
        
        var tag = $"({group:X4},{element:X4})";
        var keyword = DicomGlobal.Keyword(group, element);
                        
        Debug.WriteLine($"Invalid attribute with tag: {tag} and Attribute Name: {keyword}. {Environment.NewLine} Exception message: {ex.Message}");
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also