/// <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); }
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); }
public static IServiceCollection UseFellowOakDicom(this IServiceCollection services) => services.AddFellowOakDicom() .AddLogManager <DicomLogManager>() .AddTransient <IHostedService, DicomInitializationHelper>(provider => { DicomSetupBuilder.UseServiceProvider(provider); return(new DicomInitializationHelper()); }) ;
public void Initialize(ExtensionConfigContext context) => DicomSetupBuilder.UseServiceProvider(_serviceProvider);
public static IApplicationBuilder UseFellowOakDicom(this IApplicationBuilder app) { DicomSetupBuilder.UseServiceProvider(app.ApplicationServices); return(app); }