public SopInstanceProcessor(StudyProcessorContext context) { Platform.CheckForNullReference(context, "context"); _context = context; _patientNameRules = new PatientNameRules(context.Study); }
/// <summary> /// Apply changes to the file prior to processing it. /// </summary> /// <param name="uid"></param> /// <param name="file"></param> protected virtual InstancePreProcessingResult PreProcessFile(WorkQueueUid uid, DicomFile file) { String contextID = uid.GroupID ?? String.Format("{0}_{1}", String.IsNullOrEmpty(file.SourceApplicationEntityTitle) ? ServerPartition.AeTitle : file.SourceApplicationEntityTitle, WorkQueueItem.InsertTime.ToString("yyyyMMddHHmmss")); var result = new InstancePreProcessingResult(); var patientNameRules = new PatientNameRules(Study); UpdateItem updateItem = patientNameRules.Apply(file); result.Modified = updateItem != null; var autoBaseReconciler = new AutoReconciler(contextID, StorageLocation); InstancePreProcessingResult reconcileResult = autoBaseReconciler.Process(file); result.AutoReconciled = reconcileResult != null; result.Modified |= reconcileResult != null; if (reconcileResult!=null && reconcileResult.DiscardImage) { result.DiscardImage = true; } // if the studyuid is modified, the file will be deleted by the caller. if (file.DataSet[DicomTags.StudyInstanceUid].ToString().Equals(StorageLocation.StudyInstanceUid)) { if (result.Modified) file.Save(); } return result; }
protected override bool Initialize(Model.WorkQueue item, out string failureDescription) { if (!base.Initialize(item, out failureDescription)) return false; _processDuplicateEntry = new WorkQueueProcessDuplicateSop(item); _patientNameRules = new PatientNameRules(Study); HistoryLogged = _processDuplicateEntry.QueueData != null && _processDuplicateEntry.QueueData.State.HistoryLogged; return true; }