public void Apply(IPresentationImage image) { IImageSpatialTransform transform = (IImageSpatialTransform)_operation.GetOriginator(image); IImageSpatialTransform referenceTransform = (IImageSpatialTransform)this.SelectedSpatialTransformProvider.SpatialTransform; transform.Scale = referenceTransform.Scale; transform.ScaleToFit = referenceTransform.ScaleToFit; if (GetCheckedSync() == false) { return; } // IVoiLutLinear selectedLut = (IVoiLutLinear)this.SelectedVoiLutProvider.VoiLutManager.VoiLut; IVoiLutProvider provider = ((IVoiLutProvider)image); if (!(provider.VoiLutManager.VoiLut is IBasicVoiLutLinear)) { BasicVoiLutLinear installLut = new BasicVoiLutLinear(selectedLut.WindowWidth, selectedLut.WindowCenter); provider.VoiLutManager.InstallVoiLut(installLut); } IBasicVoiLutLinear lut = (IBasicVoiLutLinear)provider.VoiLutManager.VoiLut; lut.WindowWidth = selectedLut.WindowWidth; lut.WindowCenter = selectedLut.WindowCenter; // transform.TranslationX = this.SelectedSpatialTransformProvider.SpatialTransform.TranslationX; transform.TranslationY = this.SelectedSpatialTransformProvider.SpatialTransform.TranslationY; }
private void Apply(IPresentationImage image) { IVoiLutLinear selectedLut = (IVoiLutLinear)SelectedVoiLutProvider.VoiLutManager.VoiLut; IVoiLutProvider provider = ((IVoiLutProvider)image); if (!(provider.VoiLutManager.VoiLut is IBasicVoiLutLinear)) { BasicVoiLutLinear installLut = new BasicVoiLutLinear(selectedLut.WindowWidth, selectedLut.WindowCenter); provider.VoiLutManager.InstallVoiLut(installLut); } IBasicVoiLutLinear lut = (IBasicVoiLutLinear)provider.VoiLutManager.VoiLut; lut.WindowWidth = selectedLut.WindowWidth; lut.WindowCenter = selectedLut.WindowCenter; }
public void Apply(IPresentationImage image) { if (image == ReferenceImage) { return; } //Turn off scale to fit and start with scale=1, then adjust it. //We do this because images that have been "scaled to fit", but have not been shown yet, //have no client rectangle and their scale is often very small. This is safer //and could produce a more accurate result. IImageSpatialTransform matchTransform = GetImageTransform(image); matchTransform.ScaleToFit = false; matchTransform.Scale = 1; //get the displayed width (in mm) for the same size display rectangle in the image to be matched. float matchDisplayedWidth = GetDisplayedWidth(image, _referenceDisplayRectangle); float rescaleAmount = matchDisplayedWidth / _referenceDisplayedWidth; matchTransform.Scale *= rescaleAmount; //ISpatialTransform transform = (ISpatialTransform)_operation.GetOriginator(image); matchTransform.TranslationX = this.SelectedSpatialTransformProvider.SpatialTransform.TranslationX; matchTransform.TranslationY = this.SelectedSpatialTransformProvider.SpatialTransform.TranslationY; IVoiLutLinear selectedLut = (IVoiLutLinear)this.SelectedVoiLutProvider.VoiLutManager.VoiLut; IVoiLutProvider provider = ((IVoiLutProvider)image); if (!(provider.VoiLutManager.VoiLut is IBasicVoiLutLinear)) { BasicVoiLutLinear installLut = new BasicVoiLutLinear(selectedLut.WindowWidth, selectedLut.WindowCenter); provider.VoiLutManager.InstallVoiLut(installLut); } IBasicVoiLutLinear lut = (IBasicVoiLutLinear)provider.VoiLutManager.VoiLut; lut.WindowWidth = selectedLut.WindowWidth; lut.WindowCenter = selectedLut.WindowCenter; }
private static Bitmap DrawLutFrame(Frame f, double ww, double wc) { IPresentationImage pres = PresentationImageFactory.Create(f); IVoiLutProvider provider = ((IVoiLutProvider)pres); IVoiLutManager manager = provider.VoiLutManager; var linearLut = manager.VoiLut as IVoiLutLinear; if (linearLut != null) { var standardLut = linearLut as IBasicVoiLutLinear; if (standardLut == null) { var installLut = new BasicVoiLutLinear(ww, wc); manager.InstallVoiLut(installLut); } else { standardLut.WindowWidth = ww; standardLut.WindowCenter = wc; } provider.Draw(); } try { var bmp = pres.DrawToBitmap(f.Columns, f.Rows); if (f.Columns == f.Rows) { if (f.Columns < 512) { bmp = ResizeBitmap(bmp, 512, 512); } } return(bmp); } catch { return(null); } }
public override string GetAnnotationText(IPresentationImage presentationImage) { if (presentationImage == null) { return(String.Empty); } IVoiLutProvider image = presentationImage as IVoiLutProvider; if (image == null || !image.VoiLutManager.Enabled) { return(String.Empty); } IVoiLut voiLut = image.VoiLutManager.VoiLut; if (voiLut == null) { return(String.Empty); } return(voiLut.GetDescription()); }