# FiberTractMeasurements not writing to output file

**URL:** <https://discourse.slicer.org/t/fibertractmeasurements-not-writing-to-output-file/3953>\
**Category:** Support\
**Created:** [August 30, 2018, 4:04pm UTC](https://discourse.slicer.org/t/fibertractmeasurements-not-writing-to-output-file/3953 "2018-08-30T16:04:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saba\_Shahab](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Saba\_Shahab](https://discourse.slicer.org/u/Saba_Shahab)\
**Post date:** [August 30, 2018, 4:04pm UTC](https://discourse.slicer.org/t/fibertractmeasurements-not-writing-to-output-file/3953/1 "2018-08-30T16:04:32Z")

</div>

Operating system:  
NAME=“Ubuntu”  
VERSION=“16.04.3 LTS (Xenial Xerus)”  
ID=ubuntu  
ID\_LIKE=debian  
PRETTY\_NAME=“Ubuntu 16.04.3 LTS”  
VERSION\_ID=“16.04”

Slicer version:  
slicer nightly version (updated as of 2018-08-20)

Hi,

I’m running the following code - it runs through without error but it doesn’t write the output in the output file.

`FiberTractMeasurements --outputfile $outputfolder/FiberMeasurements/$filename/$hemisphere --inputdirectory $outputfolder/AppendClusters/'OutliersPerSubject_'$filename/$hemisphere -i Fibers_File_Folder --separator Tab -f Column_Hierarchy`

---

<div class="post-metadata">

**Author:** ![Saba\_Shahab](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Saba\_Shahab](https://discourse.slicer.org/u/Saba_Shahab)\
**Post date:** [August 30, 2018, 4:25pm UTC](https://discourse.slicer.org/t/fibertractmeasurements-not-writing-to-output-file/3953/2 "2018-08-30T16:25:09Z")

</div>

I just realized that the script doesn’t work properly when the parent directory does not exist. I just created the parent directory and the code is running successfully. I think the code should be modified to either give an error message or create the directory if it does not exist.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [September 4, 2018, 7:56pm UTC](https://discourse.slicer.org/t/fibertractmeasurements-not-writing-to-output-file/3953/3 "2018-09-04T19:56:58Z")

</div>

> [@Saba\_Shahab](#):
>
> I just realized that the script doesn’t work properly when the parent directory does not exist. I just created the parent directory and the code is running successfully. I think the code should be modified to either give an error message or create the directory if it does not exist.

Fixed [here](https://github.com/SlicerDMRI/SlicerDMRI/commit/c5bd757caef622c1d2e402e64473535a86b0b7c9). From the next nightly version, it should raise an error.

I don’t think there is a good way to check/create intermediate paths before opening a file in the current C++ version we are using ( ~~without adding a new library dependency~~ edit: actually I guess we could use vtksys, but the second point still applies), and in any case, doing so without warning might be unwelcome in some circumstances.

Thanks for the report.
