使用javascript在papaya dicom查看器切片中进行分页

使用javascript在papaya dicom查看器切片中进行分页,javascript,jquery,papaya,Javascript,Jquery,Papaya,我正在使用github的PapayaAPI 在这个木瓜dicom查看器中,我想集成一些东西 一种是分页。如果我试图编辑这个API,我会出错 我想要的:- 在接下来的木瓜查看器中,PREV运行良好,但我想 单击以移动第一个和最后一个切片 如果单击第一个切片,分页将为1,2,3,4 应该出现 提前感谢下载Papaya medical research图像查看器后,选择工作测试文件夹文件,以便您了解Papaya Dicom查看器的工作原理 第1步:- 在js文件夹中打开constants.js文件并创

我正在使用github的PapayaAPI

在这个木瓜dicom查看器中,我想集成一些东西

一种是分页。如果我试图编辑这个API,我会出错

我想要的:-

  • 在接下来的木瓜查看器中,PREV运行良好,但我想 单击以移动第一个和最后一个切片
  • 如果单击第一个切片,分页将为1,2,3,4 应该出现

  • 提前感谢

    下载Papaya medical research图像查看器后,选择工作测试文件夹文件,以便您了解Papaya 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。。。切片(数据值)

    第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> ");
    }
    
    解释

  • viewer.js计算的总切片
    this.volume.header.imageDimensions.zDim并将总计数存储在Max变量中。如果
    此.currentCoord.z=maxthis.currentCoord.z=0,则代码>将转到最后一个片else它将移动到第一个切片
  • 在分页中,单击将数据值传递给viewer.js分页函数,如果
    this.currentCoord.z=id
    (id数据值),它将移动到特定的切片

  • 单击使用此函数后
    this.gotocoord(this.currentCoord)切片将移动。

    如果您在下面有任何查询注释,我会在下面找到答案。
    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> ");
    }
    
    //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);
    };