# No CSV file in DiffusionMessurements folder in WMA

**URL:** https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439
**Category:** SlicerDMRI
**Created:** [March 18, 2023, 5:22am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439 "2023-03-18T05:22:10Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Fumi](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@Fumi](https://discourse.slicer.org/u/Fumi)
#### Post date: [March 18, 2023, 5:22am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/1 "2023-03-18T05:22:10Z")

</div>

Hi there, I am doing whitematteranalysis along with WMA tutorial: [https://github.com/SlicerDMRI/whitematteranalysis/blob/master/doc/subject-specific-tractography-parcellation.md](https://github.com/SlicerDMRI/whitematteranalysis/blob/master/doc/subject-specific-tractography-parcellation.md). In the last step of tutorial, " 8. Fiber tract diffusion measurements", I could not get any CSV file in the created new DiffusionMeasurements folder with error message of below:

> brain@l4n:~/Desktop/WMA\_tutorial\_data$ wm\_diffusion\_measurements.py ./FiberClustering/SeparatedClusters/tracts\_commissural/ ./DiffusionMeasurements/commissural\_clusters.csv /home/brain/Downloads/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements  
> Importing whitematteranalysis package.  
> \<wm\_diffusion\_measurements\>. Starting scalar measurement extraction.
> 
> # =====input directory====== ./FiberClustering/SeparatedClusters/tracts\_commissural/ =====output directory===== ./DiffusionMeasurements =====3D Slicer==== /home/brain/Downloads/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements
> 
> /home/brain/Downloads/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: ./DiffusionMeasurements/commissural\_clusters.csv

This is happened to both tutorial data and my own DTI data, and either input is SeparatedClusters or AnatomicalTracts. I think the folder structure for SlicerDMRI in my PC is correct.  
Anyone who has advice on this issue?

Thank you,  
Fumi

---

<div class="post-metadata">

### Author: ![zhangfanmark](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zhangfanmark/32/4451_2.png) [@zhangfanmark](https://discourse.slicer.org/u/zhangfanmark)
#### Post date: [March 18, 2023, 5:39am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/2 "2023-03-18T05:39:47Z")

</div>

Hi,

Please try Slicer launcher to call the fiber measurement module:

wm\_diffusion\_measurements.py ./FiberClustering/SeparatedClusters/tracts\_commissural/ ./DiffusionMeasurements/commissural\_clusters.csv “/home/brain/Downloads/Slicer-5.2.2-linux-amd64/Slicer --launch FiberTractMeasurements”

Regards,  
Fan

---

<div class="post-metadata">

### Author: ![Fumi](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@Fumi](https://discourse.slicer.org/u/Fumi)
#### Post date: [March 18, 2023, 6:04am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/3 "2023-03-18T06:04:13Z")

</div>

Hi Fan, thank you for a very quick reply. I tried your command, but it was error again:

wm\_diffusion\_measurements.py ./FiberClustering/SeparatedClusters/tracts\_commissural/ ./DiffusionMeasurements/commissural\_clusters.csv “/home/brain/Downloads/Slicer-5.2.2-linux-amd64/Slicer --launch FiberTractMeasurements”  
Importing whitematteranalysis package.  
usage: wm\_diffusion\_measurements.py [-h] [-v] inputDirectory outputCSV Slicer  
wm\_diffusion\_measurements.py: error: unrecognized arguments: --launch FiberTractMeasurements”

Do you know why this is happen?

Thanks a lot!

Fumi

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [June 29, 2023, 2:43pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/4 "2023-06-29T14:43:46Z")

</div>

Hi,  
experiencing the very same error using Slicer 5.2.2 on Ubuntu 22.04 and when calling the measurement module through the `wm_apply_ORG_atlas_to_subject.sh` WMA script:

> <https://github.com/SlicerDMRI/whitematteranalysis/blob/master/bin/wm_apply_ORG_atlas_to_subject.sh>

as

```auto
wm_apply_ORG_atlas_to_subject.sh -i my_tractogram.vtk -o WMA -a /path/to/org_atlas/ORG-Atlases-1.2 -s /opt/Slicer-5.2.2-linux-amd64/Slicer -d 1 -m /opt/Slicer-5.2.2-linux-amd64/NA-MIC/Extensions-31382/SlicerDMRI/lib/Slicer-5.2/cli-modules/FiberTractMeasurements -c 2 -n 4

```

The library is there of course,

```auto
/opt/Slicer-5.2.2-linux-amd64/lib/Slicer-5.2/libSlicerBaseLogic.so

```

but the script/Slicer is unable to locate it.

Instead, if I try to call the Python module directly from the command line, Slicer is unable to load the tractography data:

```auto
wm_diffusion_measurements.py /path/to/AnatomicalTracts /path/to/clusters.csv /opt/Slicer-5.2.2-linux-amd64/Slicer
Importing whitematteranalysis package.
<wm_diffusion_measurements>. Starting scalar measurement extraction.

=====input directory======
 /path/to/AnatomicalTracts
=====output directory=====
 /path/to/
=====3D Slicer====
 /opt/Slicer-5.2.2-linux-amd64/Slicer
==========================
Switch to module: "Welcome"
Ignore argument received via command-line (not a valid URL or existing local file): "--inputtype"
Ignore argument received via command-line (not a valid URL or existing local file): "Fibers_File_Folder"
Ignore argument received via command-line (not a valid URL or existing local file): "--format"
Ignore argument received via command-line (not a valid URL or existing local file): "Column_Hierarchy"
Ignore argument received via command-line (not a valid URL or existing local file): "--separator"
Ignore argument received via command-line (not a valid URL or existing local file): "Comma"
Ignore argument received via command-line (not a valid URL or existing local file): "--inputdirectory"
Local filepath received via command-line: " /path/to/AnatomicalTracts"
Ignore argument received via command-line (not a valid URL or existing local file): "--outputfile"
Ignore argument received via command-line (not a valid URL or existing local file): " /path/to/clusters.csv"
static void qSlicerIOManager::showLoadNodesResultDialog(bool, vtkMRMLMessageCollection*) Errors occurred while loading nodes: "Error: Loading /path/to//AnatomicalTracts - load failed.\n"
Switch to module: ""
Switch to module: ""
<wm_diffusion_measurements> Measurements done at: /path/to/clusters.csv

```

Any suggestion to make this work one way or the other?

---

<div class="post-metadata">

### Author: ![Fumi](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@Fumi](https://discourse.slicer.org/u/Fumi)
#### Post date: [July 6, 2023, 1:56am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/5 "2023-07-06T01:56:02Z")

</div>

Hi, this issue is very similar to my problem. I tried many things on this topic, using some version of slicer, even on Mac and Windows. I noticed even I tried TractographyMeasurement on GUI, I couldn’t get any CSV file in folder like you mentioned in another topic.

Bacause I was running of time, I gave up using Slicer for my tract study.  
Hope you can solve this issue!

---

<div class="post-metadata">

### Author: ![zhangfanmark](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zhangfanmark/32/4451_2.png) [@zhangfanmark](https://discourse.slicer.org/u/zhangfanmark)
#### Post date: [July 6, 2023, 4:28am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/6 "2023-07-06T04:28:41Z")

</div>

Hi @Fumi @jhlegarreta

I looked in the the issue that you were facing.

On MacOS (mine is Ventura 13.2.1), it is working properly for me as it is. Please see the below screenshot for my setting to run the wm\_diffusion\_measurements script using Slicer 5.2.2 stable release:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/5/45d477da36fe3176a0cdca20725cf2a02f4e2a61.jpeg)

On Ubuntu (mine is 20.04.4 LTS), I also saw the issue about missing lib files when using Slicer 5.2.2 when directly call the FiberTractMeasurements module in the CLI mode. In this case, we would need to use Slicer Launcher to call the module so the program can set all the required libs. Please see the following screenshot for how this is being set. Please be noted of the red underline part. One change to what we did before is that the full path of the FiberTractMeasurements module is needed rather than the name of the module.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/5/d5784dfd34c024973f827b9037d91ef85110cabe.jpeg)

