public ICollection <Group> Resolve(StudyData source, Study destination, ICollection <Group> destMember, ResolutionContext context)
    {
        var destGroups = new List <Group>();

        if (source.Groups == null)
        {
            return(destGroups);
        }

        foreach (var group in source.Groups)
        {
            var newGroup = new Group()
            {
                Name = group.Name
            };

            if (group.Id != null)
            {
                newGroup.Id = group.Id.Value;
            }

            destGroups.Add(newGroup);
        }
        return(destGroups);
    }
예제 #2
0
        public void TestPrototypes()
        {
            Initialize();

            StudyData studyPrototype = new StudyData();

            studyPrototype.PatientId            = "123";
            studyPrototype.PatientsBirthDateRaw = "19760810";
            studyPrototype.PatientsNameRaw      = "Patient^Anonymous";
            studyPrototype.PatientsSex          = "M";
            studyPrototype.StudyDateRaw         = "20080220";
            studyPrototype.StudyDescription     = "Test";
            studyPrototype.StudyId = "Test";

            SeriesData seriesPrototype = new SeriesData();

            seriesPrototype.SeriesDescription = "Series";
            seriesPrototype.ProtocolName      = "Protocol";
            seriesPrototype.SeriesNumber      = "1";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype  = studyPrototype;
            anonymizer.SeriesDataPrototype = seriesPrototype;
            anonymizer.Anonymize(_file);

            AfterAnonymize(studyPrototype, seriesPrototype);

            //validate the adjusted dates.
            Assert.AreEqual("20080220", _anonymizedDateData.InstanceCreationDate, "Anonymized InstanceCreationDate doesn't match StudyDate");
            Assert.AreEqual("20080220", _anonymizedDateData.SeriesDate, "Anonymized SeriesDate doesn't match StudyDate");
            Assert.AreEqual("20080220", _anonymizedDateData.ContentDate, "Anonymized ContentDate doesn't match StudyDate");
            Assert.AreEqual("20080220100406", _anonymizedDateData.AcquisitionDatetime, "Anonymized AcquisitionDatetime doesn't match StudyDate/Time");
        }
예제 #3
0
        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);
        }
    public ICollection <Task> Resolve(StudyData source, Study destination, ICollection <Task> destMember, ResolutionContext context)
    {
        var destTasks = new List <Task>();

        if (source.Tasks == null)
        {
            return(destTasks);
        }

        foreach (var task in source.Tasks)
        {
            var newTask = new Task()
            {
                Name = task.Name
            };

            if (task.Id != null)
            {
                newTask.Id = task.Id.Value;
            }

            destTasks.Add(newTask);
        }
        return(destTasks);
    }
예제 #5
0
        private void find_MatchStudy(object sender, MatchEventArgs <Study> e)
        {
            StudyData study = new StudyData( );

            study.Patient = new PatientData( );

            study.AccessionNumber = e.Info.AccessionNumber;
            study.AdmittingDiagnosesDescription = e.Info.AdmitDiagDescrp;
            study.Age                      = (e.Info.Age == null) ? null : e.Info.Age.Value.Number.ToString( ) + e.Info.Age.Value.Reference.ToString( );//TODO: this needs to be replaced with the DICOM encoding
            study.Date                     = (e.Info.Date == null) ? null : e.Info.Date.Value.ToString( );
            study.Description              = e.Info.Description;
            study.Id                       = e.Info.Id;
            study.InstanceUID              = e.Info.InstanceUID;
            study.ModalitiesInStudy        = (null != e.Info.ModalitiesInStudy) ? e.Info.ModalitiesInStudy.ToArray( ) : null;
            study.NumberOfRelatedInstances = e.Info.NumberOfRelatedInstances;
            study.NumberOfRelatedSeries    = e.Info.NumberofRelatedSeries;
            study.ReferringPhysiciansName  = e.Info.ReferringPhysiciansName.FullDicomEncoded;
            study.Size                     = (e.Info.Size == null) ? null : e.Info.Size.ToString( );
            study.Weight                   = (e.Info.Weight == null) ? null : e.Info.Weight.ToString( );
            study.Patient.ID               = e.Info.Patient.Id;
            study.Patient.Name             = e.Info.Patient.Name.FullDicomEncoded;
            study.Patient.BirthDate        = (e.Info.Patient.BirthDate == null) ? null : e.Info.Patient.BirthDate.ToString( );
            study.AdditionalPatientHistory = e.Dataset.GetValue <string> (DicomTag.AdditionalPatientHistory, string.Empty);

//study.NameOfDoctorsReading
            Matches.Add(study as T);
        }
