Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i update two slice with same silde in nrrd loader

Tags:

javascript

vtk

I am new to Javascript and NRRD Loader, in nrrd loader we can change the index value of a slice using the slider

sliceY = volume.extractSlice('y', Math.floor(volume.RASDimensions[1]/2));
scene3.add(sliceY.mesh);

gui.add(sliceY, 'index', 0, volume.RASDimensions[1], 1).name('indexY').onChange(function () {
  sliceY.repaint.call(sliceY);
});

Consider I need update value of slicesX at same time with the same slider

sliceX = volume.extractSlice('x', Math.floor(volume.RASDimensions[1]/2));
like image 796
sudeep Krishnan Avatar asked Jun 05 '17 09:06

sudeep Krishnan


1 Answers

I used slider.js Javascript which helped me to move the two slices using the same slider

$( function() { 
                  $( "#sliderx" ).slider({
                    min: 0,
                    max: volumeslicex,
                    step: 1,

                    stop: function( event, ui ) {
                        // planexy.material.color.setHex( 0x8d8d8d );
                        // preset = "NULL";
                    },

                    slide: function( event, ui ) {

                      indexX=ui.value;
                      scene1.remove( sliceX.mesh );
                      scene.remove( sliceX1.mesh );
                      sliceChange();

                    }
                  });
                } );
                    function sliceChange(){
                    //alert(indexX);
                    sliceX = volume.extractSlice('x',Math.floor(indexX));
                    sliceX1 = volume.extractSlice('x',Math.floor(indexX));
                    scene1.add( sliceX.mesh );
                    scene.add( sliceX1.mesh );
                    };
like image 121
sudeep Krishnan Avatar answered Oct 04 '22 06:10

sudeep Krishnan