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; }
public override bool Track(IMouseInformation mouseInformation) { base.Track(mouseInformation); IVoiLutManager manager = SelectedVoiLutProvider.VoiLutManager; IVoiLutLinear linearLut = manager.VoiLut as IVoiLutLinear; IBasicVoiLutLinear standardLut = linearLut as IBasicVoiLutLinear; if (standardLut == null) { BasicVoiLutLinear installLut = new BasicVoiLutLinear(linearLut.WindowWidth, linearLut.WindowCenter); manager.InstallVoiLut(installLut); } standardLut = manager.VoiLut as IBasicVoiLutLinear; double sensitivity = CurrentSensitivity; if ((Math.Abs(standardLut.WindowCenter) + Math.Abs(standardLut.WindowWidth)) < 1000) { sensitivity = 1.0; } IncrementWindow(DeltaX * sensitivity, DeltaY * sensitivity); return(true); }
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; }
protected void SerializeSoftcopyVoiLut(SoftcopyVoiLutModuleIod module, DicomPresentationImageCollection <T> images) { List <SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem> voiLutSequenceItems = new List <SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem>(); foreach (T image in images) { if (!image.VoiLutManager.Enabled) { continue; } SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem sequenceItem = new SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem(); sequenceItem.InitializeAttributes(); sequenceItem.ReferencedImageSequence = new ImageSopInstanceReferenceMacro[] { CreateImageSopInstanceReference(image.Frame) }; IVoiLut lut = image.VoiLutManager.VoiLut; if (lut is IDataLut) { IDataLut voiLut = (IDataLut)lut; sequenceItem.VoiLutSequence = new VoiLutSequenceItem[] { SerializeDataLut(voiLut) }; } else if (lut is IVoiLutLinear) { IVoiLutLinear voiLut = (IVoiLutLinear)lut; sequenceItem.WindowWidth = new double[] { voiLut.WindowWidth }; sequenceItem.WindowCenter = new double[] { voiLut.WindowCenter }; sequenceItem.WindowCenterWidthExplanation = new string[] { SR.LabelPresentationVoiLinearLut }; sequenceItem.VoiLutFunction = VoiLutFunction.Linear; // we don't support sigmoid } else { // should never happen - all VOI LUT object should implement either interface continue; } voiLutSequenceItems.Add(sequenceItem); } if (voiLutSequenceItems.Count > 0) { module.SoftcopyVoiLutSequence = voiLutSequenceItems.ToArray(); } }
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 void IncrementWindow(double windowIncrement, double levelIncrement) { if (!CanWindowLevel()) { return; } IVoiLutManager manager = SelectedVoiLutProvider.VoiLutManager; IVoiLutLinear linearLut = manager.VoiLut as IVoiLutLinear; IBasicVoiLutLinear standardLut = linearLut as IBasicVoiLutLinear; if (standardLut == null) { BasicVoiLutLinear installLut = new BasicVoiLutLinear(linearLut.WindowWidth, linearLut.WindowCenter); manager.InstallVoiLut(installLut); } standardLut = manager.VoiLut as IBasicVoiLutLinear; standardLut.WindowWidth += windowIncrement; standardLut.WindowCenter += levelIncrement; SelectedVoiLutProvider.Draw(); }