help > Clip the VOI of image programmatically MRIcroGL
Showing 1-2 of 2 posts
Display:
Results per page:
Apr 30, 2021  10:04 AM | dan1919
Clip the VOI of image programmatically MRIcroGL
Hello, I am using MRIcroGL and I am trying to write a script, that clips the underlying data from images of a VOI I have created. But I can not find a command in the scripting way that does it. It should do the same as when using the GUI Draw->advanced->Mask image->preserve VOI data.
That is my code so far:

gl.resetdefaults()
#open background image
gl.loadimage(dirname+filename)
#open overlay: show positive regions
gl.overlayload(voiname)
gl.minmax(0, 0, 10)


How can I only display (and save later on) the underlying data of my image? Any help would be great!
May 16, 2021  02:05 PM | Chris Rorden
RE: Clip the VOI of image programmatically MRIcroGL
Sorry, MRIcroGL does not have a scripting function for that. Feel free to create one with Python or Matlab. Here is a Matlab snippet that illustrates some of the concepts:
  https://github.com/rordenlab/spmScripts/blob/master/nii_mask.m