public string[] GetAllUsers(string authenticationCookie, string userData)
        {
            string authUserName;

            ServiceUtils.Authenticate(_addin, authenticationCookie, out authUserName, null);
            ServiceUtils.Authorize(_addin, authUserName, PermissionsTable.Instance.CanManageUsers, null);

            return(_addin.GetAllUsers(userData));
        }
Exemple #2
0
        public string ExportLayout(string authenticationCookie, string seriesInstanceUID, Layout layout, bool burnAnnotations, CompressionType compression, int width)
        {
            Stream image = null;

            var userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport);

            image = _exportAddin.ExportLayout(userName, seriesInstanceUID, layout, burnAnnotations, compression, width);
            return(SaveStream(image));
        }
Exemple #3
0
        public PresentationStateData StoreAnnotations(string authenticationCookie, string seriesInstanceUID, string annotationData, string description, string userData)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanStoreAnnotations);

            return(_addin.StoreAnnotations(userName, seriesInstanceUID, annotationData, description, userData));
        }
Exemple #4
0
        public string ExportAllSeries(string authenticationCookie, string patientID, ExportOptions options)
        {
            Stream zip;

            var userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport);

            zip = _exportAddin.ExportAllSeries(userName, patientID, options);
            return(SaveZip(patientID, zip));
        }
Exemple #5
0
        public string ExportInstances(string authenticationCookie, string[] instanceUIDs, ExportOptions options)
        {
            Stream zip;

            var userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanExport);

            zip = _exportAddin.ExportInstances(userName, instanceUIDs, options);
            return(SaveZip("Instances", zip));
        }
        public RolePermissions[] GetRolesAccess(string authenticationCookie, List <string> roles, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight);

            return(_addin.GetRolesAccess(roles));
        }
        public void GrantRolePatients(string authenticationCookie, string role, List <string> patientIds, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight);

            _addin.GrantRolePatients(role, patientIds);
        }
        public void GrantUserAccess(string authenticationCookie, UserPermissions userAccess, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight);

            _addin.GrantUserAccess(userAccess);
        }
        public WordResult[] AutoComplete(string authenticationCookie, string key, string term, string userData)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            return(_queryAddin.AutoComplete(userName, key, term, userData));
        }
        public HangingProtocolQueryResult[] FindHangingProtocols(string authenticationCookie, string studyInstanceUID, string userData)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            return(_queryAddin.FindHangingProtocols(userName, studyInstanceUID, userData));
        }
        public void DenyRoleAccess(string authenticationCookie, RolePermissions roleAccess, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight);

            _addin.DenyRoleAccess(roleAccess);
        }
        public bool HasPresentationState(string authenticationCookie, string seriesInstanceUID, string sopInstanceUID, string userData)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            return(_queryAddin.HasPresentationState(userName, seriesInstanceUID, sopInstanceUID, userData));
        }
        public void CreateUser(string authenticationCookie, string userName, string password, string userType)
        {
            string authUserName;

            ServiceUtils.Authenticate(_addin, authenticationCookie, out authUserName, null);
            ServiceUtils.Authorize(_addin, authUserName, PermissionsTable.Instance.CanManageUsers, null);

            _addin.CreateUser(authUserName, userName, password, userType, null);
        }
        public void DeleteUser(string authenticationCookie, string userName, string userData)
        {
            string authUserName;

            ServiceUtils.Authenticate(_addin, authenticationCookie, out authUserName, null);
            ServiceUtils.Authorize(_addin, authUserName, PermissionsTable.Instance.CanManageUsers, null);

            _addin.DeleteUser(authUserName, userName, userData);
        }
