ClearCanvas.ImageViewer.RoiGraphics.Roi.Roi C# (CSharp) Method

Roi() protected method

Constructs a new region of interest, specifying an IPresentationImage as the source of the pixel data.
protected Roi ( IPresentationImage presentationImage ) : System
presentationImage IPresentationImage The image containing the source pixel data.
return System
		protected Roi(IPresentationImage presentationImage)
		{
			_presentationImage = presentationImage;

			IImageGraphicProvider provider = presentationImage as IImageGraphicProvider;
			if (provider != null)
			{
				_imageRows = provider.ImageGraphic.Rows;
				_imageColumns = provider.ImageGraphic.Columns;
				_pixelData = provider.ImageGraphic.PixelData;
			}

			var modalityLutProvider = presentationImage as IModalityLutProvider;
			if (modalityLutProvider != null)
				_modalityLut = (modalityLutProvider).ModalityLut;

			if (presentationImage is IImageSopProvider)
			{
				Frame frame = ((IImageSopProvider) presentationImage).Frame;
				_normalizedPixelSpacing = frame.NormalizedPixelSpacing;
				_pixelAspectRatio = frame.PixelAspectRatio;
				_modality = frame.ParentImageSop.Modality;
				_modalityLutUnits = frame.RescaleUnits;
				_subnormalModalityLut = frame.IsSubnormalRescale;
			}
			else
			{
				_normalizedPixelSpacing = new PixelSpacing(0, 0);
				_pixelAspectRatio = new PixelAspectRatio(0, 0);
				_modalityLutUnits = RescaleUnits.None;
				_subnormalModalityLut = false;
			}
		}