Hi,
I am trying to run WMA on a given dataset. The process runs fine until the moment where the FiberTractMeasurements module in Slicer is called. The tool writes the following to the std output:
<wm_apply_ORG_atlas_to_subject> Report diffusion measurements of fiber clusters.
Importing whitematteranalysis package.
<wm_diffusion_measurements>. Starting scalar measurement extraction.
=====input directory======
{my_data}/FiberClustering/SeparatedClusters/tracts_commissural
=====output directory=====
{my_data}/FiberClustering/SeparatedClusters
=====3D Slicer====
/opt/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements
==========================
/opt/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements:
error while loading shared libraries: libSlicerBaseLogic.so: cannot open shared object file: No such file or directory
<wm_diffusion_measurements>
Measurements done at: {my_data}/FiberClustering/SeparatedClusters/diffusion_measurements_commissural.csv
No CSV file is effectively written after the libSlicerBaseLogic library not being found. A find shows that the library is there:
I’m guessing that this script was developed on Mac, where the shared library paths are baked into the executable. On linux you need to use Slicer’s launch environment. Easiest would be to run
Slicer --launch bash
to create a shell with the right environment and run the whitematteranalysis scripts in that shell.
The script I am using calls to wm_apply_ORG_atlas_to_subject.sh, but it is not being found within Slicer’s launch environment:
wm_apply_ORG_atlas_to_subject.sh: not found
If I give it its absolute path, then the immediately next WMA script called by the former (wm_register_to_atlas_new.py) is not found. Adding the absolute path where the WMA scripts are installed to the PATH env variable does not help either.
Slicer comes with a Python 3.9 version; my default is Python 3.10, and have installed WMA following the website’s instructions. A pip show whitematteranalysis within the launch environment results in a
ModuleNotFoundError: No module named 'importlib.readers'
Do I need to install it within Slicer’s launch environment?
BTW, I now realize that another discourse thread reported the same error in another discourse threadh, and that I even confirmed that I was having the issue:
Sorry for the cross-posting .
This has also been reported to the WMA repository as an ongoing issue:
Another element in the WMA folder that may play a role in all this is this one:
Not sure this is necessary, even on macOS (the INSTALLFOLDER is certainly a hard-coded macOS path); even if the parent folder says slicer, there are no paths related to Slicer in this script.
At one point I worked on applying the WMA pipeline to sets of data and ran the whole process out of Slicer’s python environment, including the part where it launched the FiberTractMeasurements. This code includes some odd workarounds (like calling eddy current correction on a remote machine) but it did basically work so you might be able to start from here:
Not sure this would work, as even when I try to use the “FiberTractMeasurements” module from within the GUI no CSV/output is being written. Anyways, gave it a try with a reduced version of your script (with the paths adapted to my case):
qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added
Ignore argument received via command-line (not a valid URL or existing local file): "--pythonâ\u0080\u0093script"Local filepath received via command-line: "/home/path/to/fibertractmeasurements_slicerpy.py"
virtual bool qSlicerFreeSurferImporterScalarOverlayReader::load(const IOProperties&) failed: missing fileName or modelNodeId property
static void qSlicerIOManager::showLoadNodesResultDialog(bool, vtkMRMLMessageCollection*) Errors occurred while loading nodes: "Error: Loading /home/path/to/fibertractmeasurements_slicerpy.py - load failed.\n"
qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'Hello' is not defined