# How to perform the UKFTractography via command line on ubuntu 20.04?

**URL:** https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657
**Category:** Support
**Tags:** tractography
**Created:** [July 18, 2023, 3:03pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657 "2023-07-18T15:03:34Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [July 18, 2023, 3:03pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/1 "2023-07-18T15:03:34Z")

</div>

I want to use .sh to batch process my data via UKFTractography ,so maybe I must use the command line of it.How could I do?

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [July 18, 2023, 3:03pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/2 "2023-07-18T15:03:55Z")

</div>

I want to use the UKFTractography singlely in order to use batch process on my data for tractography.  
when I make the code UKFTractography from github,I met the problem.  
I use the correct command from author.  
fatal: not a git repository (or any of the parent directories): .git  
make[5]: \*\*\* [ukf/CMakeFiles/\_GEN\_GITVER.dir/build.make:60: ukf/CMakeFiles/_GEN_  
make[4]: \*\*\* [CMakeFiles/Makefile2:1043: ukf/CMakeFiles/\_GEN\_GITVER.dir/all] Err  
make[3]: \*\*\* [Makefile:141: all] Error 2  
make[2]: \*\*\* [CMakeFiles/UKFTractography.dir/build.make:119: UKFTractography-prey-build] Error 2  
make[1]: \*\*\* [CMakeFiles/Makefile2:123: CMakeFiles/UKFTractography.dir/all] Erro  
make: \*\*\* [Makefile:95: all] Error 2

---

<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:52pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/3 "2023-07-18T20:52:14Z")

</div>

You should be able to just install SlicerDMRI and then you can run something like `Slicer --launch UKFTractography`. If you run through the GUI first you can see the command line arguments in the log and adjust them as needed for your script.

This is just a one-off script I did to process a bunch of dicom diffusion studies but it may give you some ideas: [https://github.com/SlicerDMRI/SlicerDMRI/blob/batchtract/Modules/Scripted/BatchTract/BatchTract.py#L292-L384](https://github.com/SlicerDMRI/SlicerDMRI/blob/batchtract/Modules/Scripted/BatchTract/BatchTract.py#L292-L384)

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [July 19, 2023, 1:25am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/4 "2023-07-19T01:25:07Z")

</div>

OK,thank u very much.I’m trying.Are there some methods that I could use the command line to use the UKFtractography via Slicer5.22?

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [July 19, 2023, 1:30am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/5 "2023-07-19T01:30:21Z")

</div>

And I have tried the command line to use the Slicer,but there is no difference.I couldn’t find some thing named UKFTractography in SlicerDMRI.

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [July 19, 2023, 1:34am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/6 "2023-07-19T01:34:49Z")

</div>

Couldn’t I use ./UKFTractography in Slicer’s directory?like:  
(base) ubuntu@dmri:~/tools/Slicer/NA-MIC/Extensions-31382/UKFTractography/lib/Slicer-5 .2/cli-modules$ ./UKFTractography --help  
./UKFTractography: error while loading shared libraries: libITKFactoryRegistration.so: cannot open shared object file: No such file or directory  
(base) ubuntu@dmri:~/tools/Slicer/NA-MIC/Extensions-31382/UKFTractography/lib/Slicer-5 .2/cli-modules$

---

<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 19, 2023, 2:59pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/7 "2023-07-19T14:59:20Z")

</div>

Since the CLI module is in an extension you need to use a command like this:

```auto
~/Downloads/Slicer-5.2.2-linux-amd64/Slicer --launch bash -c UKFTractography

```

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [October 14, 2023, 7:11am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/8 "2023-10-14T07:11:00Z")

</div>

Thank you very much! Hi pieper,when I use the command how could I indicate the input files and output files?  
Because I want to use the Slicer to generate the mask and .nrrd file of bvec bval nii.  
the Error occured like the following :

“Error! Must indicate DWI data, mask and tracts output files!”

---

<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: [October 14, 2023, 5:26pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/9 "2023-10-14T17:26:42Z")

</div>

I think you mean that you have bval/bvec filts and you need .nrrd files for UKF?

You can find converter code here: [GitHub - pnlbwh/conversion: Various mri conversion/modification scripts](https://github.com/pnlbwh/conversion)

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [October 15, 2023, 8:44am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/10 "2023-10-15T08:44:06Z")

</div>

I mean this command “~/Downloads/Slicer-5.2.2-linux-amd64/Slicer --launch bash -c UKFTractography” how could I input the DWI data, mask and seeds files？

---

<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: [October 15, 2023, 9:54pm UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/11 "2023-10-15T21:54:36Z")

</div>

The easiest way to do that is to run the process via the user interface and look at the log file. You’ll see the command line arguments and you need to map those to the files you use.

---

<div class="post-metadata">

### Author: ![dazhangge-666](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dazhangge-666/32/66865_2.png) [@dazhangge-666](https://discourse.slicer.org/u/dazhangge-666)
#### Post date: [October 16, 2023, 3:36am UTC](https://discourse.slicer.org/t/how-to-perform-the-ukftractography-via-command-line-on-ubuntu-20-04/30657/13 "2023-10-16T03:36:42Z")

</div>

Thank you very much!I got this!
