当前位置:网站首页>vtk. JS left mouse button sliding to change window level and window width
vtk. JS left mouse button sliding to change window level and window width
2022-06-23 07:53:00 【Xiaojiangjiang 12】
var that = this;
function DragObj(selector) {
// Save node
this.ele = $(selector).get(0);
// call startDrag
this.startDrag();
}
/* encapsulation startDrag Method */
DragObj.prototype.startDrag = function () {
var self = this;
// Add... To the node of the current object mousedown event , Execute sliding event after mouse down event
$(self.ele).on({
mousedown: function () {
self.drag();
}
})
}
/* Encapsulate sliding events */
DragObj.prototype.drag = function () {
var self = this;
/* initialization self.newDisance*/
self.newDisance = {
X:that.vtkObj['imageActorI'].getProperty().getColorLevel(),
Y:that.vtkObj['imageActorI'].getProperty().getColorWindow()
}
// to X Add move and end events to window objects
$('#contentX').on({
/* According to the moving distance, judge whether to increase or decrease the grayscale , To the left and right wl, Up and down for ww*/
mousemove: function (oEvent) {
if(self.disance && self.disance.X){
self.newDisance.X = that.vtkObj['imageActorI'].getProperty().getColorLevel() + (oEvent.pageX - self.disance.X);
self.newDisance.Y = that.vtkObj['imageActorI'].getProperty().getColorWindow() + (oEvent.pageY - self.disance.Y);
}
self.disance = {
X: oEvent.pageX,
Y: oEvent.pageY
};
// Sagittal plane , Coronal plane , The axial plane changes the window level and window width at the same time
['X','Y','Z'].forEach((type) => {
that.vtkObj['imageActor' + that.typeMap[type]].getProperty().setColorLevel(self.newDisance.X);
that.vtkObj['imageActor' + that.typeMap[type]].getProperty().setColorWindow(self.newDisance.Y);
})
$(".colorLevel").val(self.newDisance.X);
$(".colorWindow").val(self.newDisance.Y);
},
mouseup: function () {
/* Reset the distance after releasing the mouse , Let it recalculate */
self.disance = {};
self.newDisance = {
X:that.vtkObj['imageActorI'].getProperty().getColorLevel(),
Y:that.vtkObj['imageActorI'].getProperty().getColorWindow()
};
$("#contentX").off('mousemove mouseup');
}
})
}
new DragObj('#contentX');
边栏推荐
- 通过端口查文件
- 【markdown】markdown 教程大归纳
- 2. probability theory - axiom of probability theory
- openvino系列 19. OpenVINO 与 PaddleOCR 实现视频实时OCR处理
- Online text filter less than specified length tool
- C WPF realizes dynamic loading of controls through binding
- The eighth experiment of hcip Road
- 快速排序 + 冒泡排序 + 插入排序 + 选择排序
- 3DMAX plug-in development environment configuration and fileexport and utilities template testing
- [深度学习][原创]如何不用yolov5权重或者模型进行目标检测和绘制map等参数图
猜你喜欢

The road to hcip MPLS

Qt 使用QDomDocument读取xml文件

Talk about routing design in service governance

3DMAX plug-in development environment configuration and fileexport and utilities template testing

这道字符串反转的题目,你能想到更好的方法吗?

AVL树的实现

Playwirght getting started
![[pyqt5 series] modify the counter to realize control](/img/de/c997a19ad72619b0fd2fcd0124ee1a.png)
[pyqt5 series] modify the counter to realize control

11 字符串函数

Detailed explanation of redis persistence, master-slave and sentry architecture
随机推荐
socket编程——select模型
【Veusz】导入CSV中的二维数据
socket编程(多线程)
Decomposition - command injection
3DMAX plug-in development environment configuration and fileexport and utilities template testing
Take you to tiktok. That's it
左乘右乘矩阵问题
Acwing第 56 場周賽【完結】
Matlab随机波动率SV、GARCH用MCMC马尔可夫链蒙特卡罗方法分析汇率时间序列
[interface automation] software testing the core skills of salary increase to increase salary by 200%
Analysis of open API design specification
How do I install MySQL on my computer?
socket编程(多进程)
Intelligence Education - how to merge codes when code conflicts occur in multi person collaborative development?
QT project error: -1: error: cannot run compiler 'clang++' Output:mingw32-make. exe
three. Solution to stripe shadow and grid shadow in JS
flutter 制作TabBar的圆角
一秒钟查看一次文件,并将文件最后一行内容结果发送至syslog服务器
YGG 西班牙 subDAO——Ola GG 正式成立
GIF验证码分析