/// <summary>
        /// Creates a fresh copy of the <see cref="DicomGrayscalePresentationImage"/>.
        /// </summary>
        /// <remarks>
        /// This will instantiate a fresh copy of this <see cref="DicomGrayscalePresentationImage"/>
        /// using the same construction parameters as the original.
        /// </remarks>
        /// <returns></returns>
        public override IPresentationImage CreateFreshCopy()
        {
            DicomGrayscalePresentationImage image = new DicomGrayscalePresentationImage(Frame);

            image.PresentationState = this.PresentationState;
            return(image);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the presentation image for a given image frame.
        /// </summary>
        /// <param name="frame">The image frame from which a presentation image is to be created.</param>
        /// <returns>The created presentation image.</returns>
        protected virtual IPresentationImage CreateImage(Frame frame)
        {
            if (frame.PhotometricInterpretation == PhotometricInterpretation.Unknown)
            {
                throw new Exception("Photometric interpretation is unknown.");
            }

            IDicomPresentationImage image;

            if (!frame.PhotometricInterpretation.IsColor)
            {
                image = new DicomGrayscalePresentationImage(frame);
            }
            else
            {
                image = new DicomColorPresentationImage(frame);
            }

            if (image.PresentationState == null || Equals(image.PresentationState, PresentationState.DicomDefault))
            {
                image.PresentationState = DefaultPresentationState;
            }

            return(image);
        }
        /// <summary>
        /// Cloning constructor.
        /// </summary>
        protected DicomGrayscalePresentationImage(DicomGrayscalePresentationImage source, ICloningContext context)
            : base(source, context)
        {
            Frame frame = source.Frame;

            _frameReference = frame.CreateTransientReference();
            _dicomVoiLuts   = new DicomVoiLuts(this);
        }