예제 #6
0
        public IHttpActionResult GetStudyData(int id)    //当前登陆者的id !!!
        {
            StudyData mystuData = new StudyData();

            mystuData.userId = id;

            var qu = from Questions in db.Questions
                     where Questions.LastUpdatedBy == id
                     where Questions.Status.Contains("O")
                     where Questions.QuestionType.Contains("Q")
                     select Questions;

            mystuData.QuestionCount = qu.ToList().Count;

            var an = from answer in db.Notes
                     where answer.UserId == id
                     where answer.QuestionId != null
                     select answer;

            mystuData.AnswerCount = an.ToList().Count;

            var no = from Notes in db.Notes
                     where Notes.UserId == id
                     where Notes.QuestionId == null
                     select Notes;

            mystuData.NoteCount = no.ToList().Count;

            return(Ok(mystuData));
        }
예제 #7
0
        internal static StudyData ReadStudyData(WadoDataSetModel model)
        {
            var adaptee = new StudyData();

            adaptee.AccessionNumber = model.AccessionNumber;
            //adaptee.AdditionalPatientHistory
            //adaptee.AdmittingDiagnosesDescription
            //adaptee.Age
            adaptee.Date        = model.StudyDate;
            adaptee.Description = model.StudyDescription;
            //adaptee.Id
            adaptee.InstanceUID       = model.StudyInstanceUID;
            adaptee.ModalitiesInStudy = new string[] { model.Modality };
            //adaptee.NameOfDoctorsReading =
            //adaptee.NumberOfRelatedInstances =
            //adaptee.NumberOfRelatedSeries =
            adaptee.Patient           = new PatientData();
            adaptee.Patient.BirthDate = model.PatientBirthDate;
            //adaptee.Patient.Comments
            //adaptee.Patient.EthnicGroup
            adaptee.Patient.ID   = model.PatientID;
            adaptee.Patient.Name = model.PatientName;
            adaptee.Patient.NumberOfRelatedInstances = model.NumberOfStudyRelatedInstances;
            adaptee.Patient.NumberOfRelatedSeries    = model.NumberOfStudyRelatedSeries;
            //adaptee.Patient.NumberOfRelatedStudies
            adaptee.Patient.Sex = model.PatientSex;

            //adaptee.ReferringPhysiciansName
            //adaptee.Size =
            //adaptee.Weight =

            return(adaptee);
        }
예제 #8
0
        // GET: Study/Delete/5
        public ActionResult Delete(StudyData IdToDelete)
        {
            var d = instance.StudyDatas.Where(x => x.id == IdToDelete.id).FirstOrDefault();

            instance.StudyDatas.Remove(d);
            instance.SaveChanges();
            return(RedirectToAction("StudyRecord"));
        }
예제 #9
0
 public ActionResult Create([Bind(Exclude = "Id")] StudyData details)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     instance.StudyDatas.Add(details);
     instance.SaveChanges();
     return(RedirectToAction("StudyRecord"));
 }
