/// <summary> /// Load the values for the sequence <see cref="DicomTags.RequestAttributesSequence"/> /// into a response message for a specific series. /// </summary> /// <param name="read">The connection to use to read the values.</param> /// <param name="response">The message to add the values into.</param> /// <param name="row">The <see cref="Series"/> entity to load the related <see cref="RequestAttributes"/> entity for.</param> private static void LoadRequestAttributes(IPersistenceContext read, DicomMessageBase response, Series row) { var select = read.GetBroker<IRequestAttributesEntityBroker>(); var criteria = new RequestAttributesSelectCriteria(); criteria.SeriesKey.EqualTo(row.GetKey()); IList<RequestAttributes> list = select.Find(criteria); if (list.Count == 0) { response.DataSet[DicomTags.RequestAttributesSequence].SetNullValue(); return; } foreach (RequestAttributes request in list) { var item = new DicomSequenceItem(); item[DicomTags.ScheduledProcedureStepId].SetStringValue(request.ScheduledProcedureStepId); item[DicomTags.RequestedProcedureId].SetStringValue(request.RequestedProcedureId); response.DataSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item); } }
private void OnSeriesDeleted(Series seriesUid) { EnsureWebDeleteExtensionsLoaded(); foreach (IWebDeleteProcessorExtension extension in _extensions) { try { WebDeleteProcessorContext context = new WebDeleteProcessorContext(this, Level, StorageLocation, _reason, _userId, _userName); extension.OnSeriesDeleted(context, seriesUid); } catch (Exception ex) { Platform.Log(LogLevel.Error, ex, "Error occurred in the extension but was ignored"); } } }
public DeleteSeriesFromDBCommand(StudyStorageLocation location, Series series) : base(String.Format("Delete Series In DB {0}", series.SeriesInstanceUid)) { _location = location; _series = series; }
/// <summary> /// Populate the data from a <see cref="Series"/> entity into a DICOM C-FIND-RSP message. /// </summary> /// <param name="read">The connection to use to read the values.</param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="tagList"></param> /// <param name="row">The <see cref="Series"/> table to populate the row from.</param> private void PopulateSeries(IPersistenceContext read, DicomMessageBase request, DicomMessageBase response, IEnumerable<DicomTag> tagList, Series row) { DicomAttributeCollection dataSet = response.DataSet; Study theStudy = Study.Load(read, row.StudyKey); StudyStorage storage = StudyStorage.Load(read, theStudy.ServerPartitionKey, theStudy.StudyInstanceUid); dataSet[DicomTags.RetrieveAeTitle].SetStringValue(Partition.AeTitle); dataSet[DicomTags.InstanceAvailability].SetStringValue(storage.StudyStatusEnum == StudyStatusEnum.Nearline ? "NEARLINE" : "ONLINE"); var characterSet = GetPreferredCharacterSet(); if (!string.IsNullOrEmpty(characterSet)) { dataSet[DicomTags.SpecificCharacterSet].SetStringValue(characterSet); dataSet.SpecificCharacterSet = characterSet; } else if (false == String.IsNullOrEmpty(theStudy.SpecificCharacterSet)) { dataSet[DicomTags.SpecificCharacterSet].SetStringValue(theStudy.SpecificCharacterSet); dataSet.SpecificCharacterSet = theStudy.SpecificCharacterSet; // this will ensure the data is encoded using the specified character set } foreach (DicomTag tag in tagList) { try { switch (tag.TagValue) { case DicomTags.PatientId: dataSet[DicomTags.PatientId].SetStringValue(request.DataSet[DicomTags.PatientId].ToString()); break; case DicomTags.StudyInstanceUid: dataSet[DicomTags.StudyInstanceUid].SetStringValue( request.DataSet[DicomTags.StudyInstanceUid].ToString()); break; case DicomTags.SeriesInstanceUid: dataSet[DicomTags.SeriesInstanceUid].SetStringValue(row.SeriesInstanceUid); break; case DicomTags.Modality: dataSet[DicomTags.Modality].SetStringValue(row.Modality); break; case DicomTags.SeriesNumber: dataSet[DicomTags.SeriesNumber].SetStringValue(row.SeriesNumber); break; case DicomTags.SeriesDescription: dataSet[DicomTags.SeriesDescription].SetStringValue(row.SeriesDescription); break; case DicomTags.PerformedProcedureStepStartDate: dataSet[DicomTags.PerformedProcedureStepStartDate].SetStringValue( row.PerformedProcedureStepStartDate); break; case DicomTags.PerformedProcedureStepStartTime: dataSet[DicomTags.PerformedProcedureStepStartTime].SetStringValue( row.PerformedProcedureStepStartTime); break; case DicomTags.NumberOfSeriesRelatedInstances: dataSet[DicomTags.NumberOfSeriesRelatedInstances].AppendInt32(row.NumberOfSeriesRelatedInstances); break; case DicomTags.RequestAttributesSequence: LoadRequestAttributes(read, response, row); break; case DicomTags.QueryRetrieveLevel: dataSet[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES"); break; // Meta tags that should have not been in the RQ, but we've already set case DicomTags.RetrieveAeTitle: case DicomTags.InstanceAvailability: case DicomTags.SpecificCharacterSet: break; default: if (!tag.IsPrivate) dataSet[tag].SetNullValue(); foreach (var q in _queryExtensions) q.PopulateSeries(response, tag, row); break; } } catch (Exception e) { Platform.Log(LogLevel.Warn, e, "Unexpected error setting tag {0} in C-FIND-RSP", dataSet[tag].Tag.ToString()); if (!tag.IsPrivate) dataSet[tag].SetNullValue(); } } }
static public Series Insert(IUpdateContext update, Series entity) { var broker = update.GetBroker<ISeriesEntityBroker>(); var updateColumns = new SeriesUpdateColumns(); updateColumns.ServerPartitionKey = entity.ServerPartitionKey; updateColumns.StudyKey = entity.StudyKey; updateColumns.SeriesInstanceUid = entity.SeriesInstanceUid; updateColumns.Modality = entity.Modality; updateColumns.NumberOfSeriesRelatedInstances = entity.NumberOfSeriesRelatedInstances; updateColumns.PerformedProcedureStepStartDate = entity.PerformedProcedureStepStartDate; updateColumns.PerformedProcedureStepStartTime = entity.PerformedProcedureStepStartTime; updateColumns.SourceApplicationEntityTitle = entity.SourceApplicationEntityTitle; updateColumns.SeriesNumber = entity.SeriesNumber; updateColumns.SeriesDescription = entity.SeriesDescription; Series newEntity = broker.Insert(updateColumns); return newEntity; }
static public Series Insert(Series entity) { using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { Series newEntity = Insert(update, entity); update.Commit(); return newEntity; } }
private void LoadSeriesDetails() { if (!String.IsNullOrEmpty(_serverae) && !String.IsNullOrEmpty(_studyInstanceUid) && !String.IsNullOrEmpty(_seriesInstanceUid)) { StudyAdaptor studyAdaptor = new StudyAdaptor(); SeriesSearchAdaptor seriesAdaptor = new SeriesSearchAdaptor(); ServerPartitionDataAdapter adaptor = new ServerPartitionDataAdapter(); ServerPartitionSelectCriteria criteria = new ServerPartitionSelectCriteria(); criteria.AeTitle.EqualTo(_serverae); Model.ServerPartition partition = adaptor.GetFirst(criteria); if (partition != null) { Partition = partition; StudySelectCriteria studyCriteria = new StudySelectCriteria(); studyCriteria.StudyInstanceUid.EqualTo(_studyInstanceUid); studyCriteria.ServerPartitionKey.EqualTo(Partition.GetKey()); Model.Study study = studyAdaptor.GetFirst(studyCriteria); if (study != null) { // there should be only one study _study = study; SeriesSelectCriteria seriesCriteria = new SeriesSelectCriteria(); seriesCriteria.SeriesInstanceUid.EqualTo(_seriesInstanceUid); Series series = seriesAdaptor.GetFirst(seriesCriteria); if (series != null) { _series = series; } } } } if (_study!=null && _series != null) { SeriesDetailsPanel1.Study = _study; SeriesDetailsPanel1.Series = _series; } DataBind(); }
private void ValidateSeries(StudyStorageLocation location, Series series, SeriesXml seriesXml) { Study study = location.Study; ServerPartition partition = location.ServerPartition; if (seriesXml == null) { throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount, new ValidationStudyInfo(study, partition), String.Format("Series {0} exists in the datbase but not in the study xml", series.SeriesInstanceUid)); } if (series.NumberOfSeriesRelatedInstances != seriesXml.NumberOfSeriesRelatedInstances) { throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount, new ValidationStudyInfo(study, partition), String.Format("Number of Series Related Instance in the database and xml for series {0} do not match: {1} vs {2}", series.SeriesInstanceUid, series.NumberOfSeriesRelatedInstances, seriesXml.NumberOfSeriesRelatedInstances)); } long seriesImageCount = DirectoryUtility.Count(location.GetSeriesPath(series.SeriesInstanceUid), "*" + ServerPlatform.DicomFileExtension, true, null); if (seriesXml.NumberOfSeriesRelatedInstances != seriesImageCount) { throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount, new ValidationStudyInfo(study, partition), String.Format("Number of Series Related Instance in the xml for series {0} does not match number of images in the series folder: {1} vs {2}", series.SeriesInstanceUid, seriesXml.NumberOfSeriesRelatedInstances, seriesImageCount)); } }
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); }
public void OnSeriesDeleted(WebDeleteProcessorContext context, Series _series) { }
public void OnSeriesDeleting(WebDeleteProcessorContext context, Series series) { _studyInfo = StudyInformation.CreateFrom(context.StorageLocation.Study); }