Exemple #15
0
        public StoreStatus_Json StoreImage(string authenticationCookie, int formatCode, string imageData, string userData)
        {
            try
            {
                string userName;

                userName = ServiceUtils.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 PresentationStateData[] FindPresentationState(string authenticationCookie, string referencedSeries, string userData)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            WebOperationContext.Current.OutgoingResponse.Headers.Add("Cache-Control", "must-revalidate, max-age=0");

            return(_queryAddin.FindPresentationState(userName, referencedSeries, userData));
        }
Exemple #17
0
        public string Create3DObject(string authenticationCookie, QueryOptions options, string id, int renderingType, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            int MaxQueryResults = 0;

            if (extraOptions != null && extraOptions.UserData != null)
            {
                MaxQueryResults = Convert.ToInt32(extraOptions.UserData);
            }

            bool   lightQuery       = extraOptions != null && extraOptions.UserData2 != null ? (extraOptions.UserData2 == "lightQuery") : false;
            bool   noSort           = extraOptions != null && extraOptions.UserData3 != null ? (extraOptions.UserData3 == "NoSort") : false;
            string stackInstanceUID = !lightQuery && extraOptions != null && extraOptions.UserData2 != null ? extraOptions.UserData2 : string.Empty;

            _queryAddin.Initialize3DObject(id);//embedded lock timeout

            var Enabled = LTCachingCtrl.CacheSettings.Enabled;
            var Storage = Path.Combine(LTCachingCtrl.CacheSettings.Storage, "Cache3D");

            Task.Factory.StartNew <string>(() =>
            {
                if (!_create3dSemaphore.WaitOne())
                {
                    return("Error waiting");
                }
                _queryAddin.LockTimeOut(id);
                try
                {
                    return(_queryAddin.Start3DObject(userName, options, Enabled, Storage, id, stackInstanceUID, renderingType));;
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    _queryAddin.UnlockTimeOut(id);
                    _create3dSemaphore.Release();
                }
            }, TaskCreationOptions.LongRunning
                                           ).ContinueWith((t) => { if (t.IsFaulted)
                                                                   {
                                                                       System.Diagnostics.Debug.WriteLine("lt: thread: " + t.Exception.Message);
                                                                   }
                                                          });

            _queryAddin.UnlockTimeOut(id);

            return("Success");
        }
        /// <summary>
        /// Gets the raw DICOM object as XML
        /// </summary>
        /// <param name="authenticationCookie">Cookie</param>
        /// <param name="uid">UIDs. Only SOPInstanceUID is used</param>
        /// <param name="options">Query options</param>
        /// <param name="extraOptions">Extra options</param>
        /// <returns>The DICOM as XML</returns>
        /// <remarks>
        /// <para>RoleName:CanRetrieve</para>
        /// </remarks>
        public XmlElement GetDicomXml(string authenticationCookie, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID, string userData)
        {
            ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve);

            ObjectUID uid = new ObjectUID();

            uid.StudyInstanceUID  = studyInstanceUID;
            uid.SeriesInstanceUID = seriesInstanceUID;
            uid.SOPInstanceUID    = sopInstanceUID;

            return(AddinsFactory.CreateObjectRetrieveAddin().GetDicomXml(uid));
        }