예제 #10
0
        private bool Initialize()
        {
            _synchronizationContext = SynchronizationContext.Current;

            _exportedInstances = new AuditedInstances();
            _canceled          = false;
            _overwrite         = false;

            if (Anonymize)
            {
                ExportComponent component = new ExportComponent();
                component.OutputPath = OutputPath;

                if (DialogBoxAction.Ok != DesktopWindow.ShowDialogBox(component, SR.Export))
                {
                    return(false);
                }

                OutputPath = component.OutputPath;

                StudyData studyData = new StudyData
                {
                    PatientId         = component.PatientId,
                    PatientsNameRaw   = component.PatientsName,
                    PatientsBirthDate = component.PatientsDateOfBirth,
                    StudyId           = component.StudyId,
                    StudyDescription  = component.StudyDescription,
                    AccessionNumber   = component.AccessionNumber,
                    StudyDate         = component.StudyDate
                };

                _anonymizer = new DicomAnonymizer();
                _anonymizer.KeepPrivateTags    = component.KeepPrivateTags;
                _anonymizer.ValidationOptions  = ValidationOptions.RelaxAllChecks;
                _anonymizer.StudyDataPrototype = studyData;
            }
            else
            {
                SelectFolderDialogCreationArgs args = new SelectFolderDialogCreationArgs();
                args.Prompt = SR.MessageSelectOutputLocation;
                args.Path   = OutputPath;

                FileDialogResult result = DesktopWindow.ShowSelectFolderDialogBox(args);
                if (result.Action != DialogBoxAction.Ok)
                {
                    return(false);
                }

                OutputPath = result.FileName;
            }

            return(true);
        }
예제 #11
0
        public async Task <IActionResult> Save(StudyData data)

        {
            var study = _mapper.Map <Study>(data);

            _unitOfWork.studyRepository.Add(study);
            await _unitOfWork.SaveChangesAsync();

            var studyToReturn = _mapper.Map <StudyData>(study);

            return(Ok(studyToReturn));
        }
예제 #12
0
        public AnonymizeStudyOutput AnonymizeStudy(AnonymizeStudyInput input)
        {
            // load study to anonymize
            IDataStoreReader    reader = DataAccessLayer.GetIDataStoreReader();
            IStudy              study  = reader.GetStudy(input.StudyInstanceUID);
            List <ISopInstance> sops   = new List <ISopInstance>(study.GetSopInstances());

            // ensure there is a valid output location
            if (string.IsNullOrEmpty(input.OutputDirectory))
            {
                // create temp dir
            }

            string fullPath = Path.GetFullPath(input.OutputDirectory);

            if (!Directory.Exists(fullPath))
            {
                Directory.CreateDirectory(fullPath);
            }

            // set up anonymization data
            StudyData studyData = new StudyData();

            studyData.PatientId         = input.PatientId;
            studyData.PatientsNameRaw   = input.PatientsName;
            studyData.PatientsBirthDate = input.PatientsBirthDate;
            studyData.PatientsSex       = input.PatientsSex;
            studyData.AccessionNumber   = input.AccessionNumber;
            studyData.StudyDescription  = input.StudyDescription;
            studyData.StudyDate         = input.StudyDate;

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyData;

            //The default anonymizer removes the series data, so we just clone the original.
            anonymizer.AnonymizeSeriesDataDelegate =
                delegate(SeriesData original) { return(original.Clone()); };

            // anonymize each image in the study
            for (int i = 0; i < sops.Count; ++i)
            {
                ISopInstance sop  = sops[i];
                DicomFile    file = new DicomFile(sop.GetLocationUri().LocalDiskPath);

                anonymizer.Anonymize(file);

                file.Save(string.Format("{0}\\{1}.dcm", fullPath, i));
            }

            return(new AnonymizeStudyOutput(sops.Count));
        }
예제 #13
0
        public ActionResult Edit(StudyData IdToEdit)
        {
            var orignalRecord = (from m in instance.StudyDatas where m.id == IdToEdit.id select m).First();

            if (!ModelState.IsValid)
            {
                return(View(orignalRecord));
            }
            instance.Entry(orignalRecord).CurrentValues.SetValues(IdToEdit);

            instance.SaveChanges();
            return(RedirectToAction("StudyRecord"));
        }
        internal RenameStudyComponent(StudyItem studyItem)
        {
            _original = new StudyData();
            _original.AccessionNumber      = studyItem.AccessionNumber;
            _original.PatientsName         = studyItem.PatientsName;
            _original.PatientId            = studyItem.PatientId;
            _original.StudyDescription     = studyItem.StudyDescription;
            _original.PatientsBirthDateRaw = studyItem.PatientsBirthDate;
            _original.StudyDateRaw         = studyItem.StudyDate;

            _renamed = _original.Clone();

            _validator = new DicomAnonymizer.ValidationStrategy();
        }
