示例#1
0
        /// <summary>
        /// Constructs a new user-created <see cref="OverlayPlaneGraphic"/> with the specified dimensions.
        /// </summary>
        /// <param name="rows">The number of rows in the overlay.</param>
        /// <param name="columns">The number of columns in the overlay.</param>
        protected OverlayPlaneGraphic(int rows, int columns)
        {
            Platform.CheckPositive(rows, "rows");
            Platform.CheckPositive(columns, "columns");

            _index          = -1;
            _frameIndex     = 0;
            _label          = string.Empty;
            _description    = string.Empty;
            _type           = OverlayType.G;
            _subtype        = null;
            _source         = OverlayPlaneSource.User;
            _overlayGraphic = new GrayscaleImageGraphic(
                rows, columns,                                  // the reported overlay dimensions
                8,                                              // bits allocated is always 8
                8,                                              // overlays always have bit depth of 1, but we upconverted the data
                7,                                              // the high bit is now 7 after upconverting
                false, false,                                   // overlays aren't signed and don't get inverted
                1, 0,                                           // overlays have no rescale
                MemoryManager.Allocate <byte>(rows * columns)); // new empty pixel buffer

            this.Color = System.Drawing.Color.PeachPuff;
            base.Graphics.Add(_overlayGraphic);
        }
示例#2
0
        /// <summary>
        /// Constructs an <see cref="OverlayPlaneGraphic"/> for a single or multi-frame overlay plane using a pre-processed overlay pixel data buffer.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The <paramref name="overlayPixelData"/> parameter allows for the specification of an alternate source of overlay pixel data, such
        /// as the unpacked contents of <see cref="DicomTags.OverlayData"/> or the extracted, inflated overlay pixels of <see cref="DicomTags.PixelData"/>.
        /// Although the format should be 8-bits per pixel, every pixel should either be 0 or 255. This will allow pixel interpolation algorithms
        /// sufficient range to produce a pleasant image. (If the data was either 0 or 1, regardless of the bit-depth, most interpolation algorithms
        /// will interpolate 0s for everything in between!)
        /// </para>
        /// </remarks>
        /// <param name="overlayPlaneIod">The IOD object containing properties of the overlay plane.</param>
        /// <param name="overlayPixelData">The overlay pixel data in 8-bits per pixel format, with each pixel being either 0 or 255.</param>
        /// <param name="frameIndex">The overlay frame index (0-based). Single-frame overlays should specify 0.</param>
        /// <param name="source">A value identifying the source of the overlay plane.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="overlayPixelData"/> is NULL or 0-length.</exception>
        public OverlayPlaneGraphic(OverlayPlane overlayPlaneIod, byte[] overlayPixelData, int frameIndex, OverlayPlaneSource source)
        {
            Platform.CheckNonNegative(frameIndex, "frameIndex");
            _frameIndex  = frameIndex;
            _index       = overlayPlaneIod.Index;
            _label       = overlayPlaneIod.OverlayLabel;
            _description = overlayPlaneIod.OverlayDescription;
            _type        = overlayPlaneIod.OverlayType;
            _subtype     = (OverlayPlaneSubtype)overlayPlaneIod.OverlaySubtype;
            _source      = source;

            GrayscaleImageGraphic overlayImageGraphic = CreateOverlayImageGraphic(overlayPlaneIod, overlayPixelData);

            if (overlayImageGraphic != null)
            {
                _overlayGraphic = overlayImageGraphic;
                this.Color      = System.Drawing.Color.PeachPuff;
                base.Graphics.Add(overlayImageGraphic);
            }

            if (string.IsNullOrEmpty(overlayPlaneIod.OverlayLabel))
            {
                if (overlayPlaneIod.IsMultiFrame)
                {
                    base.Name = string.Format(SR.FormatDefaultMultiFrameOverlayGraphicName, _source, _index, frameIndex);
                }
                else
                {
                    base.Name = string.Format(SR.FormatDefaultSingleFrameOverlayGraphicName, _source, _index, frameIndex);
                }
            }
            else
            {
                base.Name = overlayPlaneIod.OverlayLabel;
            }
        }
