Пример #1
0
        /// <summary>
        /// Loads a study using the specified parameters.
        /// </summary>
        /// <remarks>After this method is executed, the image viewer's <see cref="StudyTree"/>
        /// will be populated with the appropriate <see cref="Study"/>, <see cref="Series"/>
        /// and <see cref="Sop"/> objects.
        ///
        /// By default, the Framework provides an implementation of
        /// <see cref="IStudyLoader"/> called <b>LocalStoreStudyLoader</b> which loads
        /// studies from the local database.  If you have implemented your own
        /// <see cref="IStudyLoader"/> and want to load a study using that implementation,
        /// just pass in the name provided by <see cref="IStudyLoader.Name"/> as the source.
        /// </remarks>
        /// <param name="loadStudyArgs">A <see cref="LoadStudyArgs"/> object containing information about the study to be loaded.</param>
        /// <exception cref="InUseLoadStudyException">The specified study is in use and cannot be opened at this time.</exception>
        /// <exception cref="NearlineLoadStudyException">The specified study is nearline and cannot be opened at this time.</exception>
        /// <exception cref="OfflineLoadStudyException">The specified study is offline and cannot be opened at this time.</exception>
        /// <exception cref="NotFoundLoadStudyException">The specified study could not be found.</exception>
        /// <exception cref="LoadStudyException">One or more images could not be opened, or an unspecified error has occurred.</exception>
        /// <exception cref="StudyLoaderNotFoundException">The specified <see cref="IStudyLoader"/> could not be found.</exception>
        public void LoadStudy(LoadStudyArgs loadStudyArgs)
        {
            SynchronizationContext context = _uiThreadSynchronizationContext ?? SynchronizationContext.Current;

            using (SingleStudyLoader loader = new SingleStudyLoader(context, this, loadStudyArgs))
            {
                loader.LoadStudy();
                if (loader.Error != null)
                {
                    throw loader.Error;
                }
            }
        }
Пример #2
0
            private void FindAndAddPriors()
            {
                try
                {
                    var result = _priorStudyFinder.FindPriorStudies();
                    if (result == null)
                    {
                        return;
                    }

                    _findResultsComplete = result.ResultsComplete;
                    _queryResults        = result.Studies;
                    if (_queryResults.Count == 0)
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    _queryResults        = new StudyItemList();
                    _findFailed          = true;
                    _findResultsComplete = false;
                    Platform.Log(LogLevel.Error, e, "The search for prior studies has failed.");
                    return;
                }

                foreach (StudyItem result in _queryResults)
                {
                    if (_stop)
                    {
                        break;
                    }

                    var loader = new SingleStudyLoader(_synchronizationContext, _imageViewer, result)
                    {
                        LoadOnlineOnly = true
                    };

                    _singleStudyLoaders.Add(loader);
                    loader.LoadStudy();
                }
            }