Exemple #19
0
        public Dictionary <string, string> GetUserOptions(string authenticationCookie)
        {
            if (string.IsNullOrEmpty(authenticationCookie))
            {
                return(new Dictionary <string, string>());
            }
            string userName;

            userName = ServiceUtils.Authorize(authenticationCookie, null);

            return(_optionsAddin.GetUserOptions(userName));
        }
        public Stream GetImageTile(string authenticationCookie, string sopInstanceUID, int frame, int x, int y, int width, int height, int xResolution, int yResolution, Boolean wldata, string userData)
        {
            ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve);

            LeadRect tile = LeadRect.Create(x, y, width, height);


            string mime;
            var    stream = AddinsFactory.CreateObjectRetrieveAddin().GetImageTile(sopInstanceUID, frame, tile, xResolution, yResolution, wldata, userData, out mime);

            WebOperationContext.Current.OutgoingResponse.ContentType = mime;
            return(stream);
        }
        public void DeleteImages(string authenticationCookie,
                                 string patientID,
                                 string studyInstanceUID,
                                 string seriesInstanceUID,
                                 string sopInstanceUID, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanDeleteImages);

            _addin.DeleteImages(userName, patientID, studyInstanceUID, seriesInstanceUID, sopInstanceUID);
        }
        public int GetAudioGroupsCount(string authenticationCookie, string sopInstanceUID)
        {
            ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve);

            try
            {
                return(AddinsFactory.CreateObjectRetrieveAddin().GetAudioGroupsCount(sopInstanceUID));
            }
            catch
            {
                return(0);
            }
        }
        public Stream GetAudio(string authenticationCookie, string sopInstanceUID, int groupIndex, string mimeType)
        {
            ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanRetrieve);

            if (string.IsNullOrEmpty(mimeType))
            {
                mimeType = SupportedMimeTypes.WAVE;
            }

            WebOperationContext.Current.OutgoingResponse.ContentType = mimeType;

            return(AddinsFactory.CreateObjectRetrieveAddin().GetAudio(sopInstanceUID, groupIndex, mimeType));
        }
Exemple #24
0
        public bool AddPatient(string authenticationCookie, PatientInfo_Json patientInfo, string userData)
        {
            try
            {
                string userName;

                userName = ServiceUtils.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, ExtraOptions extraOptions)
        {
            string userName;


            userName = ServiceUtils.Authenticate(authenticationCookie);

            if (userName != user)
            {
                ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanManageAccessRight);
            }

            return(_addin.GetUserAccess(user));
        }
 public void ClearCache(string authenticationCookie)
 {
     try
     {
         ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanDeleteCache);
         AddinsFactory.RefreshTimeStamp();
         var storage = AddinsFactory.CacheDiskStorage;
         if (null != storage)
         {
             storage.RunCleanup(null);
         }
     }
     catch { }
 }
        public PatientData[] FindPatients(string authenticationCookie, DataContracts.QueryOptions options, DataContracts.ExtraOptions extraOptions)
        {
            string userName;

            userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanQuery);

            int MaxQueryResults = 0;

            if (extraOptions != null && extraOptions.UserData != null)
            {
                MaxQueryResults = Convert.ToInt32(extraOptions.UserData);
            }
            return(_queryAddin.FindPatients(userName, options, MaxQueryResults));
        }
Exemple #28
0
        public void DeleteStudyLayout(string authenticationCookie, string studyInstanceUID, string userData)
        {
            string userName;

            try
            {
                userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanDeleteImages);
            }
            catch (ServiceAuthorizationException)
            {
                throw new ServiceAuthorizationException("Access denied, please login with different user to have this feature available.");
            }

            _addin.DeleteStudyLayout(studyInstanceUID, userData);
        }
Exemple #29
0
        public void StoreHangingProtocol(string authenticationCookie, WCFHangingProtocol hangingProtocol, string userData)
        {
            string userName;

            try
            {
                userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanSaveHangingProtocol);
            }
            catch (ServiceAuthorizationException)
            {
                throw new ServiceAuthorizationException("Access denied, please login with different user to have this feature available.");
            }

            _addin.StoreHangingProtocol(userName, hangingProtocol, userData);
        }
Exemple #30
0
        public SeriesData StoreSecondaryCapture(string authenticationCookie, string EncodedCapture, string OriginalSOPInstance, string SeriesNumber, string SeriesDescription, string ProtocolName)
        {
            try
            {
                string userName;

                userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanStore);

                return(_addin.StoreSecondaryCapture(userName, EncodedCapture, OriginalSOPInstance, SeriesNumber, SeriesDescription, ProtocolName));
            }
            catch (ServiceAuthorizationException)
            {
                throw new ServiceAuthorizationException("Access denied, please login with different user to have this feature available.");
            }
        }