Computer Vision News - November 2021
58 Medical Imaging Tool Or finally, import standard python libraries and create user-defined functions which match your needs: import numpy as np import math def some_func (x, y, z): return 0.5 *x*x + 0.3 *y*y + 0.5 *z*z a = np.fromfunction(some_func,( 30 , 20 , 15 )) volumeNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLScalarVolumeNode') volumeNode.CreateDefaultDisplayNodes() updateVolumeFromArray(volumeNode, a) setSliceViewerLayers(background=volumeNode) Option 2: Run Slicer operations froma batch script. This allows the user to use the powerful toolset from Slicer without any need to even open the GUI. Everything can be done just by terminal and python scripting. First, we need to get into the directory where Slicer is installed and then run the software with the parameters –no-main-window and –python-script as below:
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=