protected override int OnStart(StudyLoaderArgs studyLoaderArgs) { _studyKey = studyLoaderArgs.Server as MINTApi.StudyKey; EventResult result = EventResult.Success; AuditedInstances loadedInstances = new AuditedInstances(); try { XmlDocument doc = RetrieveHeaderXml(); StudyMINTXml studyXml = new StudyMINTXml(studyLoaderArgs); studyXml.SetMemento(_studyKey.MetadataUri, doc); var allInstances = studyXml.AllInstances; _instances = allInstances.GetEnumerator(); var patientId = studyXml[DicomTags.PatientId].GetString(0, ""); var patientsName = studyXml[DicomTags.PatientsName].GetString(0, ""); var studyInstanceUid = studyXml[DicomTags.StudyInstanceUid].GetString(0, ""); loadedInstances.AddInstance(patientId, patientsName, studyInstanceUid); UseBulkLoading = false; if (UseBulkLoading) { binaryStream = new MINTBinaryStream(); binaryStream.SetBaseURI(_studyKey.MetadataUri); binaryStream.RetrievePixelData(); } return(allInstances.Count); } catch (Exception e) { Console.WriteLine("EXCEPTION: " + e.Message); result = EventResult.MajorFailure; throw; } finally { AuditHelper.LogOpenStudies(new string[] { this.Name }, loadedInstances, EventSource.CurrentUser, result); } }
private static MINTApi.StudyKey MINTStudyKey(StudyItem studyItem) { MINTApi.StudyKey key = studyItem.Server as MINTApi.StudyKey; if (key == null && Properties.Settings.Default.EnableXRef) { //we must be looking at studies listed in another server - see if the study is available in //the MINT service and cache it if it is. if (!_cachedKeys.TryGetValue(studyItem.StudyInstanceUid, out key)) { key = MINTApi.GetStudyKey(Properties.Settings.Default.MINTHostname, studyItem.StudyInstanceUid); if (key != null) { _cachedKeys[studyItem.StudyInstanceUid] = key; } } } return(key); }