公共类WindowLevelEffect: ShaderEffect
公共类WindowLevelEffect
继承了System.Windows.Media.Effects.ShaderEffect
实现了System.Windows.Media.Animation.IAnimatable
公共ref类WindowLevelEffect:公共System.Windows.Media.Effects.ShaderEffect,System.Windows.Media.Animation.IAnimatable
提供“按需”窗口调平效果,不改变图像数据。
要了解有关窗口调平的更多信息,请参阅RasterImage。WindowLevel,RasterImage。WindowLevelExt,WindowLevelCommand,Leadtools.ImageProcessing.Core.WindowLevelExtCommand,保存窗口级别的图像,改变亮度和对比度.
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.ImageProcessing;
使用Leadtools.Windows.Controls;
使用Leadtools.Windows.Media;
使用Leadtools.Windows.Media.Effects;
类WindowLevelEffectExampleWindow:窗口
{
公共WindowLevelEffectExampleWindow ()
{
StackPanel sp =新StackPanel ();
内容= sp;
RasterImageViewer theViewer =新RasterImageViewer ();
景观。水平Alignment = HorizontalAlignment.Center;
景观。verticalalign = verticalalign . top;
景观。imagehorizontalalign = horizontalalign . left;
景观。imageverticalalign = verticalalign . top;
sp.Children.Add(景观);
//加载图像到查看器
使用(RasterCodecs codecs =新RasterCodecs ())
{
景观。Image = codecs.Load(System.IO.Path.Combine(LEAD_VARS.ImagesDir,“Image3.dcm”));
}
//创建滑动条
TextBlock tb =新TextBlock ();
结核病。horizontalalign = horizontalalign . center;
结核病。文本=“窗口宽度:”;
sp.Children.Add(结核病);
滑动条windowWidthSlider =新滑块();
windowWidthSlider。最小值= 0.0;
windowWidthSlider。最大值=数学。Pow(2, theViewer.Image.BitsPerPixel - 1);
windowWidthSlider。宽度= 400;
windowWidthSlider。方向=方向。水平;
windowWidthSlider。IsSnapToTickEnabled =真正的;
windowWidthSlider。TickPlacement = system . windows . controls . primitives . tickplace . bottom right;
windowWidthSlider。TickFrequency = 0.1;
windowWidthSlider。AutoToolTipPrecision = 2;
windowWidthSlider。AutoToolTipPlacement = system . windows . controls . primitives . autotooltipplace . bottom right;
sp.Children.Add (windowWidthSlider);
结核病=新TextBlock ();
结核病。horizontalalign = horizontalalign . center;
结核病。文本=“窗口中心:”;
sp.Children.Add(结核病);
滑块windowCenterSlider =新滑块();
windowCenterSlider。最小值= 0.0;
windowCenterSlider。最大值=数学。Pow(2, theViewer.Image.BitsPerPixel - 1);
windowCenterSlider。宽度= 400;
windowCenterSlider。方向=方向。水平;
windowCenterSlider。IsSnapToTickEnabled =真正的;
windowCenterSlider。TickPlacement = system . windows . controls . primitives . tickplace . bottom right;
windowCenterSlider。TickFrequency = 0.1;
windowCenterSlider。AutoToolTipPrecision = 2;
windowCenterSlider。AutoToolTipPlacement = system . windows . controls . primitives . autotooltipplace . bottom right;
sp.Children.Add (windowCenterSlider);
//设置效果
WindowLevelEffect效果=新WindowLevelEffect ();
//设置纹理
effect.FillGrayTexture (theViewer.Image);
的效果。开始= Colors.Black;
的效果。结束=颜色。白色;
的效果。CurveType = CurveType. linear;
的效果。因子= 0.0;
的效果。窗口Width = Math.Pow(2, theViewer.Image.MaxValue - theViewer.Image.MinValue);
的效果。窗口中心=的效果。窗口Width / 2;
景观。ImageEffect =效果;
//绑定属性
绑定绑定=新绑定();
绑定。来源=效果;
绑定。UpdateSourceTrigger = UpdateSourceTrigger. propertychanged;
绑定。路径=新PropertyPath (“WindowWidth”);
windowWidthSlider.SetBinding(滑块。ValueProperty,绑定);
绑定=新绑定();
绑定。来源=效果;
绑定。UpdateSourceTrigger = UpdateSourceTrigger. propertychanged;
绑定。路径=新PropertyPath (“WindowCenter”);
windowCenterSlider.SetBinding(滑块。ValueProperty,绑定);
Title =“使用WindowLevelEffect”;
}
}
静态类LEAD_VARS
{
公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;
}
进口Leadtools
进口Leadtools。编解码器
进口Leadtools。ImageProcessing
进口Leadtools.Windows.Controls
进口Leadtools.Windows.Media
进口Leadtools.Windows.Media.Effects
类WindowLevelEffectExampleWindow
继承了窗口
公共子新()
昏暗的sp作为新StackPanel ()
内容= sp
昏暗的景观作为新RasterImageViewer ()
景观。水平Alignment = HorizontalAlignment.Center
景观。VerticalAlignment = VerticalAlignment。前
景观。ImageHorizontalAlignment = HorizontalAlignment。左
景观。ImageVerticalAlignment =垂直对齐。前
sp.Children.Add(景观)
’将图像加载到查看器中
使用编解码器作为新RasterCodecs ()
景观。Image = codecs.Load(System.IO.Path.Combine(LEAD_VARS.ImagesDir,“Image3.dcm”))
结束使用
创建滑块
昏暗的结核病作为新TextBlock ()
结核病。HorizontalAlignment = HorizontalAlignment。中心
结核病。文本=“窗口宽度:”
sp.Children.Add (tb)
昏暗的windowWidthSlider作为新滑块()
windowWidthSlider。最小值= 0.0
windowWidthSlider。最大值=数学。Pow(2, theViewer.Image.BitsPerPixel - 1)
windowWidthSlider。宽度= 400
windowWidthSlider。方向=方向。水平
windowWidthSlider。IsSnapToTickEnabled =真正的
windowWidthSlider。TickPlacement = system . windows . controls . primitives . tickplace . bottom right
windowWidthSlider。TickFrequency = 0.1
windowWidthSlider。AutoToolTipPrecision = 2
windowWidthSlider。AutoToolTipPlacement = system . windows . controls . primitives . autotooltipplace . bottom right
sp.Children.Add (windowWidthSlider)
结核病=新TextBlock ()
结核病。HorizontalAlignment = HorizontalAlignment。中心
结核病。文本=“窗口中心:”
sp.Children.Add (tb)
昏暗的windowCenterSlider作为新滑块()
windowCenterSlider。最小值= 0.0
windowCenterSlider。最大值=数学。Pow(2, theViewer.Image.BitsPerPixel - 1)
windowCenterSlider。宽度= 400
windowCenterSlider。方向=方向。水平
windowCenterSlider。IsSnapToTickEnabled =真正的
windowCenterSlider。TickPlacement = system . windows . controls . primitives . tickplace . bottom right
windowCenterSlider。TickFrequency = 0.1
windowCenterSlider。AutoToolTipPrecision = 2
windowCenterSlider。AutoToolTipPlacement = system . windows . controls . primitives . autotooltipplace . bottom right
sp.Children.Add (windowCenterSlider)
设置效果
昏暗的效果作为新WindowLevelEffect ()
设置纹理
effect.FillGrayTexture (theViewer.Image)
的效果。开始=颜色。黑色的
的效果。结束=颜色。白色
的效果。CurveType =曲线类型。线性
的效果。因子= 0.0
的效果。窗口Width = Math.Pow(2, theViewer.Image.MaxValue - theViewer.Image.MinValue)
的效果。窗口中心=的效果。窗口Width / 2
景观。ImageEffect =效果
绑定属性
昏暗的绑定作为新绑定()
绑定。来源=效果
绑定。UpdateSourceTrigger = UpdateSourceTrigger。propertychange
绑定。路径=新PropertyPath (“WindowWidth”)
windowWidthSlider.SetBinding(滑块。ValueProperty绑定)
绑定=新绑定()
绑定。来源=效果
绑定。UpdateSourceTrigger = UpdateSourceTrigger。propertychange
绑定。路径=新PropertyPath (“WindowCenter”)
windowCenterSlider.SetBinding(滑块。ValueProperty绑定)
Title =“使用WindowLevelEffect”
结束子
结束类
公共NotInheritable类LEAD_VARS
公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”
结束类
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗网络查看器net
188宝金博怎么下载
支持的平台上
.NET、Java、Android和iOS/macOS程序集
C API/ c++类库
HTML5 JavaScript库
您的邮件已发送给技术支持!应该有人联系!如果你的事情很紧急,请回来聊天。
聊天时间:
周一至周五,美国东部时间上午8:30至下午6:00
感谢您的反馈!
请再次填写表格,开始新的聊天。
所有代理目前都离线。
聊天时间:
星期一至星期五
美国东部时间上午8:30 -下午6点
如需与我们联系,请填写此表格,我们将通过电子邮件与您联系。