Hope this will fix the issue you have here. Please let us know if you have further questions.

Thank you!

Regards,  
Fan

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 6, 2023, 2:34pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/7 "2023-07-06T14:34:05Z")

</div>

> [@zhangfanmark](#):
>
> Hope this will fix the issue you have here. Please let us know if you have further questions.

That worked @zhangfanmark ! Thanks.

I will propose a PR to cover the Linux case in the [related documentation](https://github.com/SlicerDMRI/whitematteranalysis/blob/6d93b6452b32ebedbee29674766abfe752dd1d04/doc/subject-specific-tractography-parcellation.md) as the only difference is the contents of the argument related to the module.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 6, 2023, 2:40pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/8 "2023-07-06T14:40:26Z")

</div>

> I noticed even I tried TractographyMeasurement on GUI, I couldn’t get any CSV file in folder like you mentioned in another topic.

True, the above does not solve the file not being computed using the GUI. I will open an issue in the [SlicerDMRI repository](https://github.com/SlicerDMRI/SlicerDMRI).

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 6, 2023, 4:18pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/9 "2023-07-06T16:18:21Z")

</div>

> [@jhlegarreta](#):
>
> True, the above does not solve the file not being computed using the GUI. I will open an issue in the [SlicerDMRI repository](https://github.com/SlicerDMRI/SlicerDMRI).

OK, I figured out how to obtain the bundle stats using the GUI when specifying a folder (using the `Fibers_File_Folder` mode):

The stats are computed and written to the specified CSV file.

I could not make it work when trying to compute the stats using the `Fiber_Hierarchy` mode: a 0-sized file is written: @lassoan @pieper @zhangfanmark Am I correct when assuming that if I load a number of bundles (or an MRML created out of them) the `Fibers_Hierarchy` mode should work as fine as when using the `Fibers_File_Folder` option? Is there something else we should do to actually “create a hierachy”? The`Fibers Hierarchy` mode has the options `Rename current ModelHierarchy` and `Delete current ModelHierarchy` but when clicking no actions seems to be taken.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 6, 2023, 7:09pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/10 "2023-07-06T19:09:37Z")

</div>

I’m not sure - maybe @zhangfanmark or @ljod knows if the `Fibers_Hierarchy` option is still valid. My guess is that the feature was added in an older Slicer version (there used to be a Model Hierarchy concept that has been replaced by the more general Subject Hierarchy in current Slicer versions). Unless there’s a strong need and some resources to investigate updating this feature, the easiest option would be to just remove the XML and C++ code.

As a side note, this module is an example of an older style of Slicer module that tried to abstract the GUI in XML and it made certain features like this one kind of clunky. In modern Slicer we’d try to create a more convenient interface using python scripting and then call the C++ code with all the arguments managed by the python code.

---

<div class="post-metadata">

### Author: ![zhangfanmark](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zhangfanmark/32/4451_2.png) [@zhangfanmark](https://discourse.slicer.org/u/zhangfanmark)
#### Post date: [July 7, 2023, 2:28am UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/11 "2023-07-07T02:28:02Z")

</div>

Hi @jhlegarreta

As Steve said the Fibers\_Hierarchy is an old style of Slicer module. It is helpful when we created the atlas where multiple clusters form a tract. In this case, we can compute measure from not only tracts but also individual clusters. Currently, our use case is mostly Fibers\_File\_Folder, so you don’t need to worry about this. We want to keep this option so we can track back what we did before. To use this function, yes, you need to create a hierarchy or use an existing defined in a mrml file.

Regards,  
Fan

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 7, 2023, 12:36pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/12 "2023-07-07T12:36:52Z")

</div>

> [@zhangfanmark](#):
>
> As Steve said the Fibers\_Hierarchy is an old style of Slicer module. It is helpful when we created the atlas where multiple clusters form a tract. In this case, we can compute measure from not only tracts but also individual clusters. Currently, our use case is mostly Fibers\_File\_Folder, so you don’t need to worry about this. We want to keep this option so we can track back what we did before.

Not sure I understand the difference: whenever I load a number of tractograms in a SW, I would tend to think that I can compute features out of these. If within the Slicer realm a hierarchy must be created in order to do this, does it make sense to create a default one (e.g. including all loaded data)? I understand that computing measurements for individual clusters or at different levels is relevant, but IMHO the same principle applies if I consider that my clusters are those files that I loaded into Slicer. I am happy to help fixing this.

> [@zhangfanmark](#):
>
> To use this function, yes, you need to create a hierarchy or use an existing defined in a mrml file.

Yesterday I tried loading a number of tractography data into Slicer, created what seemed to be a hierarchy by creating a subject, then saved the scene as an MRML and the CSV written had still no contents. So there is something else that must be done.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 7, 2023, 2:40pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/13 "2023-07-07T14:40:53Z")

</div>

I don’t believe there is a way to create the deprecated Model Hierarchy via the GUI anymore.

There’s some discussion here:

> [@vtkMRMLModelHierarchyNode nodes imported as subject hierarchies](https://discourse.slicer.org/t/vtkmrmlmodelhierarchynode-nodes-imported-as-subject-hierarchies/11707):
>
> Hello, I create a model hierarchy (based on vtkMRMLModelHierarchyNode objects) and save the mrml scene. When I open that scene, the model hierarchy has been turned into a subject hierarchy. Is that the expected behaviour? Thanks you in advance.

> [@Passing hierarchies to CLIs](https://discourse.slicer.org/t/passing-hierarchies-to-clis/11706):
>
> Hello. I’m trying to develop a CLI module which takes a set of models as input and gives a set of models as output. It seems to be possible to use vtkMRMLModelHierarchy nodes for this, but is it possible to use vtkMRMLSubjectHierarchy nodes instead? Thanks in advance.

> [@2020.05.26 Hangout](https://discourse.slicer.org/t/2020-05-26-hangout/11700):
>
> Tomorrow, we will be having our weekly hangout at 10:00 AM EST until 11 AM EST. Anyone is welcome to join to ask questions at [https://bit.ly/slicer-googlemeet-hosted-by-kitware](https://bit.ly/slicer-googlemeet-hosted-by-kitware) Agenda: Slicer 5 progress check-in Feel free to post to this thread to request/suggest a topic! Thanks Sam

I don’t recall that anyone worked on adding Subject Hierarchy support to the CLIs, probably because, as I mentioned, writing the CLI GUI in XML always resulted in clunky interfaces for anything other than the simplest workflows. I don’t think it would be hard to write a better GUI for the tractography measurements module (at least that’s what I’d do if I wanted to work on this).

@jhlegarreta note that with the Data Module you can right-click on a folder and choose Export to file and save all contents to a temp folder and then run the tractography analysis on them.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 18, 2023, 3:02pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/14 "2023-07-18T15:02:16Z")

</div>

> [@pieper](#):
>
> @jhlegarreta note that with the Data Module you can right-click on a folder and choose Export to file and save all contents to a temp folder and then run the tractography analysis on them.

Not sure I understand: if trying to launch the analysis on the loaded tractography data does not work, users should be warned about it or the feature should direct/force users to choose a directory. I still think that, as it is the case with other features, one would expect any processing/analysis to be applied to the data loaded into Slicer without needing to first export it to a folder.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 18, 2023, 8:53pm UTC](https://discourse.slicer.org/t/no-csv-file-in-diffusionmessurements-folder-in-wma/28439/15 "2023-07-18T20:53:44Z")

</div>

Yes, I agree - I was just suggesting a workraound.
