This class is for building a stack of anonymization options and then executing
예제 #1
0
        public static AnonymizationQueue BuildQueue(AnonymizationSettings settings, IEnumerable <string> dcmFiles)
        {
            var anonQue = new AnonymizationQueue();

            if (settings.DoAnonymizeStudyIDs || settings.DoAnonymizeUIDs)
            {
                var studyAnon = settings.DoAnonymizeStudyIDs ? new StudyIdAnonymizer() : null;
                var uidAnon   = settings.DoAnonymizeUIDs ? new UIDAnonymizer() : null;
                foreach (var file in dcmFiles)
                {
                    var ob = DICOMObject.Read(file);
                    if (uidAnon != null)
                    {
                        uidAnon.AddDICOMObject(ob);
                    }
                    if (studyAnon != null)
                    {
                        studyAnon.AddDICOMObject(ob);
                    }
                }
                if (studyAnon != null)
                {
                    studyAnon.FinalizeDictionary();
                    anonQue.Queue.Add(studyAnon);
                }
                if (uidAnon != null)
                {
                    anonQue.Queue.Add(uidAnon);
                }
            }
            if (settings.DoAnonymizeNames)
            {
                anonQue.Queue.Add(new NameAnonymizer());
            }
            if (settings.DoRemovePrivateTags)
            {
                anonQue.Queue.Add(new PrivateTagAnonymizer());
            }
            if (settings.DoDICOMProfile)
            {
                anonQue.Queue.Add(new ProfileAnonymizer());
            }
            anonQue.Queue.Add(new PatientIdAnonymizer(settings.FirstName, settings.LastName, settings.Id));
            anonQue.Queue.Add(new DateAnonymizer(settings.DateSettings));
            return(anonQue);
        }
예제 #2
0
        public static AnonymizationQueue BuildQueue(AnonymizationSettings settings, IEnumerable<string> dcmFiles)
        {
            var anonQue = new AnonymizationQueue();

            if (settings.DoAnonymizeStudyIDs || settings.DoAnonymizeUIDs)
            {
                StudyIdAnonymizer studyAnon = settings.DoAnonymizeStudyIDs ? new StudyIdAnonymizer() : null;
                UIDAnonymizer uidAnon = settings.DoAnonymizeUIDs ? new UIDAnonymizer() : null;
                foreach (var file in dcmFiles)
                {
                    var ob = DICOMObject.Read(file);
                    if (uidAnon != null) uidAnon.AddDICOMObject(ob);
                    if (studyAnon != null) studyAnon.AddDICOMObject(ob);
                }
                if (studyAnon != null) { studyAnon.FinalizeDictionary(); anonQue.Queue.Add(studyAnon); }
                if (uidAnon != null) { anonQue.Queue.Add(uidAnon); }
            }
            if (settings.DoAnonymizeNames) { anonQue.Queue.Add(new NameAnonymizer()); }
            if (settings.DoRemovePrivateTags) { anonQue.Queue.Add(new PrivateTagAnonymizer()); }
            if (settings.DoDICOMProfile) { anonQue.Queue.Add(new ProfileAnonymizer()); }
            anonQue.Queue.Add(new PatientIdAnonymizer(settings.FirstName, settings.LastName, settings.Id));
            anonQue.Queue.Add(new DateAnonymizer(settings.DateSettings));
            return anonQue;
        }