Пример #1
0
		private void Initialize()
		{
			_backupDir = ProcessorContext.BackupDirectory;

				_oldStudyPath = _oldStudyLocation.GetStudyPath();
				_oldStudyInstanceUid = _oldStudyLocation.StudyInstanceUid;
				_oldStudyFolder = _oldStudyLocation.StudyFolder;
				_newStudyInstanceUid = _oldStudyInstanceUid;

			_study = _oldStudyLocation.LoadStudy(ServerExecutionContext.Current.ReadContext);
				_totalSopCount = _study.NumberOfStudyRelatedInstances;
			_curPatient = _study.LoadPatient(ServerExecutionContext.Current.ReadContext);
				_oldPatientInfo = new PatientInfo
				                  	{
				                  		Name = _curPatient.PatientsName,
				                  		PatientId = _curPatient.PatientId,
				                  		IssuerOfPatientId = _curPatient.IssuerOfPatientId
				                  	};

				_newPatientInfo = new PatientInfo(_oldPatientInfo);
				Debug.Assert(_newPatientInfo.Equals(_oldPatientInfo));

				foreach (BaseImageLevelUpdateCommand command in _commands)
				{
					ImageLevelUpdateEntry imageLevelUpdate = command.UpdateEntry;
					if (imageLevelUpdate == null)
						continue;

					if (imageLevelUpdate.TagPath.Tag.TagValue == DicomTags.StudyInstanceUid)
					{
						_newStudyInstanceUid = imageLevelUpdate.GetStringValue();
					}
					else if (imageLevelUpdate.TagPath.Tag.TagValue == DicomTags.PatientId)
					{
						_newPatientInfo.PatientId = imageLevelUpdate.GetStringValue();
					}
					else if (imageLevelUpdate.TagPath.Tag.TagValue == DicomTags.IssuerOfPatientId)
					{
						_newPatientInfo.IssuerOfPatientId = imageLevelUpdate.GetStringValue();
					}
					else if (imageLevelUpdate.TagPath.Tag.TagValue == DicomTags.PatientsName)
					{
						_newPatientInfo.Name = imageLevelUpdate.GetStringValue();
					}
				}

				Platform.CheckForNullReference(_newStudyInstanceUid, "_newStudyInstanceUid");

				NewStudyPath = Path.Combine(_oldStudyLocation.FilesystemPath, _partition.PartitionFolder);
				NewStudyPath = Path.Combine(NewStudyPath, _oldStudyFolder);
				NewStudyPath = Path.Combine(NewStudyPath, _newStudyInstanceUid);

			_newPatient = FindPatient(_newPatientInfo, ServerExecutionContext.Current.ReadContext);
				_patientInfoIsNotChanged = _newPatientInfo.Equals(_oldPatientInfo);

				Statistics.InstanceCount = _study.NumberOfStudyRelatedInstances;
				Statistics.StudySize = (ulong) _oldStudyLocation.LoadStudyXml().GetStudySize();

				// The study path will be changed. We will need to delete the original folder at the end.
				// May be too simple to test if two paths are the same. But let's assume it is good enough for 99% of the time.
				_deleteOriginalFolder = NewStudyPath != _oldStudyPath;
				_initialized = true;
			}
		private void Initialize()
		{
			_study = Study.Find(ServerExecutionContext.Current.ReadContext,_studyLocation.StudyInstanceUid, _partition);
			_curPatient = _study.LoadPatient(ServerExecutionContext.Current.ReadContext);
			_oldPatientInfo = new PatientInfo
				{
					PatientsName = _curPatient.PatientsName,
					PatientId = _curPatient.PatientId,
					IssuerOfPatientId = _curPatient.IssuerOfPatientId
				};

			_seriesInstanceUid = _file.DataSet[DicomTags.SeriesInstanceUid].ToString();
			var broker = ServerExecutionContext.Current.ReadContext.GetBroker<ISeriesEntityBroker>();
			var select = new SeriesSelectCriteria();
			select.SeriesInstanceUid.EqualTo(_seriesInstanceUid);
			select.ServerPartitionKey.EqualTo(_partition.Key);
			_curSeries = broker.FindOne(select);

			_newPatientInfo = new PatientInfo(_oldPatientInfo);
			_file.DataSet.LoadDicomFields(_newPatientInfo);

			_newPatient = FindPatient(_newPatientInfo, ServerExecutionContext.Current.ReadContext);
			_patientInfoIsNotChanged = _newPatientInfo.Equals(_oldPatientInfo);
		}