/// <summary>
        /// Adds DICOM server functionality to the pipeline.
        /// </summary>
        /// <param name="app">The application builder instance.</param>
        /// <returns>The application builder.</returns>
        public static IApplicationBuilder UseDicomServer(this IApplicationBuilder app)
        {
            EnsureArg.IsNotNull(app, nameof(app));

            app.UseQueryStringValidator();

            app.UseMvc();

            app.UseHealthChecksExtension(new PathString(KnownRoutes.HealthCheck));

            // Update Fellow Oak DICOM services to use ASP.NET Core's service container
            DicomSetupBuilder.UseServiceProvider(app.ApplicationServices);

            IOptions <FeatureConfiguration> featureConfiguration = app.ApplicationServices.GetRequiredService <IOptions <FeatureConfiguration> >();

            if (featureConfiguration.Value.EnableOhifViewer)
            {
                // In order to make OHIF viewer work with direct link to studies, we need to rewrite any path under viewer
                // back to the index page so the viewer can display accordingly.
                RewriteOptions rewriteOptions = new RewriteOptions()
                                                .AddRewrite("^viewer/(.*?)", OhifViewerIndexPagePath, true);

                app.UseRewriter(rewriteOptions);

                var options = new DefaultFilesOptions();

                options.DefaultFileNames.Clear();
                options.DefaultFileNames.Add(OhifViewerIndexPagePath);

                app.UseDefaultFiles(options);
                app.UseStaticFiles();
            }

            return(app);
        }
コード例 #2
0
        public GlobalFixture()
        {
            var serviceCollection = new ServiceCollection()
                                    .AddFellowOakDicom();

            var defaultServiceProvider = serviceCollection.BuildServiceProvider();
            var serviceProviders       = new TestServiceProviderHost(defaultServiceProvider);

            serviceCollection = new ServiceCollection()
                                .AddFellowOakDicom()
                                .AddLogManager <CollectingConsoleLogManager>();

            var collectionLogServiceProvider = serviceCollection.BuildServiceProvider();

            serviceProviders.Register("Logging", collectionLogServiceProvider);

#if !NET462
            serviceCollection = new ServiceCollection()
                                .AddFellowOakDicom()
                                .AddTranscoderManager <NativeTranscoderManager>()
                                .AddImageManager <ImageSharpImageManager>();

            var imageSharpServiceProvider = serviceCollection.BuildServiceProvider();
            serviceProviders.Register("ImageSharp", imageSharpServiceProvider);

            serviceCollection = new ServiceCollection()
                                .AddFellowOakDicom()
                                .AddTranscoderManager <NativeTranscoderManager>();
            var noTranscoderServiceProvider = serviceCollection.BuildServiceProvider();
            serviceProviders.Register("WithTranscoder", noTranscoderServiceProvider);
#endif

            DicomSetupBuilder.UseServiceProvider(serviceProviders);
        }
コード例 #3
0
 public static IServiceCollection UseFellowOakDicom(this IServiceCollection services)
 => services.AddFellowOakDicom()
 .AddLogManager <DicomLogManager>()
 .AddTransient <IHostedService, DicomInitializationHelper>(provider => {
     DicomSetupBuilder.UseServiceProvider(provider);
     return(new DicomInitializationHelper());
 })
 ;
コード例 #4
0
 public void Initialize(ExtensionConfigContext context)
 => DicomSetupBuilder.UseServiceProvider(_serviceProvider);
コード例 #5
0
 public static IApplicationBuilder UseFellowOakDicom(this IApplicationBuilder app)
 {
     DicomSetupBuilder.UseServiceProvider(app.ApplicationServices);
     return(app);
 }