public async Task <Stream> GetSeriesThumbnail(string authenticationCookie, string studyInstanceUID, string seriesInstanceUID, string mimeType, int bitsPerPixel, int qualityFactor, int width, int height) { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); if (string.IsNullOrEmpty(mimeType)) { mimeType = SupportedMimeTypes.JPG; if (qualityFactor < 2) { qualityFactor = 2; } } var retrieve_query = new QueryOptions(); retrieve_query.StudiesOptions = new StudiesQueryOptions(); retrieve_query.StudiesOptions.StudyInstanceUID = studyInstanceUID; retrieve_query.SeriesOptions = new SeriesQueryOptions(); retrieve_query.SeriesOptions.SeriesInstanceUID = seriesInstanceUID; var config = RemoteConnectionFactory.Config(new WadoConnection() { dicomWebRoot = @"http://localhost/WadoService/api/", rs = "wado-rs" }); return(await _retrieve.Value.RetrieveDatasetRendered(config, retrieve_query, new System.Drawing.Size(width, height))); //can be supported: mimeType, bitsPerPixel, qualityFactor }
public void SaveRoleOptions(string authenticationCookie, string role, Dictionary <string, string> options) { string userName; userName = AuthHandler.Authorize(authenticationCookie, null); _optionsAddin.SaveRoleOptions(role, options); }
public Task <string> GetInstanceLocalPathName(string authenticationCookie, string instanceUID) { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport); string pathName = _exportAddin.GetInstanceLocalPathName(userName, instanceUID); return(Task.FromResult <string>(pathName)); }
public Task <string> GetDicomJSON(string authenticationCookie, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID, string userData) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); var uid = new ObjectUID(); uid.StudyInstanceUID = studyInstanceUID; uid.SeriesInstanceUID = seriesInstanceUID; if (string.IsNullOrEmpty(sopInstanceUID)) { var options = new QueryOptions(); options.StudiesOptions = new StudiesQueryOptions(); options.StudiesOptions.StudyInstanceUID = studyInstanceUID; options.SeriesOptions = new SeriesQueryOptions(); options.SeriesOptions.SeriesInstanceUID = seriesInstanceUID; var objectsFound = _query.Value.FindInstances(authenticationCookie, options, 1, true); if (objectsFound.Length > 0) { var objects = objectsFound.Where(o => o != null).ToArray(); if (objects.Length > 0) { sopInstanceUID = objects[0].SOPInstanceUID; } } } uid.SOPInstanceUID = sopInstanceUID; return(Task.Factory.StartNew <string>(() => _ret.Value.GetDicomJSON(uid))); }
public string GetRoleOption(string authenticationCookie, string role, string optionName) { string userName; userName = AuthHandler.Authorize(authenticationCookie, null); return(_optionsAddin.GetRoleOption(role, optionName)); }
public void SaveUserOption(string authenticationCookie, string optionName, string optionValue) { string userName; userName = AuthHandler.Authorize(authenticationCookie, null); _optionsAddin.SaveUserOption(userName, optionName, optionValue); }
public void SaveDefaultOptions(string authenticationCookie, Dictionary <string, string> options) { string userName; userName = AuthHandler.Authorize(authenticationCookie, null); _optionsAddin.SaveDefaultOptions(userName, options); SetExposedWebConfigOptions(options); }
private Stream GetPresentationAnnotationsStream(string authenticationCookie, string sopInstanceUID, string userData) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); Stream annStream = _ret.Value.GetPresentationAnnotations(sopInstanceUID, userData); return(annStream); }
public async Task <InstanceData[]> FindInstances(string authenticationCookie, RemoteConnection server, ClientConnection client, QueryOptions options) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanQueryPACS); var instances = await _query.FindInstances(RemoteConnectionFactory.Config(server as WadoConnection), options); return(instances); }
public void DeletePresentationState(string authenticationCookie, string sopInstanceUID, string userData) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanDeleteAnnotations); _addin.DeletePresentationState(sopInstanceUID, userData); }
public bool KeepAlive(string authenticationCookie, string id) { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery); _queryAddin.Value.KeepAlive(id /*stackInstanceUID*/); return(true); }
public string UploadDicomImage(string authenticationCookie, string dicomData, string status, string fileName) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanStoreAnnotations); return(((StoreAddin)_addin).UploadFile(userName, dicomData, status, fileName)); }
public bool UpdatePatient(string authenticationCookie, PatientInfo_Json info) { string userName; try { userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery); } catch (Exception ex) { throw ex; } QueryOptions queryOptions = new QueryOptions(); queryOptions.PatientsOptions = new PatientsQueryOptions(); queryOptions.PatientsOptions.PatientID = info.PatientId; PatientData[] patientData = _queryAddin.FindPatients(userName, queryOptions); if (patientData == null || patientData.Length == 0) { throw new Exception("PatientID does not exist: " + info.PatientId); // return false; } using (DicomDataSet ds = new DicomDataSet()) { ChangePatient c = new ChangePatient(); const string notUsed = "NotUsed"; c.OriginalPatientId = info.PatientId; c.PatientId = info.PatientId; c.Name = new PersonName(info.Name); c.Sex = info.Sex; c.PatientComments = info.Comments; c.EthnicGroup = info.EthnicGroup; if (info.BirthDate != null) { c.Birthdate = DateTime.Parse(info.BirthDate); } c.Description = notUsed; c.Reason = notUsed; c.Operator = notUsed; c.Station = notUsed; c.Date = DateTime.Now; c.Time = c.Date; c.TransactionID = notUsed; ds.Set(c); _storeAddin.UpdatePatient(ds); } return(true); }
public void GrantUserAccess(string authenticationCookie, UserPermissions userAccess) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight); _addin.GrantUserAccess(userAccess); }
public RolePermissions[] GetRolesAccess(string authenticationCookie, List <string> roles) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight); return(_addin.GetRolesAccess(roles)); }
public void DenyRoleAccess(string authenticationCookie, RolePermissions roleAccess) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight); _addin.DenyRoleAccess(roleAccess); }
public Task <Stream> ExportLayout(string authenticationCookie, string seriesInstanceUID, Layout layout, bool burnAnnotations, CompressionType compression, int width) { return(Task.Factory.StartNew <Stream>(() => { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport); var image = _exportAddin.ExportLayout(userName, seriesInstanceUID, layout, burnAnnotations, compression, width); return image; })); }
public PresentationStateData StoreAnnotations(string authenticationCookie, string seriesInstanceUID, string annotationData, string description, string userData) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanStoreAnnotations); return(_addin.StoreAnnotations(userName, seriesInstanceUID, annotationData, description, userData)); }
public Task <Stream> ExportInstances(string authenticationCookie, string[] instanceUIDs, ExportOptions options) { return(Task.Factory.StartNew <Stream>(() => { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport); var zip = _exportAddin.ExportInstances(userName, instanceUIDs, options); return zip; })); }
public void GrantRolePatients(string authenticationCookie, string role, List <string> patientIds) { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight); _addin.GrantRolePatients(role, patientIds); }
public Task <string> ExportSeries(string authenticationCookie, string[] seriesInstanceUIDs, ExportOptions options) { return(Task.Factory.StartNew(() => { var userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport); var zip = _exportAddin.ExportSeries(userName, seriesInstanceUIDs, options); return Save(authenticationCookie, "Series_", ".zip", zip); })); }
public StoreStatus_Json StoreImage(string authenticationCookie, int formatCode, string imageData, string userData) { try { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanStore); StoreImageFormatCode format = (StoreImageFormatCode)formatCode; // last resort. Should have already been removed by client side JS if (imageData.StartsWith("data")) { int indexOfComma = imageData.IndexOf(','); imageData = imageData.Substring(indexOfComma + 1); } StoreReturnCode ret; string message; switch (format) { case StoreImageFormatCode.DCM: { //DicomDataSet ds = createDatasetFromBase64String(imageData); //ds.Save(@"D:\Delete\Other_Temp\TestOut.dcm", DicomDataSetSaveFlags.None); ret = StoreReturnCode.Success; message = "Success"; } break; case StoreImageFormatCode.JPEG: { ret = StoreReturnCode.Failure; message = "JPEG Store not yet implemented"; } break; case StoreImageFormatCode.PNG: { ret = StoreReturnCode.Failure; message = "PNG store not yet implemented"; } break; default: throw new Exception("Invalid format specified"); } return(new StoreStatus_Json(ret, message)); } catch (ServiceAuthorizationException) { throw new ServiceAuthorizationException("Access denied, please login with different user to have this feature available."); } }
public Task <PatientData[]> FindPatients(string authenticationCookie, DataContracts.QueryOptions options, ExtraOptions extraOptions) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery); return(null); //this may be implemented as follows: //var config = RemoteConnectionFactory.Config(new WadoConnection() { dicomWebRoot = @"http://localhost/WadoService/api/", qido = "qido-rs" }); //var patients = await _query.FindPatients(config , options); //return patients; //MaxQueryResults(extraOptions) }
public Stream DownloadImage(string authenticationCookie, string sopInstanceUID, int frame, int bitsPerPixel, int qualityFactor, int width, int height, string annotationFileName, double xDpi, double yDpi, string userData) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); if (frame <= 0) { frame = 1; } if (qualityFactor < 2) { qualityFactor = 2; } // string dir = HostingEnvironment.ApplicationPhysicalPath; string dir = Path.GetTempPath(); if (null == dir) { dir = string.Empty; } string outDir = Path.Combine(dir, "Temp"); string filePath = null; string annotationData = null; if (!String.IsNullOrEmpty(annotationFileName)) { filePath = Path.Combine(outDir, annotationFileName); } if (filePath != null && File.Exists(filePath)) { XmlDocument doc = new XmlDocument(); doc.Load(filePath); annotationData = doc.InnerXml; File.Delete(filePath); } if (width == 0 && height == 0) { var captureSize = ConfigurationManager.AppSettings.Get("MaxCaptureSize"); if (!string.IsNullOrEmpty(captureSize)) { int.TryParse(captureSize, out width); int.TryParse(captureSize, out height); } } Stream stream = _ret.Value.DownloadImage(sopInstanceUID, frame, SupportedMimeTypes.JPG, bitsPerPixel, qualityFactor, width, height, annotationData, xDpi, yDpi, userData); return(stream); }
public int GetAudioGroupsCount(string authenticationCookie, string sopInstanceUID) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); try { return(_ret.Value.GetAudioGroupsCount(sopInstanceUID)); } catch { return(0); } }
public Task <Tuple <Stream, string> > GetImageTile(string authenticationCookie, string sopInstanceUID, int frame, int x, int y, int width, int height, int xResolution, int yResolution, Boolean wldata, string userData) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); return(Task.Factory.StartNew <Tuple <Stream, string> >(() => { LeadRect tile = LeadRect.Create(x, y, width, height); string mime; var stream = _ret.Value.GetImageTile(sopInstanceUID, frame, tile, xResolution, yResolution, wldata, userData, out mime); return new Tuple <Stream, string>(stream, mime); })); }
public string UploadAnnotations(string authenticationCookie, string data) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve); if (data == null) { return(null); } // Check if the temp folder exists // string dir = HostingEnvironment.ApplicationPhysicalPath; string dir = Path.GetTempPath(); if (null == dir) { dir = string.Empty; } string outDir = Path.Combine(dir, "Temp"); if (!Directory.Exists(outDir)) { Directory.CreateDirectory(outDir); } // Check if we have old files in the directory, delete them DateTime now = DateTime.Now; string[] files = Directory.GetFiles(outDir, "*.xml"); foreach (string file in files) { DateTime fileTime = File.GetCreationTime(file); if (fileTime > now.AddHours(24)) { // Delete it try { File.Delete(file); } catch { } } } // Create the new file string fileName = Guid.NewGuid().ToString().Replace("-", "") + ".xml"; string filePath = Path.Combine(outDir, fileName); File.WriteAllText(filePath, data); return(fileName); }
public void ClearCache(string authenticationCookie) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanDeleteCache); try { TimeStampProvider.RefreshTimeStamp(); if (null != _storage) { _storage.Value.RunCleanup(null); } } catch { } }
public bool AddPatient(string authenticationCookie, PatientInfo_Json patientInfo, string userData) { try { string userName; userName = AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanStore); StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.MimeType = SupportedMimeTypes.DICOM; DicomDataSet ds = new DicomDataSet(); ds.Initialize(DicomClassType.Patient, DicomDataSetInitializeFlags.AddMandatoryElementsOnly); // The 2014 specification has added ReferencedStudySequence to the Patient Module (Retired) as a mandatory element // Remove this element for adding the patient DicomElement element = ds.FindFirstElement(null, DicomTag.ReferencedStudySequence, true); if (element != null) { ds.DeleteElement(element); } SetPatientInfo(patientInfo, ds, DicomCharacterSetType.UnicodeInUtf8); MemoryStream ms = new MemoryStream(); ds.Save(ms, DicomDataSetSaveFlags.None); //TODO: Store Patient information (Need to determine how this will be handled in the DB. Same for the unapproved captured images) QueryOptions queryOptions = new QueryOptions(); queryOptions.PatientsOptions = new PatientsQueryOptions(); queryOptions.PatientsOptions.PatientID = patientInfo.PatientId; // If patientID already exists, return 'false' PatientData[] patientData = _queryAddin.FindPatients(userName, queryOptions); if (patientData.Length > 0) { return(false); } // Otherwise, add the patient _storeAddin.StoreItem(ms, storeItemInfo); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public UserPermissions[] GetUserAccess(string authenticationCookie, string user) { string userName; userName = AuthHandler.Authenticate(authenticationCookie); if (userName != user) { AuthHandler.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight); } return(_addin.GetUserAccess(user)); }