예제 #15
0
        public void TestValidateAccessionNotEqual()
        {
            Initialize();

            _file.DataSet[DicomTags.AccessionNumber].SetStringValue("1234");
            StudyData studyPrototype = CreateStudyPrototype();

            studyPrototype.AccessionNumber = "1234";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);
        }
예제 #16
0
        public void TestValidatePatientsNameNotEmpty()
        {
            Initialize();

            _file.DataSet[DicomTags.PatientsName].SetStringValue("Patient^Anonymous^Mr");
            StudyData studyPrototype = CreateStudyPrototype();

            studyPrototype.PatientsNameRaw = "";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);
        }
예제 #17
0
        public void TestValidateStudyIdNotEqual()
        {
            Initialize();

            _file.DataSet[DicomTags.StudyId].SetStringValue("123");
            StudyData studyPrototype = CreateStudyPrototype();

            studyPrototype.StudyId = "123";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);
        }
예제 #18
0
        private static StudyData CreateStudyPrototype()
        {
            StudyData studyPrototype = new StudyData();

            studyPrototype.AccessionNumber   = "0x0A11BA5E";
            studyPrototype.PatientId         = "216CA75";
            studyPrototype.PatientsBirthDate = DateTime.Now;
            studyPrototype.PatientsNameRaw   = "PICARD^JEAN-LUC^^CPT.";
            studyPrototype.PatientsSex       = "M";
            studyPrototype.StudyDate         = DateTime.Now;
            studyPrototype.StudyDescription  = "Description of a study prototype, anonymized";
            studyPrototype.StudyId           = "STUDY158739";
            return(studyPrototype);
        }
예제 #19
0
        public void TestValidatePatientsBirthDateNotEqual()
        {
            Initialize();

            _file.DataSet[DicomTags.PatientsBirthDate].SetStringValue("19760810");
            StudyData studyPrototype = CreateStudyPrototype();

            studyPrototype.PatientsBirthDateRaw = "19760810";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);
        }
예제 #20
0
        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);
        }
예제 #21
0
        public async Task <IActionResult> UpdateStudy(StudyData data, int id)
        {
            var studyToUpdate = await _unitOfWork.studyRepository.Get(id);

            if (!string.IsNullOrEmpty(data.Name))
            {
                studyToUpdate.Name = data.Name;
                await _unitOfWork.SaveChangesAsync();

                var studyToReturn = _mapper.Map <StudyData>(studyToUpdate);
                return(Ok(studyToReturn));
            }

            return(Ok());
        }
예제 #22
0
        public Kinect(bool draw)
        {
            this.draw = draw;

            this.kinectSensor     = KinectSensor.GetDefault();
            this.coordinateMapper = this.kinectSensor.CoordinateMapper;

            FrameDescription frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;

            this.displayWidth  = frameDescription.Width;
            this.displayHeight = frameDescription.Height;

            studyData = StudyData.Always;
            StartWork();
        }
예제 #23
0
        public void TestValidatePatientIdAllowEmpty()
        {
            Initialize();

            _file.DataSet[DicomTags.PatientId].SetStringValue("123");
            StudyData studyPrototype = CreateStudyPrototype();

            studyPrototype.PatientId = "";

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.ValidationOptions  = ValidationOptions.AllowEmptyPatientId;
            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);
        }
