I have been able to load freesurfer volume outputs on the slicer, import segmentations, and perform radiomic feature extraction using the slicer application. However, I would like to do the same using the command line in MacBook Air in batch mode for multiple subjects. Could someone please direct me in the right direction?
You can use the FreeSurferImporterLogic moduleâs logic in Python scripts to load freesurfer data then process, quantify, export, etc. Something like this can work for data loading:
fsImporterLogic = slicer.util.getModuleLogic('FreeSurferImporter')
volume = fsImporterLogic.LoadFreeSurferVolume('path/to/myfile')
Iâm also trying to load FreeSurfer data with Python command line.
I succeeded to load volume, segmentation and model(pial) with this approach.
However, I cannot load annotation file by LoadFreeSurferScalarOverlay with error below. (This process can work with GUI.)
Would you suggest some solution for this problem?
fsImporterLogic = slicer.util.getModuleLogic(âFreeSurferImporterâ)
pial = fsImporterLogic.LoadFreeSurferModel(âfsaverage/surf/lh.pialâ)
modelNode=slicer.util.getNode(âlh_pialâ)
fsImporterLogic.LoadFreeSurferScalarOverlay(âfsaverage/label/lh.aparc.annotâ, modelNode.GetID())
Traceback (most recent call last):
File ââ, line 1, in
AttributeError: âvtkSlicerFreeSurferImporterModuleLogicPython.vtkSlâ object has no attribute âLoadFreeSurferScalarOverlayâ
LoadFreeSurferScalarOverlay
method is not Python-wrapped (VTKâs Python wrapper does not support vector of VTK objects).
@Sunderlandkyl could you add a Python-wrappable variant of this method?
New python wrapped methods should be available tomorrow in the nightly.
There are two function signatures, one that can load the overlay on many model nodes, and one that loads the overlay on a single model node:
bool LoadFreeSurferScalarOverlay(std::string filePath, vtkCollection* modelNodes);
bool LoadFreeSurferScalarOverlay(std::string filePath, vtkMRMLModelNode* modelNode);
Thank you for your kind support!