我正在使用来自 github 的 papaya API
在这个木瓜 dicom 查看器中,我想整合一些东西。
一是分页。如果我尝试编辑此 API,则会出现错误
我想要的是:-
- 在木瓜查看器 NEXT 中,PREV 工作正常,但我想让 On click to FIRST 和 LAST slice 移动。
- 并且分页将是 1,2,3,4...如果单击 ONE 第一个切片应该出现。
提前谢谢
我正在使用来自 github 的 papaya API
在这个木瓜 dicom 查看器中,我想整合一些东西。
一是分页。如果我尝试编辑此 API,则会出现错误
我想要的是:-
提前谢谢
下载木瓜医学研究图像查看器后,选择工作测试文件夹文件,这样您就可以了解木瓜Dicom查看器是如何工作的。
步骤1:-
在 js 文件夹中打开constants.js文件并创建常量
var MOVE_TO_FIRST_SLICE = "move-to-first-slice",
MOVE_TO_LAST_SLICE = "move-to-last-slice";
PAGINATION_LIST = "pagination-list";
第2步:-
现在打开viewer.js,在点击函数 FIRST、LAST 和 1,2,3... 切片(数据值)上创建它。
$(this.container.containerHtml.find("#" + MOVE_TO_FIRST_SLICE + this.container.containerIndex)).click(function () {
viewer.firstLastSlice(false);
});
$(this.container.containerHtml.find("#" + MOVE_TO_LAST_SLICE + this.container.containerIndex)).click(function () {
viewer.firstLastSlice(true)
});
$(this.container.containerHtml.find("." + PAGINATION_LIST + this.container.containerIndex)).click(function () {
var id = $(this).data('value');
viewer.pagination(id);
});
第 3 步:- 打开main.js并创建元素
papaya.Container.fillContainerHTML = function (containerHTML, isDefault, params, replaceIndex) {
containerHTML.append("<button type='button' id='"+ (MOVE_TO_FIRST_SLICE + index) + "' class='" + MOVE_TO_FIRST_SLICE + "'>First</button> ");
containerHTML.append("<button type='button' id='"+ (PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS + index) + "' class='" + PAPAYA_CONTROL_MAIN_INCREMENT_BUTTON_CSS + "'><</button> ");
var max = 23;
var slice;
for(slice=1; slice<=max; slice++){
containerHTML.append("<button id='"+ (PAGINATION_LIST + index) +"' class='"+ (PAGINATION_LIST + index) + "' data-value='" + slice + "' OnClick(" + slice +") >" + slice + "</button>");
}
containerHTML.append("<button id='"+ (PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS + index) + "' class='" + PAPAYA_CONTROL_MAIN_DECREMENT_BUTTON_CSS + "'>></button> ");
containerHTML.append("<button type='button' id='"+ (MOVE_TO_LAST_SLICE + index) + "' class='" + MOVE_TO_LAST_SLICE + "'>Last</button> ");
containerHTML.append("<button type='button' id='"+ (GET_MAX_VALUE + index) + "' class='" + GET_MAX_VALUE + index + "'>TesT</button> ");
}
第4步:-
以下函数对于移动切片viewer.js很重要
//pagination 1,2,3
papaya.viewer.Viewer.prototype.pagination = function (id, paginationList) {
var max = this.volume.header.imageDimensions.zDim;
//console.log(id);
this.currentCoord.z = id;
this.gotoCoordinate(this.currentCoord);
};
// firstLastSlice
papaya.viewer.Viewer.prototype.firstLastSlice = function (flSlice, degree) {
var max = this.volume.header.imageDimensions.zDim;
if (degree === undefined) {
degree = 0;
}
if (flSlice) {
this.currentCoord.z = max;
} else {
this.currentCoord.z = 0;
}
this.gotoCoordinate(this.currentCoord);
};
解释
this.volume.header.imageDimensions.zDim;
并将总计数存储在Max变量中。如果this.currentCoord.z = max;
它将转到最后一个切片,如果this.currentCoord.z = 0;
它将移动到第一个切片。this.currentCoord.z = id
(id <=> data-value ) 它将移动到特定的切片。单击使用此功能后this.gotoCoordinate(this.currentCoord);
,切片将移动。