예제 #24
0
        internal AnonymizeStudyComponent(IStudyRootData studyItem)
        {
            _original = new StudyData
            {
                AccessionNumber      = studyItem.AccessionNumber,
                PatientsName         = new PersonName(studyItem.PatientsName),
                PatientId            = studyItem.PatientId,
                StudyDescription     = studyItem.StudyDescription,
                PatientsBirthDateRaw = studyItem.PatientsBirthDate,
                StudyDateRaw         = studyItem.StudyDate
            };

            _anonymized = _original.Clone();

            _validator = new DicomAnonymizer.ValidationStrategy();
        }
    public ICollection <BasicData> Resolve(Study source, StudyData destination, ICollection <BasicData> destMember, ResolutionContext context)
    {
        var destinationTasks = new List <BasicData>();

        if (source.Tasks == null)
        {
            return(destinationTasks);
        }

        foreach (var task in source.Tasks)
        {
            destinationTasks.Add(new BasicData(task.Name, task.Id));
        }

        return(destinationTasks);
    }
예제 #26
0
 public static void SetStudyData(IControl studyTable, StudyData study)
 {
     SetStudyFieldData_Text(studyTable, "Study Name:             ", study.StudyName);
     SetStudyFieldData_Text(studyTable, "Study Label:             ", study.StudyLabel);
     SetStudyFieldData_Text(studyTable, "Protocol:             ", study.Protocol);
     SetStudyFieldData_Text(studyTable, "Protocol Label:             ", study.ProtocolLabel);
     SetStudyFieldData_Text(studyTable, "Protocol Title:  ", study.ProtocolTitle);
     SetStudyFieldData_Text(studyTable, "External Study ID:             ", study.ExternalStudyID);
     SetStudyFieldData_Text(studyTable, "Study Phase:             ", study.StudyPhase);
     SetStudyFieldData_Text(studyTable, "Study Drug Name:             ", study.StudyDrugName);
     SetStudyFieldData_Text(studyTable, "Study Indication:             ", study.StudyIndication);
     SetStudyFieldData_Dropdown(studyTable, "Therapeutic Area:", study.TherapeuticArea);
     SetStudyFieldData_Dropdown(studyTable, "Client/Sponsor:             ", study.Sponsor);
     SetStudyFieldData_Dropdown(studyTable, "Target App:                             ", study.TargetApp);
     SetStudyFieldData_Dropdown(studyTable, "Safety Mapping: [?]  ", study.SafetyMapping);
     SetStudyFieldData_Dropdown(studyTable, "Local Labs: [?]  ", study.LocalLabs);
 }
    public ICollection <BasicData> Resolve(Study source, StudyData destination, ICollection <BasicData> destMember, ResolutionContext context)
    {
        var destinationGroups = new List <BasicData>();

        if (source.Groups == null)
        {
            return(destinationGroups);
        }

        foreach (var group in source.Groups)
        {
            destinationGroups.Add(new BasicData(group.Name, group.Id));
        }


        return(destinationGroups);
    }
예제 #28
0
        public async Task <object> GetSubject(Guid studyid)
        {
            var study = await context.Studies.FindAsync(studyid);

            if (study == null)
            {
                return(NotFound("Study doesn't exist."));
            }

            var participation = user.ProtocolUsers.FirstOrDefault(x => x.Protocol.Id.Equals(study.Protocol.Id));

            if (participation == null)
            {
                return(NotFound("You don't have access to this study."));
            }
            var data = new StudyData(study);

            return(new StudyData(study));
        }
예제 #29
0
        internal AnonymizeStudyComponent(IStudyRootData studyItem)
        {
            _original = new StudyData
            {
                AccessionNumber      = studyItem.AccessionNumber,
                PatientsName         = new PersonName(studyItem.PatientsName),
                PatientId            = studyItem.PatientId,
                StudyDescription     = studyItem.StudyDescription,
                PatientsBirthDateRaw = studyItem.PatientsBirthDate,
                StudyDateRaw         = studyItem.StudyDate
            };

            _anonymized = _original.Clone();

            _validator = new DicomAnonymizer.ValidationStrategy();

            ShowKeepReportsAndAttachments = true;
            ShowPreserveSeriesData        = true;
        }
