public WADOResponse Process(WADORequestTypeHandlerContext context) { Platform.CheckForNullReference(context, "httpContext"); Platform.CheckForNullReference(context.ServerAE, "context.ServerAE"); Platform.CheckForNullReference(context.HttpContext, "context.HttpContext"); // Cache the query string for performance purpose. Every time Request.QueryString is called, .NET will rebuild the entire dictionary. NameValueCollection query = context.HttpContext.Request.QueryString; ServerPartition partition = ServerPartitionMonitor.Instance.GetPartition(context.ServerAE); if (partition == null) { throw new WADOException(HttpStatusCode.NotFound, String.Format(SR.FaultPartitionNotExists, context.ServerAE)); } if (!partition.Enabled) { throw new WADOException(HttpStatusCode.Forbidden, String.Format(SR.FaultPartitionDisabled, context.ServerAE)); } ImageStreamingContext streamingContext = new ImageStreamingContext(context.HttpContext); streamingContext.ServerAE = context.ServerAE; streamingContext.ContentType = query["ContentType"]; streamingContext.AcceptTypes = context.HttpContext.Request.AcceptTypes; streamingContext.StudyInstanceUid = query["studyuid"]; streamingContext.SeriesInstanceUid = query["seriesuid"]; streamingContext.ObjectUid = query["objectuid"]; string sessionId = context.HttpContext.Request.RemoteEndPoint.Address.ToString(); StudyStorageLoader storageLoader = new StudyStorageLoader(sessionId); storageLoader.CacheEnabled = ImageStreamingServerSettings.Default.EnableCache; storageLoader.CacheRetentionTime = ImageStreamingServerSettings.Default.CacheRetentionWindow; streamingContext.StorageLocation = storageLoader.Find(streamingContext.StudyInstanceUid, partition); // convert the dicom image into the appropriate mime type WADOResponse response = new WADOResponse(); IImageMimeTypeProcessor processor = GetMimeTypeProcessor(streamingContext); MimeTypeProcessorOutput output = processor.Process(streamingContext); response.Output = output.Output; response.ContentType = output.ContentType; response.IsLast = output.IsLast; return(response); }
public WADOResponse Process(WADORequestTypeHandlerContext context) { Platform.CheckForNullReference(context, "httpContext"); Platform.CheckForNullReference(context.ServerAE, "context.ServerAE"); Platform.CheckForNullReference(context.HttpContext, "context.HttpContext"); // Cache the query string for performance purpose. Every time Request.QueryString is called, .NET will rebuild the entire dictionary. NameValueCollection query = context.HttpContext.Request.QueryString; ServerPartition partition = ServerPartitionMonitor.Instance.GetPartition(context.ServerAE); if (partition== null) throw new WADOException(HttpStatusCode.NotFound, String.Format(SR.FaultPartitionNotExists, context.ServerAE)); if (!partition.Enabled) throw new WADOException(HttpStatusCode.Forbidden, String.Format(SR.FaultPartitionDisabled, context.ServerAE)); ImageStreamingContext streamingContext = new ImageStreamingContext(context.HttpContext); streamingContext.ServerAE = context.ServerAE; streamingContext.ContentType = query["ContentType"]; streamingContext.AcceptTypes = context.HttpContext.Request.AcceptTypes; streamingContext.StudyInstanceUid = query["studyuid"]; streamingContext.SeriesInstanceUid = query["seriesuid"]; streamingContext.ObjectUid = query["objectuid"]; string sessionId = context.HttpContext.Request.RemoteEndPoint.Address.ToString(); StudyStorageLoader storageLoader = new StudyStorageLoader(sessionId); storageLoader.CacheEnabled = ImageStreamingServerSettings.Default.EnableCache; storageLoader.CacheRetentionTime = ImageStreamingServerSettings.Default.CacheRetentionWindow; streamingContext.StorageLocation = storageLoader.Find(streamingContext.StudyInstanceUid, partition); // convert the dicom image into the appropriate mime type WADOResponse response = new WADOResponse(); IImageMimeTypeProcessor processor = GetMimeTypeProcessor(streamingContext); MimeTypeProcessorOutput output = processor.Process(streamingContext); response.Output = output.Output; response.ContentType = output.ContentType; response.IsLast = output.IsLast; return response; }
public HeaderLoader(HeaderStreamingContext context) { _studyInstanceUid = context.Parameters.StudyInstanceUID; _partitionAE = context.Parameters.ServerAETitle; _statistics.FindStudyFolder.Start(); string sessionId = context.CallerAE; ServerPartition partition = ServerPartitionMonitor.Instance.GetPartition(_partitionAE); StudyStorageLoader storageLoader = new StudyStorageLoader(sessionId); storageLoader.CacheEnabled = ImageStreamingServerSettings.Default.EnableCache; storageLoader.CacheRetentionTime = ImageStreamingServerSettings.Default.CacheRetentionWindow; StudyLocation = storageLoader.Find(_studyInstanceUid, partition); if (StudyLocation != null && StudyLocation.QueueStudyStateEnum != QueueStudyStateEnum.Idle) { Platform.Log(LogLevel.Warn, "Accessing to study {0} while its current state is {1}", StudyLocation.StudyInstanceUid, StudyLocation.QueueStudyStateEnum); } _statistics.FindStudyFolder.End(); }