private void AfterAnonymize(StudyData studyPrototype, SeriesData seriesPrototype) { _anonymizedUidData = new UidData(); _anonymizedStudyData = new StudyData(); _anonymizedSeriesData = new SeriesData(); _anonymizedDateData = new DateData(); _file.DataSet.LoadDicomFields(_anonymizedUidData); _file.DataSet.LoadDicomFields(_anonymizedStudyData); _file.DataSet.LoadDicomFields(_anonymizedSeriesData); _file.DataSet.LoadDicomFields(_anonymizedDateData); ValidateRemovedTags(_file.DataSet); ValidateNulledAttributes(_file.DataSet); ValidateRemappedUids(_originalUidData, _anonymizedUidData); Assert.AreEqual(_anonymizedStudyData.PatientId, studyPrototype.PatientId); Assert.AreEqual(_anonymizedStudyData.PatientsNameRaw, studyPrototype.PatientsNameRaw); Assert.AreEqual(_anonymizedStudyData.PatientsBirthDateRaw, studyPrototype.PatientsBirthDateRaw); Assert.AreEqual(_anonymizedStudyData.PatientsSex, studyPrototype.PatientsSex); Assert.AreEqual(_anonymizedStudyData.AccessionNumber, studyPrototype.AccessionNumber); Assert.AreEqual(_anonymizedStudyData.StudyDateRaw, studyPrototype.StudyDateRaw); Assert.AreEqual(_anonymizedStudyData.StudyDescription, studyPrototype.StudyDescription); Assert.AreEqual(_anonymizedStudyData.StudyId, studyPrototype.StudyId); Assert.AreEqual(_anonymizedSeriesData.SeriesDescription, seriesPrototype.SeriesDescription); Assert.AreEqual(_anonymizedSeriesData.ProtocolName, seriesPrototype.ProtocolName); Assert.AreEqual(_anonymizedSeriesData.SeriesNumber, seriesPrototype.SeriesNumber); }
private static void ValidateRemappedUids(UidData originalData, UidData anonymizedData) { if (originalData.StudyInstanceUid == anonymizedData.StudyInstanceUid) throw new Exception("StudyInstanceUid"); if (originalData.SeriesInstanceUid == anonymizedData.SeriesInstanceUid) throw new Exception("SeriesInstanceUid"); if (originalData.SopInstanceUid == anonymizedData.SopInstanceUid) throw new Exception("SopInstanceUid"); if (!String.IsNullOrEmpty(originalData.ReferencedSopInstanceUid) && originalData.ReferencedSopInstanceUid == anonymizedData.ReferencedSopInstanceUid) throw new Exception("ReferencedSopInstanceUid"); if (!String.IsNullOrEmpty(originalData.FrameOfReferenceUid) && originalData.FrameOfReferenceUid == anonymizedData.FrameOfReferenceUid) throw new Exception("FrameOfReferenceUid"); if (!String.IsNullOrEmpty(originalData.SynchronizationFrameOfReferenceUid) && originalData.SynchronizationFrameOfReferenceUid == anonymizedData.SynchronizationFrameOfReferenceUid) throw new Exception("SynchronizationFrameOfReferenceUid"); if (!String.IsNullOrEmpty(originalData.Uid) && originalData.Uid == anonymizedData.Uid) throw new Exception("Uid"); if (!String.IsNullOrEmpty(originalData.ReferencedFrameOfReferenceUid) && originalData.ReferencedFrameOfReferenceUid == anonymizedData.ReferencedFrameOfReferenceUid) throw new Exception("ReferencedFrameOfReferenceUid"); if (!String.IsNullOrEmpty(originalData.RelatedFrameOfReferenceUid) && originalData.RelatedFrameOfReferenceUid == anonymizedData.RelatedFrameOfReferenceUid) throw new Exception("RelatedFrameOfReferenceUid"); Trace.WriteLine("Validated Remapped Uids."); }
private void Initialize() { _file = CreateTestFile(); _originalUidData = new UidData(); _originaStudyData = new StudyData(); _originaSeriesData = new SeriesData(); _originalDateData = new DateData(); _file.DataSet.LoadDicomFields(_originalUidData); _file.DataSet.LoadDicomFields(_originaStudyData); _file.DataSet.LoadDicomFields(_originaSeriesData); _file.DataSet.LoadDicomFields(_originalDateData); }