예제 #30
0
        public void TestFileMetaInformation()
        {
            Initialize();

            string oldUid = _file.DataSet[DicomTags.SopInstanceUid].ToString();

            StudyData studyPrototype = CreateStudyPrototype();

            DicomAnonymizer anonymizer = new DicomAnonymizer();

            anonymizer.StudyDataPrototype = studyPrototype;
            anonymizer.Anonymize(_file);

            Assert.AreNotEqual(oldUid, _file.DataSet[DicomTags.SopInstanceUid].ToString(), "Patient Confidentiality Issue - SOP Instance Uid is not anonymized.");
            Assert.AreNotEqual(oldUid, _file.MetaInfo[DicomTags.MediaStorageSopInstanceUid].ToString(), "Patient Confidentiality Issue - Media Storage SOP Instance Uid is not anonymized.");
            Assert.AreNotEqual(oldUid, _file.MediaStorageSopInstanceUid, "Patient Confidentiality Issue - Media Storage SOP Instance Uid is not anonymized.");
            Assert.AreEqual(_file.DataSet[DicomTags.SopInstanceUid].ToString(), _file.MetaInfo[DicomTags.MediaStorageSopInstanceUid].ToString(), "MetaInfo Media Storage SOP Instance doesn't match DataSet SOP Instance.");
            Assert.AreEqual(_file.DataSet[DicomTags.SopClassUid].ToString(), _file.MetaInfo[DicomTags.MediaStorageSopClassUid].ToString(), "MetaInfo Media Storage SOP Class doesn't match DataSet SOP Class.");
        }
예제 #31
0
		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);
		}
예제 #32
0
		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);
		}
예제 #33
0
		public void TestPrototypes()
		{
			Initialize();

			StudyData studyPrototype = new StudyData();
			studyPrototype.PatientId = "123";
			studyPrototype.PatientsBirthDateRaw = "19760810";
			studyPrototype.PatientsNameRaw = "Patient^Anonymous";
			studyPrototype.PatientsSex = "M";
			studyPrototype.StudyDateRaw = "20080220";
			studyPrototype.StudyDescription= "Test";
			studyPrototype.StudyId = "Test";

			SeriesData seriesPrototype = new SeriesData();
			seriesPrototype.SeriesDescription = "Series";
			seriesPrototype.ProtocolName = "Protocol";
			seriesPrototype.SeriesNumber = "1";

			DicomAnonymizer anonymizer = new DicomAnonymizer();
			anonymizer.StudyDataPrototype = studyPrototype;
			anonymizer.SeriesDataPrototype = seriesPrototype;
			anonymizer.Anonymize(_file);

			AfterAnonymize(studyPrototype, seriesPrototype);

			//validate the adjusted dates.
			Assert.AreEqual("20080220", _anonymizedDateData.InstanceCreationDate, "Anonymized InstanceCreationDate doesn't match StudyDate");
			Assert.AreEqual("20080220", _anonymizedDateData.SeriesDate, "Anonymized SeriesDate doesn't match StudyDate");
			Assert.AreEqual("20080220", _anonymizedDateData.ContentDate, "Anonymized ContentDate doesn't match StudyDate");
			Assert.AreEqual("20080220100406", _anonymizedDateData.AcquisitionDatetime, "Anonymized AcquisitionDatetime doesn't match StudyDate/Time");
		}
예제 #34
0
		private static StudyData CreateStudyPrototype()
		{
			StudyData studyPrototype = new StudyData();
			studyPrototype.AccessionNumber = "0x0A11BA5E";
			studyPrototype.PatientId = "216CA75";
			studyPrototype.PatientsBirthDate = DateTime.Now;
			studyPrototype.PatientsNameRaw = "PICARD^JEAN-LUC^^CPT.";
			studyPrototype.PatientsSex = "M";
			studyPrototype.StudyDate = DateTime.Now;
			studyPrototype.StudyDescription = "Description of a study prototype, anonymized";
			studyPrototype.StudyId = "STUDY158739";
			return studyPrototype;
		}