当前位置:网站首页>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');
边栏推荐
- Talk about routing design in service governance
- YGG Spain subdao Ola GG officially established
- Decomposition - command injection
- Online JSON to CSharp (c) class tool
- 这道字符串反转的题目,你能想到更好的方法吗?
- QT project error: -1: error: cannot run compiler 'clang++' Output:mingw32-make. exe
- vtk.js鼠標左鍵滑動改變窗比特和窗寬
- Unity to wechat applet games
- For loop of go language foundation
- Abnormal logic reasoning problem of Huawei software test written test
猜你喜欢

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

1278_FreeRTOS_借助prvAddCurrentTaskToDelayedList接口理解delayed task

《一周的朋友》

Make a record of glib2.14 upgrading glib2.18 and the principle of the steps

Eureka service registration and discovery

浅谈ThreadLocal和InheritableThreadLocal,源码解析

Learn to draw Er graph in an article

ArcMap batch delete points closer

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

Playwirght getting started
随机推荐
MySQL系统表介绍
30 sets of report templates necessary for the workplace, meeting 95% of the report needs, and no code is required for one click application
【云计算赛项】职业技能竞赛--容器开发部分例题Pig快速开发框架
domain controller
YGG 西班牙 subDAO——Ola GG 正式成立
论文伪代码规范,伪代码在线编辑器,
Qt 使用QDomDocument读取xml文件
C WPF realizes dynamic loading of controls through binding
1. probability theory - combination analysis
Acwing第 56 場周賽【完結】
《一周的朋友》
Playwirght getting started
分布式ID生成
Decoding and practice of cmaf Technology
HCIP之路
[pyqt5 series] modify the counter to realize control
vtk.js鼠標左鍵滑動改變窗比特和窗寬
Deploy kubersphere in kubernetes
WPS for thesis writing installs MathType plug-in to write mathematical formulas
How bootstrap clears floating styles