public void Validate(DicomFile dicomFile) { DicomAttributeCollection sopInstanceDataset = dicomFile.DataSet; DicomAttributeCollection metaInfo = dicomFile.MetaInfo; DicomAttribute attribute = metaInfo[DicomTags.MediaStorageSopClassUid]; // we want to skip Media Storage Directory Storage (DICOMDIR directories) if ("1.2.840.10008.1.3.10" == attribute.ToString()) { throw new DataStoreException("Cannot process dicom directory files."); } DicomValidator.ValidateStudyInstanceUID(sopInstanceDataset[DicomTags.StudyInstanceUid]); DicomValidator.ValidateSeriesInstanceUID(sopInstanceDataset[DicomTags.SeriesInstanceUid]); DicomValidator.ValidateSOPInstanceUID(sopInstanceDataset[DicomTags.SopInstanceUid]); DicomValidator.ValidateTransferSyntaxUID(metaInfo[DicomTags.TransferSyntaxUid]); if (dicomFile.SopClass == null) { throw new DataStoreException("The sop class must not be empty."); } DicomValidator.ValidateSopClassUid(dicomFile.SopClass.Uid); Study study = new Study(); study.Initialize(dicomFile); _validator.ValidatePersistentObject(study); }
/// <summary> /// Validates the <see cref="Sop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="Sop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> protected virtual void ValidateInternal() { if (ValidationSettings.Default.DisableSopValidation) { return; } DicomValidator.ValidateSOPInstanceUID(this.SopInstanceUid); DicomValidator.ValidateSeriesInstanceUID(this.SeriesInstanceUid); DicomValidator.ValidateStudyInstanceUID(this.StudyInstanceUid); }
/// <summary> /// Validates the <see cref="Sop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="Sop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> protected virtual void ValidateInternal() { if (_disableSopValidation) { return; } DicomValidator.ValidateSOPInstanceUID(SopInstanceUid, false); DicomValidator.ValidateSeriesInstanceUID(SeriesInstanceUid, false); DicomValidator.ValidateStudyInstanceUID(StudyInstanceUid, false); }