当前位置:网站首页>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');
边栏推荐
- 2022山东大学软件学院软件项目管理期末考试(回忆版)
- Minio single node deployment Minio distributed deployment fool deployment process (I)
- 2022 final examination of software project management of School of software, Shandong University (recall version)
- vtk.js鼠标左键滑动改变窗位和窗宽
- js中的同步和异步
- Qt工程报错:-1: error: Cannot run compiler ‘clang++‘. Output:mingw32-make.exe
- socket编程(多线程)
- 一篇文章学会er图绘制
- Microsoft Exchange – prevent network attacks
- vs在连接SQL时出现的问题myconn.OPen();无法运行
猜你喜欢

30 sets of report templates necessary for the workplace, meeting 95% of the report needs, and no code is required for one click application

HCIP之路第八次实验

EXCEL VBA 入门与实用例子

WPS for thesis writing installs MathType plug-in to write mathematical formulas

GIF验证码分析

ArcMap批量删除距离较近的点

vs在连接SQL时出现的问题myconn.OPen();无法运行

Test APK exception control nettraffic attacker development

MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2

Qt 使用QDomDocument读取xml文件
随机推荐
RTMP streaming exception fast recovery scheme
快速删除代码里面的node_modules
[interface automation] software testing the core skills of salary increase to increase salary by 200%
EXCEL VBA 入门与实用例子
Friends of the week
openvino系列 19. OpenVINO 与 PaddleOCR 实现视频实时OCR处理
Learn to draw Er graph in an article
socket编程(多进程)
套接字socket编程
vs在连接SQL时出现的问题myconn.OPen();无法运行
Unity picture loading and saving
openni. utils. OpenNIError: (OniStatus.ONI_STATUS_ERROR, b‘DeviceOpen using default: no devices found‘
YGG Spain subdao Ola GG officially established
Apache Solr 任意文件读取复现
How to tag and label naming before the project release
一篇文章学会er图绘制
socket编程(多线程)
1. probability theory - combination analysis
通过端口查文件
Matlab random volatility SV, GARCH using MCMC Markov chain Monte Carlo method to analyze exchange rate time series