示例#3
0
		/// <summary>
		/// Constructs an <see cref="OverlayPlaneGraphic"/> for a single or multi-frame overlay plane using a pre-processed overlay pixel data buffer.
		/// </summary>
		/// <remarks>
		/// <para>
		/// The <paramref name="overlayPixelData"/> parameter allows for the specification of an alternate source of overlay pixel data, such
		/// as the unpacked contents of <see cref="DicomTags.OverlayData"/> or the extracted, inflated overlay pixels of <see cref="DicomTags.PixelData"/>.
		/// Although the format should be 8-bits per pixel, every pixel should either be 0 or 255. This will allow pixel interpolation algorithms
		/// sufficient range to produce a pleasant image. (If the data was either 0 or 1, regardless of the bit-depth, most interpolation algorithms
		/// will interpolate 0s for everything in between!)
		/// </para>
		/// </remarks>
		/// <param name="overlayPlaneIod">The IOD object containing properties of the overlay plane.</param>
		/// <param name="overlayPixelData">The overlay pixel data in 8-bits per pixel format, with each pixel being either 0 or 255.</param>
		/// <param name="frameIndex">The overlay frame index (0-based). Single-frame overlays should specify 0.</param>
		/// <param name="source">A value identifying the source of the overlay plane.</param>
		/// <exception cref="ArgumentNullException">Thrown if <paramref name="overlayPixelData"/> is NULL or 0-length.</exception>
		public OverlayPlaneGraphic(OverlayPlane overlayPlaneIod, byte[] overlayPixelData, int frameIndex, OverlayPlaneSource source)
		{
			Platform.CheckNonNegative(frameIndex, "frameIndex");
			_frameIndex = frameIndex;
			_index = overlayPlaneIod.Index;
			_label = overlayPlaneIod.OverlayLabel;
			_description = overlayPlaneIod.OverlayDescription;
			_type = overlayPlaneIod.OverlayType;
			_subtype = (OverlayPlaneSubtype) overlayPlaneIod.OverlaySubtype;
			_source = source;

			GrayscaleImageGraphic overlayImageGraphic = CreateOverlayImageGraphic(overlayPlaneIod, overlayPixelData);
			if (overlayImageGraphic != null)
			{
				_overlayGraphic = overlayImageGraphic;
				this.Color = System.Drawing.Color.PeachPuff;
				base.Graphics.Add(overlayImageGraphic);
			}

			if (string.IsNullOrEmpty(overlayPlaneIod.OverlayLabel))
			{
				if (overlayPlaneIod.IsMultiFrame)
					base.Name = string.Format(SR.FormatDefaultMultiFrameOverlayGraphicName, _source, _index, frameIndex);
				else
					base.Name = string.Format(SR.FormatDefaultSingleFrameOverlayGraphicName, _source, _index, frameIndex);
			}
			else
			{
				base.Name = overlayPlaneIod.OverlayLabel;
			}
		}
示例#4
0
		/// <summary>
		/// Constructs a new user-created <see cref="OverlayPlaneGraphic"/> with the specified dimensions.
		/// </summary>
		/// <param name="rows">The number of rows in the overlay.</param>
		/// <param name="columns">The number of columns in the overlay.</param>
		protected OverlayPlaneGraphic(int rows, int columns)
		{
			Platform.CheckPositive(rows, "rows");
			Platform.CheckPositive(columns, "columns");

			_index = -1;
			_frameIndex = 0;
			_label = string.Empty;
			_description = string.Empty;
			_type = OverlayType.G;
			_subtype = null;
			_source = OverlayPlaneSource.User;
			_overlayGraphic = new GrayscaleImageGraphic(
				rows, columns, // the reported overlay dimensions
				8, // bits allocated is always 8
				8, // overlays always have bit depth of 1, but we upconverted the data
				7, // the high bit is now 7 after upconverting
				false, false, // overlays aren't signed and don't get inverted
				1, 0, // overlays have no rescale
				MemoryManager.Allocate<byte>(rows*columns)); // new empty pixel buffer

			this.Color = System.Drawing.Color.PeachPuff;
			base.Graphics.Add(_overlayGraphic);
		}