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;
}
}