Search code examples
dm-script

Play through the slice of an Image stack


In GMS3 (or GMS2), is there any command available to access the SlicePlayer or Slice palette? Like pressing the 'play' button to play through the slice of 3D data via script. OR is there any other way to do this? Thanks.


Solution

  • The commands you're seeking are :

    void ImageDisplayGetDisplayedLayers( ImageDisplay imgDisp, NumberVariable start, NumberVariable end )
    void ImageDisplaySetDisplayedLayers( ImageDisplay imgDisp, Number start, Number end )
    
    void ImageDisplayGetDisplayedLayers( ImageDisplay imgDisp, NumberVariable start1, NumberVariable end1, NumberVariable start2, NumberVariable end2 )
    void ImageDisplaySetDisplayedLayers( ImageDisplay imgDisp, Number start1, Number end1, Number start2, Number end2 )
    

    See example:

    number nz = 25
    image stack := RealImage( "Fake Stack",4,100,100,nz)
    stack = iradius<(1+iplane)*2?irow:icol
    stack.ShowImage()
    imageDisplay disp = stack.ImageGetImageDisplay(0)
    for( number i=0;i<nz;i++ )
    {
        disp.ImageDisplaySetDisplayedLayers(i,i)
        stack.UpdateImage()
        sleep(0.1)
    }
    

    All ImageDisplay commands can be found in the F1 documentation here:

    enter image description here