protected override IPresentationImage CreateImage(Frame frame) { if (frame.PhotometricInterpretation == PhotometricInterpretation.Unknown) { throw new Exception("Photometric interpretation is unknown."); } IDicomPresentationImage image; // TODO (CR Apr 2013): Since it's the "async" factory, it probably should only deal in AsyncFrames. Just throw NotSupportedException? if (!frame.PhotometricInterpretation.IsColor) { image = frame is AsyncFrame ? new AsyncDicomGrayscalePresentationImage((AsyncFrame)frame) : new DicomGrayscalePresentationImage(frame); } else { image = new DicomColorPresentationImage(frame); } if (image.PresentationState == null || Equals(image.PresentationState, PresentationState.DicomDefault)) { image.PresentationState = DefaultPresentationState; } return(image); }
protected override IPresentationImage CreateImage(Frame frame) { if (frame.PhotometricInterpretation == PhotometricInterpretation.Unknown) throw new Exception("Photometric interpretation is unknown."); IDicomPresentationImage image; // TODO (CR Apr 2013): Since it's the "async" factory, it probably should only deal in AsyncFrames. Just throw NotSupportedException? if (!frame.PhotometricInterpretation.IsColor) image = frame is AsyncFrame ? new AsyncDicomGrayscalePresentationImage((AsyncFrame) frame) : new DicomGrayscalePresentationImage(frame); else image = new DicomColorPresentationImage(frame); if (image.PresentationState == null || Equals(image.PresentationState, PresentationState.DicomDefault)) image.PresentationState = DefaultPresentationState; return image; }