Coder Social home page Coder Social logo

Track specific bundles about tractseg HOT 10 CLOSED

mic-dkfz avatar mic-dkfz commented on August 19, 2024
Track specific bundles

from tractseg.

Comments (10)

wasserth avatar wasserth commented on August 19, 2024

So far there is no option to only track a specific bundle. You could adapt line 132 in bin/Tracking and give it a list containing only the bundles you want to e.g. bundles = ['CC_1', 'CC_2', 'CC_3', 'CC_4', 'CC_5', 'CC_6', 'CC_7']

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

Thanks!

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

Sorry, but I am completely new to this, so I have another question! How would you edit the bin/Tracking file in docker? I am assuming this is a file inside the docker container, but when I executed ls bin there was no file called Tracking.

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

The file is here /usr/local/bin/Tracking. Not sure if it works if you just edit it, because this is not the original source file, but the location where it was installed to by pip.
And I guess if you change it this change will not be saved in the docker container after exiting from the interactive session.
So unfortunately with docker it is not that easy. To make it properly you would have to rebuild the docker container and in the dockerfile install your own modified TractSeg version instead of the official TractSeg.
Would be easier without docker. Just change the source code. Then do pip install -e . inside of the source directory.

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

Just wanted to point out a potential bug - I ran TractSeg on a VMware CentOS 7 system with all the pre-requisites installed. Tractseg gave an error:

`[fsluser@localhost tractseg]$ TractSeg -i dwi.nii.gz --raw_diffusion_input --preprocess --verbose
Creating brain mask...
Moving input to MNI space...
Creating brain mask...
Creating peaks (1 of 3)...
Traceback (most recent call last):
  File "/home/fsluser/mrtrix3/bin/dwi2response", line 102, in <module>
    if int(image.statistic('mask.mif', 'count', '-mask mask.mif')) == 0:
ValueError: invalid literal for int() with base 10: '236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  236517  '
Creating peaks (2 of 3)...
dwi2fod: [ERROR] no data in matrix file "tractseg_output/response.txt"
dwi2fod: [ERROR] CSD algorithm expects second argument to be the input response function file
Creating peaks (3 of 3)...
sh2peaks: [ERROR] failed to open key/value file "tractseg_output/WM_FODs.mif": No such file or directory
sh2peaks: [ERROR] error opening image "tractseg_output/WM_FODs.mif"
Traceback (most recent call last):
  File "/usr/bin/TractSeg", line 303, in <module>
    main()
  File "/usr/bin/TractSeg", line 201, in main
    data_img = nib.load(peak_path)
  File "/usr/lib/python2.7/site-packages/nibabel/loadsave.py", line 42, in load
    raise FileNotFoundError("No such file or no access: '%s'" % filename)
nibabel.py3k.FileNotFoundError: No such file or no access: 'tractseg_output/peaks.nii.gz'

`
After finding this post on the Mrtrix forum, and responses to it, I was able to figure out what was happening. When running the TractSeg command, inside the dwi2response-tmp directory, files called dwi.mif and mask.mif are created. From what I understand, mask.mif is FSL-generated nodif_brain_mask.nii.gz copied. When I run mrstats:

[fsluser@localhost dwi2response-tmp-SXSIY2]$ mrstats dwi.mif -info
mrstats: [INFO] opening image "dwi.mif"...
mrstats: [INFO] image "dwi.mif" opened with dimensions 90x108x90x48, voxel spacing 2x2x2x7.2000000000000002, datatype Float32LE

[fsluser@localhost dwi2response-tmp-SXSIY2]$ mrstats mask.mif -info
mrstats: [INFO] opening image "mask.mif"...
mrstats: [INFO] image "mask.mif" opened with dimensions 90x108x90x55, voxel spacing 2x2x2x7.2000000000000002, datatype Bit

The dimensions of dwi.mif and mask.mif are different which might be causing the problem.

I commented out lines 87, 88, 95-99 in dwi2response, essentially forcing Mrtrix to generate its own mask.mif and that has solved the error.

However, due to memory errors, I wasn't able to run the complete TractSeg command and track specific bundles according to your suggestion above. On to that now!

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

I was not able to reproduce this problem. When running on ubuntu 16.04 and using mrtrix 3.0 RC3 and fsl build 509 it works fine.

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

I don't know if it has got anything to do with the fact that I'm running TractSeg on a virtual machine - it is the VMWare CentOS 7 installation that comes with FSL download; and with Mrtrix 3.0 RC3 as well.

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

The file is here /usr/local/bin/Tracking. Not sure if it works if you just edit it, because this is not the original source file, but the location where it was installed to by pip.
And I guess if you change it this change will not be saved in the docker container after exiting from the interactive session.
So unfortunately with docker it is not that easy. To make it properly you would have to rebuild the docker container and in the dockerfile install your own modified TractSeg version instead of the official TractSeg.
Would be easier without docker. Just change the source code. Then do pip install -e . inside of the source directory.

This works; I can now track just the corpus callosum. I also wanted to ask if there is a way to do something similar for the TractSeg command - while creating the endings_segmentations, bundle_segmentations etc.. Is there a way to segment just the corpus callosum? I have been looking at the code but couldn't figure it out. This is just to save time if possible since I plan to do some batch processing on a lot of images.

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

TractSeg is segmenting all bundles / bundle-endings at the same time. Doing only one bundle would not reduce the runtime.

from tractseg.

suryaR-15 avatar suryaR-15 commented on August 19, 2024

Ok, thanks!

from tractseg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.