mic-dkfz / tractseg Goto Github PK
View Code? Open in Web Editor NEWAutomatic White Matter Bundle Segmentation
License: Apache License 2.0
Automatic White Matter Bundle Segmentation
License: Apache License 2.0
First of all, thanks for this great tool!
One quick question. Following instructions as per https://github.com/MIC-DKFZ/TractSeg/blob/master/resources/Tractometry_documentation.md WITHOUT NORMALIZING TO MNI SPACE will still allow me to get the 20 nodes for each tract (in native space) in all my subjects.
AFQ defines the tracts in native space to ultimately 'project' the tract-profiles in MNI space (I guess). Is there a reason why you are suggesting to run the tractometry in MNI space for display purpose?
Thanks a lot!!
Amelia
Hi, is it possible to perform tractography via --track
or --only_track
after the TOM segmentations have already been calculated by feeding existing TOM paths to the command?
We noticed that it shows errors since it generates a new tract_seg_output folder in which it can't find the TOMs because they are in a different output folder from a previous calculation.
With that option we could save time and wouldn't have to calculate the TOMs again.
Best, Lucius
@wasserth Thank you for adding the --nr_cpus option (#13 (comment))
However, it looks like this option is not propagated to various commands that TractSeg runs internally. One such command that I noticed was the dwi2response.
dwi2response has the following option
-nthreads number
Use this number of threads in MRtrix multi-threaded applications (0
disables multi-threading)
I believe nr_cpus option should be used to set this parameter?
Hi,
Just wondering if there is a way that I can use TractSeg to track only specific bundles, e.g. only the corpus callosum. I am studying the corpus callosum and it seems unnecessary to have to wait till the code has tracked all fibre bundles, to analyse just one tract.
Thanks,
Surya
Hi, I have downloaded the HCP_105 data for training my own model.
For the second step, should I put these 144 bundle masks together to get the files named bundle_masks.nii.gz (Reference bundle masks; shape: [x,y,z,nr_bundles])
?
What's more, for the third step, I don't know if the data has been preprocessed. Is whether I'm going to preprocess the data using tractseg/data/preprocessing.py to remove all non-brain area (crop to brain bounding box). Adapt the data pathes in tractseg/data/preprocessing.py to fit your data (look for #todo: adapt inside of the file.)
Hi,
I am trying to run the TractSeg project using the following command:
/NAS/tupac/renaud/softwares/TractSegmentation/TractSeg-master/examples$ TractSeg -i Diffusion.nii.gz --verbose
I am using Python 2.7 and installed pytorch from conda.
I get the following error:
Creating brain mask...
Creating peaks (1 of 3)...
Creating peaks (2 of 3)...
Creating peaks (3 of 3)...
Loading weights from: /home/renaud/.tractseg/pretrained_weights_tract_segmentation_v1.npz
Loading weights ... (/home/renaud/.tractseg/pretrained_weights_tract_segmentation_v1.npz)
Traceback (most recent call last):
File "/home/global/anaconda2/bin/TractSeg", line 122, in
bundle_specific_threshold=args.bundle_specific_threshold, get_probs=args.get_probabilities)
File "/home/global/anaconda2/lib/python2.7/site-packages/tractseg/TractSeg.py", line 123, in run_tractseg
model = BaseModel(HP)
File "/home/global/anaconda2/lib/python2.7/site-packages/tractseg/models/BaseModel.py", line 75, in init
self.create_network()
File "/home/global/anaconda2/lib/python2.7/site-packages/tractseg/models/BaseModel.py", line 265, in create_network
load_model(join(self.HP.EXP_PATH, self.HP.WEIGHTS_PATH))
File "/home/global/anaconda2/lib/python2.7/site-packages/tractseg/models/BaseModel.py", line 206, in load_model
PytorchUtils.load_checkpoint(path, unet=net)
File "/home/global/anaconda2/lib/python2.7/site-packages/tractseg/libs/PytorchUtils.py", line 34, in load_checkpoint
checkpoint = torch.load(path, map_location=lambda storage, loc: storage)
File "/home/global/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 358, in load
return _load(f, map_location, pickle_module)
File "/home/global/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 532, in _load
magic_number = pickle_module.load(f)
cPickle.UnpicklingError: invalid load key, '<'.
The model file exists and I have the following files in "tractseg_output" folder:
nodif_brain_mask.nii.gz
peaks.nii.gz
response.txt
WM_FODs.mif
Do you think I have an installation issue ?
Kindly let me know what I need to do so that I can use the model.
Renaud
We are having a trouble opening generated .trk files with tractvis. The .trk file loads but I don't see it displayed anywhere.
track_vis command shows the volume dimension to be all-0
$ ./track_vis CA.trk -l 20
Reading CA.trk ...done
Number of tracks: 2000
Number of tracks to render: 2000
Number of line segments to render: 33812
Mean track length: 68.81 +/- 15.16 mm
Volume dimension: 0 0 0
Voxel size: 1.250 1.250 1.250
Can not load camera info from tmp.cam
I am wondering if affine information is properly stored on generated .trk files.
Thanks for your work, and it works pretty well by using pretrained model. However, the loss become minus when I train my own model.
First, I generated the peak.nii.gz by using the command you provided, and converted the tract to volume, which is provided on Zenodo. Then I mated all bundles(72) into one 4D img.
After that, I adapted my_custom_experiment.py AND ~/.tractseg/config.txt .
Due to the HCP data, the following functions are not changed
tractseg.libs.DatasetUtils.scale_input_to_unet_shape()
tractseg.libs.exp_utils.get_bundle_names()
tractseg.libs.exp_utils.get_labels_filename()
tractseg.libs.Subjects
Here is my hyperparameters
{'BATCH_NORM': False,
'BATCH_SIZE': 47,
'BEST_EPOCH': 0,
'CALC_F1': True,
'CLASSES': 'All',
'CSD_RESOLUTION': 'LOW',
'CV_FOLD': 0,
'DATASET': 'HCP',
'DATASET_FOLDER': 'HCP',
'DATA_AUGMENTATION': False,
'DAUG_ELASTIC_DEFORM': True,
'DAUG_FLIP_PEAKS': False,
'DAUG_INFO': 'Elastic(90,120)(9,11) - Scale(0.9, 1.5) - CenterDist60 - '
'DownsampScipy(0.5,1) - Gaussian(0,0.05) - Rotate(-0.8,0.8)',
'DAUG_MIRROR': False,
'DAUG_NOISE': True,
'DAUG_RESAMPLE': True,
'DAUG_ROTATE': False,
'DAUG_SCALE': True,
'DIM': '2D',
'DROPOUT_SAMPLING': False,
'EPOCH_MULTIPLIER': 1,
'EXPERIMENT_TYPE': 'tract_segmentation',
'EXP_MULTI_NAME': '',
'EXP_NAME': 'my_custom_experiment',
'EXP_PATH': 'XXX/hcp_exp/my_custom_experiment_x2',
'FEATURES_FILENAME': 'peaks',
'FLIP_OUTPUT_PEAKS': True,
'GET_PROBS': False,
'INFO': '-',
'INPUT_DIM': (144, 144),
'KEEP_INTERMEDIATE_FILES': False,
'LABELS_FILENAME': 'bundle_masks',
'LABELS_FOLDER': 'bundle_masks',
'LEARNING_RATE': 0.001,
'LOAD_WEIGHTS': False,
'LOSS_FUNCTION': 'default',
'LOSS_WEIGHT': 1,
'LOSS_WEIGHT_LEN': -1,
'LR_SCHEDULE': False,
'MODEL': 'UNet_Pytorch',
'MULTI_PARENT_PATH': 'XXX/hcp_exp/',
'NORMALIZE_DATA': True,
'NORMALIZE_PER_CHANNEL': False,
'NR_CPUS': -1,
'NR_OF_CLASSES': 72,
'NR_OF_GRADIENTS': 9,
'NR_SLICES': 1,
'NUM_EPOCHS': 250,
'OPTIMIZER': 'Adamax',
'OUTPUT_MULTIPLE_FILES': False,
'PEAK_DICE_LEN_THR': 0.05,
'PEAK_DICE_THR': [0.95],
'PREDICT_IMG': False,
'PREDICT_IMG_OUTPUT': None,
'PRINT_FREQ': 20,
'RESET_LAST_LAYER': False,
'RESOLUTION': '1.25mm',
'SAVE_WEIGHTS': True,
'SEGMENT': False,
'SEG_INPUT': 'Peaks',
'SLICE_DIRECTION': 'y',
'TEST': False,
'TEST_TIME_DAUG': False,
'THRESHOLD': 0.5,
'TRACTSEG_DIR': 'tractseg_output',
'TRAIN': True,
'TRAINING_SLICE_DIRECTION': 'xyz',
'TYPE': 'single_direction',
'UNET_NR_FILT': 64,
'UPSAMPLE_TYPE': 'bilinear',
'USE_DROPOUT': False,
'USE_VISLOGGER': False,
'VERBOSE': True,
'WEIGHTS_PATH': '',
'WEIGHT_DECAY': 0}
To solve the bugs, I changed 2 lines
FIRST:
trainer.py 164
from
metrics = metric_utils.calculate_metrics(metrics, None, None, loss, f1=np.mean(f1), type=type,
threshold=Config.THRESHOLD)
to
peak_f1_mean = np.array([s.item() for s in f1]).mean()
metrics = metric_utils.calculate_metrics(metrics, None, None, loss, f1=peak_f1_mean, type=type,
threshold=Config.THRESHOLD)
for the error
'torch.dtype' object has no attribute 'type'
SECOND:
from
self.net = NetworkClass(n_input_channels=NR_OF_GRADIENTS, n_classes=self.Config.NR_OF_CLASSES,
n_filt=self.Config.UNET_NR_FILT, batchnorm=self.Config.BATCH_NORM,
dropout=self.Config.USE_DROPOUT, upsample=self.Config.UPSAMPLE_TYPE)
to
self.net = NetworkClass(n_input_channels=NR_OF_GRADIENTS, n_classes=self.Config.NR_OF_CLASSES,
n_filt=self.Config.UNET_NR_FILT, batchnorm=self.Config.BATCH_NORM,
dropout=self.Config.USE_DROPOUT)
for the error
TypeError: __init__() got an unexpected keyword argument 'upsample'
After these changes above, I can run, but the loss is minus
train Ep 0, Sp 940, loss -12.775692, t print 182.392s, t batch 9.12s
train Ep 0, Sp 1880, loss -444671.51571, t print 86.198s, t batch 4.31s
train Ep 0, Sp 2820, loss -2378428503.875, t print 87.207s, t batch 4.36s
train Ep 0, Sp 3760, loss -512482880699494.4, t print 86.612s, t batch 4.331s
train Ep 0, Sp 4700, loss -6.402550831420487e+18, t print 85.732s, t batch 4.287s
Is there anything that I missed or wrong?
Hi.
I am training my model. And I have installed batchgenerators-0.19.4. But I can't install FlipVectorAxisTransform. The error is as follows.
Collecting FlipVectorAxisTransform
ERROR: Could not find a version that satisfies the requirement FlipVectorAxisTransform (from versions: none)
ERROR: No matching distribution found for FlipVectorAxisTransform
How can I solve this problem?
I used to be able to output tracking output in .tck format by seeging "--tracking_format tck" command line parameter, but this option doesn't seem to exist anymore.
TractSeg: error: unrecognized arguments: --output_format tck
Do I need to manually convert .trk output to .tck now? I am using version 1.9
Hi, we're encountering faulty tracks when we feed previously calculated peaks and segmentations, as seen in the attached image. We tested with both .trk and .tck formats.
If we enter the command to calculate all data from scratch it works fine, but it unfortunately has to create the peaks and toms again.
Thanks Jakob once again for this great tool!!
I would like to further segment one of the 72 tracts based on cortical masks. Is there a way to do it with TractSeg?
Thanks a lot!! Amelia
Hello,
I'm using Docker Toolbox for Windows 7 to access TractSeg. The command does not read the input file when using tractsegcontainer:master and gives errors same as this user when using tractsegcontainer:v1.4.
I am a bit stumped since I am using Docker (containing all pre-requisites) but still getting these errors.
Would be glad if you could help with this!
Output screens:
docker@default:~$ ls /home/docker/tractseg
dwi.bvals dwi.bvecs dwi.nii.gz
docker@default:~$
docker@default:~$ sudo docker run -v /home/docker/tractseg -t wasserth/tractseg
_container:master TractSeg -i dwi.nii.gz --preprocess
INFO: font search path ['/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-d
ata/fonts/ttf', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/font
s/afm', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/pdfcor
efonts']
INFO: generated new fontManager
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 370, in <module>
main()
File "/usr/local/bin/TractSeg", line 252, in main
data_img = nib.load(peak_path)
File "/usr/local/lib/python2.7/dist-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: 'dwi.nii.gz'
docker@default:~$
docker@default:~$ sudo docker run -v /home/docker/tractseg -t wasserth/tractseg
_container:v1.4 TractSeg -i dwi.nii.gz --preprocess
usage: TractSeg [-h] -i filepath [-o directory] [--output_multiple_files]
[--csd_type csd|csd_msmt|csd_msmt_5tt]
[--output_type tract_segmentation|endings_segmentation|TOM|dm_re
gression]
[--bvals filename] [--bvecs filename] [--brain_mask filename]
[--verbose] [--skip_peak_extraction]
[--keep_intermediate_files] [--preview] [--flip]
[--single_orientation] [--bundle_specific_threshold]
[--get_probabilities] [--version]
TractSeg: error: unrecognized arguments: --preprocess
docker@default:~$
docker@default:~$ sudo docker run -v /home/docker/tractseg -t wasserth/tractseg
_container:v1.4 TractSeg -i dwi.nii.gz
Creating brain mask...
Error: input image dwi not valid
rm: cannot remove 'tractseg_output/nodif_brain_mask.nii.gz': No such file or dir
ectory
mv: cannot stat 'tractseg_output/nodif_brain_mask_mask.nii.gz': No such file or
directory
Creating peaks (1 of 3)...
dwi2response: [ERROR] Command failed: mrconvert /dwi.nii.gz - -strides 0,0,0,1 -
fslgrad /dwi.bvecs /dwi.bvals | dwiextract - /dwi2response-tmp-7QS2GT/dwi.mif -s
ingleshell -no_bzero (dwi2response:84)
dwi2response: Output of failed command:
mrconvert: [ERROR] input file "/dwi.bvecs" for option "-fslgrad" n
ot found
dwiextract: [ERROR] no filename supplied to standard input (broken
pipe?)
dwiextract: [ERROR] error opening image "-"
dwi2response: Script failed while executing the command: mrconvert /dwi.nii.gz -
-strides 0,0,0,1 -fslgrad /dwi.bvecs /dwi.bvals | dwiextract - /dwi2response-tm
p-7QS2GT/dwi.mif -singleshell -no_bzero
dwi2response: For debugging, inspect contents of temporary directory: /dwi2respo
nse-tmp-7QS2GT/
Creating peaks (2 of 3)...
dwi2fod: [ERROR] input file "dwi.bvecs" for option "-fslgrad" not found
Creating peaks (3 of 3)...
sh2peaks: [ERROR] failed to open key/value file "tractseg_output/WM_FODs.mif": N
o such file or directory
sh2peaks: [ERROR] error opening image "tractseg_output/WM_FODs.mif"
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 113, in <module>
data_img = nib.load(join(HP.PREDICT_IMG_OUTPUT, "peaks.nii.gz"))
File "/usr/local/lib/python2.7/dist-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/peak
s.nii.gz'
docker@default:~$
Please do let me know if you need more information. Thanks!
Hi @wasserth,
I've noticed that the 4D .nii.gz segmentations output masks have dimensions (146x174x146x72). I'm using HCP data and TractSeg version v1.9. In the function scale_input_to_world_shape
there is a scaling to those dimensions, while I guess it should be (145x174x145x72).
if resolution == "1.25mm":
if dataset == "HCP": # (144,144,144)
# no resize needed
return img_utils.pad_4d_image_left(img4d, np.array([1, 15, 1, 0]),
[146, 174, 146, img4d.shape[3]], pad_value=0) # (146, 174, 146, none)
Do you have an explanation for this?
Thank you!
Hello!
I am running TractSeg with --nr_cpus 8
. I've noticed that TractSeg doesn't even pass 200% cpu usage while it runs.
The following is the typical resource usage graph for app-tractseg
I am wondering if --nr_cpus is not properly applied, or maybe we are not using this option right?
TractSeg -i dwi.nii.gz --raw_diffusion_input \
--csd_type $(jq -r .csd config.json) \
--output_type tract_segmentation \
--keep_intermediate_files \
--postprocess \
--nr_cpus 8 \
-o . \
$opts
https://github.com/brainlife/app-tractseg/blob/1.7.1/run.sh#L35
Please comment!
If we use --output_type tract_segmentation
TractSeg seems to delete previously written wm_fods. Is there another possibility to keep those without moving them to a different location before using --output_type tract_segmentation
a second time? This would be helpful, since with our clinical data we sometimes need first to find the proper axis to flip which.
Hi.
When I used python interface, the RuntimeError occurred.
import nibabel as nib
import numpy as np
from tractseg.python_api import run_tractseg
peaks = nib.load("tests/reference_files/peaks.nii.gz").get_data()
segmentation = run_tractseg(peaks)
Loading weights from: /home/qilu/.tractseg/pretrained_weights_tract_segmentation_v2.npz
Traceback (most recent call last):
File "", line 1, in
File "tractseg/python_api.py", line 168, in run_tractseg
model = BaseModel(Config)
File "tractseg/models/base_model.py", line 116, in init
self.load_model(join(self.Config.EXP_PATH, self.Config.WEIGHTS_PATH))
File "tractseg/models/base_model.py", line 294, in load_model
pytorch_utils.load_checkpoint(path, unet=self.net)
File "tractseg/libs/pytorch_utils.py", line 36, in load_checkpoint
checkpoint = torch.load(path, map_location=lambda storage, loc: storage)
File "/home/qilu/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/serialization.py", line 368, in load
return _load(f, map_location, pickle_module)
File "/home/qilu/anaconda2/envs/pytorch/lib/python2.7/site-packages/torch/serialization.py", line 549, in _load
deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 5801749 more bytes. The file might be corrupted.
How should I modify it?
Dear TractSeg Developers:
Thanks for the wonderful new tool.
May I know if TractSeg is suitable for DSI? If so, any tweaks are needed?
Thanks.
Min
Dear @wasserth and Klaus,
Great work. We have an implementation running quite swiftly on brainlife.io: https://doi.org/10.25663/bl.app.95
Many thanks to Jakob for the help with this given to @soichih
We are looking for a complete list of full anatomical names for the 72 tracts. I see in your paper and on the README file a list of acronyms. Would you please be kind and share with us full names for the tracts? I post here because this might be of help to the users.
Best regards,
Franco
Hello,
Just wondering when tractometry code samples FA values along the tract, is this done is a pre-determined way? As in, is the sampling always done in anterior to posterior direction/ or superior-inferior?
The x-axis of the plot produced is 'position' - I was not quite clear how this maps to anatomical positions.
Thanks,
Surya
Hi.
When I run TractSeg -i Diffusion.nii.gz -o tractseg_output --raw_diffusion_input --csd_type csd_msmt_5tt --brain_mask nodif_brain_mask.nii.gz
, the following error occurs.
(pytorch) qilu@user-SYS-7048GR-TR:/data1/qilu/HCP105/599469/T1w/Diffusion$ TractSeg -i Diffusion.nii.gz -o tractseg_output --raw_diffusion_input --csd_type csd_msmt_5tt --brain_mask nodif_brain_mask.nii.gz
Creating peaks (1 of 4)...
5ttgen:
5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen:
5ttgen: Generated temporary directory: /data1/qilu/HCP105/599469/T1w/Diffusion/5ttgen-tmp-O35FDC/
mrinfo: [ERROR] cannot access file "/data1/qilu/HCP105/599469/T1w/Diffusion/T1w_acpc_dc_restore_brain.nii.gz": No such file or directory
mrinfo: [ERROR] error opening image "/data1/qilu/HCP105/599469/T1w/Diffusion/T1w_acpc_dc_restore_brain.nii.gz"
5ttgen: [ERROR] Could not access header information for image '/data1/qilu/HCP105/599469/T1w/Diffusion/T1w_acpc_dc_restore_brain.nii.gz'
5ttgen: Contents of temporary directory kept, location: /data1/qilu/HCP105/599469/T1w/Diffusion/5ttgen-tmp-O35FDC/
Creating peaks (2 of 4)...
dwi2response:
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response:
dwi2response: Generated temporary directory: /data1/qilu/HCP105/599469/T1w/Diffusion/dwi2response-tmp-X8FTEU/
Command: mrconvert /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.nii.gz /data1/qilu/HCP105/599469/T1w/Diffusion/dwi2response-tmp-X8FTEU/dwi.mif -strides 0,0,0,1 -fslgrad /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvecs /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvals
dwi2response:
dwi2response: [ERROR] Command failed: mrconvert /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.nii.gz /data1/qilu/HCP105/599469/T1w/Diffusion/dwi2response-tmp-X8FTEU/dwi.mif -strides 0,0,0,1 -fslgrad /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvecs /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvals (dwi2response:86)
dwi2response: Output of failed command:
mrconvert: [ERROR] input file "/data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvecs" for option "-fslgrad" not found
dwi2response:
dwi2response: Script failed while executing the command: mrconvert /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.nii.gz /data1/qilu/HCP105/599469/T1w/Diffusion/dwi2response-tmp-X8FTEU/dwi.mif -strides 0,0,0,1 -fslgrad /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvecs /data1/qilu/HCP105/599469/T1w/Diffusion/Diffusion.bvals
dwi2response: For debugging, inspect contents of temporary directory: /data1/qilu/HCP105/599469/T1w/Diffusion/dwi2response-tmp-X8FTEU/
Creating peaks (3 of 4)...
dwi2fod: [ERROR] input file "Diffusion.bvecs" for option "-fslgrad" not found
Creating peaks (4 of 4)...
sh2peaks: [ERROR] cannot access file "tractseg_output/WM_FODs.nii.gz": No such file or directory
sh2peaks: [ERROR] error opening image "tractseg_output/WM_FODs.nii.gz"
Traceback (most recent call last):
File "/home/qilu/anaconda2/envs/pytorch/bin/TractSeg", line 382, in
main()
File "/home/qilu/anaconda2/envs/pytorch/bin/TractSeg", line 253, in main
data_img = nib.load(peak_path)
File "/home/qilu/anaconda2/envs/pytorch/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'
Hi. I try to train the model using the first 11 HCP subjects. When I run ExpRunner --config My_custom_experiment
, I meet the following error.
At first I thought there was a difference between python2 and python3 on the iterator. So I changed the __next__
function to next
function. Then the error changed to this.
So how can I corrcet the first error or the second error?
If I want to train my own model, I need files named bundle_masks.nii.gz (Reference bundle masks; shape: [x,y,z,nr_bundles])
. But I have only 144 independent bundle masks after running TractSeg. Should I put these 144 bundle masks together to get the shape: [x,y,z,nr_bundles]?
Hi, I'm testing with a clinical data set of a tumor patient. I noticed that when feeding a preprocessed and upscaled Diffusion.nii.gz
file and it's bvecs/bvals
, the results are slightly better (after dwidenoise
, mrdegibbs
, dwipreproc
, dwibiascorrect
(ants), mrresize
(1.25 voxel size) in the respective order).
Still, the bundle_segmentation
files are partly empty or incomplete but not necessarily at the tumor location where one would assume interruption or difficulties.
Manually, fibers are traceable at the interrupted areas.
Can you provide a hint?
(I'll continue testing on different tumor patients.)
Best, Lucius
I've installed TractSeg by doing
pip install https://github.com/MIC-DKFZ/TractSeg/archive/v1.5.zip
When I run TractSeg with --preprocess option, it fails with following error message.
Moving input to MNI space...
Image Exception : #22 :: ERROR: Could not open image /usr/local/lib/python2.7/dist-packages/tractseg/libs/../../examples/resources/MNI_FA_template
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Image Exception : #22 :: ERROR: Could not open image /usr/local/lib/python2.7/dist-packages/tractseg/libs/../../examples/resources/MNI_FA_template
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Is something wrong with the way TractSeg wheel is installed? I don't see "examples" directory under dist-packages directory.
hayashis@gpu1-pestillilab:/usr/local/lib/python2.7/dist-packages 2 ls -la examples
ls: cannot access 'examples': No such file or directory
hayashis@gpu1-pestillilab:/usr/local/lib/python2.7/dist-packages 2 ls -la tractseg/
total 48
drwxr-sr-x 6 hayashis hayashis 4096 Sep 26 16:00 .
drwxrwsr-x 74 hayashis hayashis 4096 Sep 26 17:10 ..
-rw-r--r-- 1 hayashis hayashis 9516 Sep 26 16:00 TractSeg.py
-rw-r--r-- 1 hayashis hayashis 6010 Sep 26 16:00 TractSeg.pyc
-rw-r--r-- 1 hayashis hayashis 0 Sep 26 16:00 __init__.py
-rw-r--r-- 1 hayashis hayashis 146 Sep 26 16:00 __init__.pyc
drwxr-sr-x 4 hayashis hayashis 4096 Sep 26 16:00 config
drwxr-sr-x 2 hayashis hayashis 4096 Sep 26 16:00 libs
drwxr-sr-x 4 hayashis hayashis 4096 Sep 26 16:00 models
drwxr-sr-x 2 hayashis hayashis 4096 Sep 26 16:00 tests
Hi,
After having to reset my PC, I installed TractSeg again (installation was successful). However, on trying to run some Tractometry codes, the following error comes up:
Traceback (most recent call last):
File "/usr/bin/Tractometry", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/home/fsluser/Documents/TractSeg-1.9/bin/Tractometry", line 28, in <module>
from dipy.tracking.utils import move_streamlines
ImportError: cannot import name 'move_streamlines'
I checked the file utils.py
in python/site-packages/dipy/tracking/
and the function move_streamlines()
is no longer in there. I was wondering what is happening here.
Hi.
When I train my own model, I use this command TractSeg -i data.nii.gz -o tractseg_output --raw_diffusion_input --csd_type csd_msmt --brain_mask nodif_brain_mask.nii.gz --bvals bvals --bvecs bvecs
to get peaks.
When it meets dwi2fod
and sh2peaks
command, I always use all cpus. Is this reasonable?
Is this the right way of training model to get the mrtrix_peaks.nii.gz (mrtrix CSD peaks; shape: [x,y,z,9])
?
Dear TractSeg community,
I am using diffusion data with a b=1000 shell and 30 directions. On the tutorial, it is written (if I understood clearly) that for data with poor resolution, the Tracking
command should be executed with its default behavior, i.e. tracking is performed on peaks, which i did. But I also tried Tracking
with the --track_FODs iFOD2
option, i.e. tracking is performed on FOD.
On the image below, you can see the corticospinal tract with tracking performed on peaks on the left, and corticospinal tract with tracking performed on FOD on the right.
The FOD-tracking looks more... noisy? while it manages to capture fibers that look like they should belong to the CST (the lateral branch and the dorsal fibers of the tract are more complete), comparatively to the peaks-Tracking. For the latter method, it looks like the CST is incomplete.
Below is an image of the CST + AF with peaks-tracking on the left and FOD-tracking on the right.
As you can see, for peaks-tracking, these two tracts have little overlap (white voxels) comparatively to the FOD-tracking method.
Do you have any insights of what could I do to obtain what would appear as an ideal middle ground, i.e. a complete CST (i.e., FOD-tracking), but not too noisy (i.e., peaks-Tracking)?
I also have another dataset with high-resolution multishell data. In this case, which Tracking method should be preferred?
Thanks a lot for your help.
Is there a way to prestage those pretrained_weights_peak_regression_partX_v1.npz
files that gets loaded when I run with --output_type endings_segmentation
? I am running TractSeg via singularity and singularity doesn't let me write to the container image (without going through some hoops) at runtime. It would make it easier if I could prestage those files just like other files that I am prestaging on Dockerfile.
RUN curl -SL -o /.tractseg/pretrained_weights_tract_segmentation_v2.npz https://zenodo.org/record/1410884/files/best_weights_ep274.npz?download=1 \
&& curl -SL -o /.tractseg/pretrained_weights_tract_segmentation_dropout_v2.npz https://zenodo.org/record/1414130/files/best_weights_ep407.npz?download=1 \
&& curl -SL -o /.tractseg/pretrained_weights_endings_segmentation_v3.npz https://zenodo.org/record/1409670/files/EndingsSeg_best_weights_ep234.npz?download=1 \
&& curl -SL -o /.tractseg/pretrained_weights_peak_regression_v2.npz https://zenodo.org/record/1419198/files/best_weights_ep125.npz?download=1 \
&& curl -SL -o /.tractseg/pretrained_weights_dm_regression_v1.npz https://zenodo.org/record/1409676/files/DmReg_best_weights_ep427.npz?download=1
I am hoping I could just add pretrained_weights_peak_regression files in the list above? Is that possible?
Hello!
I am trying to run TractSeg via singularity like the following
singularity exec -e docker://gkoehler90/tractseg TractSeg -i dwi.nii.gz
I have following files in my local directory.
hayashis@xps15:~/test/tractseg $ ls -lrt
total 1461344
-rw-r--r-- 1 hayashis hayashis 9507 Jun 25 13:26 dwi.bvecs
-rw-r--r-- 1 hayashis hayashis 1631 Jun 25 13:26 dwi.bvals
-rw-r--r-- 1 hayashis hayashis 1496386061 Jun 25 13:26 dwi.nii.gz
When I run it, I get following error messages.
Loading weights from: /home/hayashis/.tractseg/pretrained_weights_tract_segmentation_v1.npz
Creating brain mask...
sh: 1: bet: not found
rm: cannot remove 'tractseg_output/nodif_brain_mask.nii.gz': No such file or directory
mv: cannot stat 'tractseg_output/nodif_brain_mask_mask.nii.gz': No such file or directory
Creating peaks (1 of 3)...
sh: 1: dwi2response: not found
Creating peaks (2 of 3)...
sh: 1: dwi2fod: not found
Creating peaks (3 of 3)...
sh: 1: sh2peaks: not found
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 137, in <module>
data_img = nib.load(join(HP.PREDICT_IMG_OUTPUT, "peaks.nii.gz"))
File "/usr/local/lib/python2.7/dist-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'
On my current directory, I see an empty directory created with the name "tracseg_output".
hayashis@xps15:~/test/tractseg 1 ls -la
total 1461356
drwxrwxr-x 3 hayashis hayashis 4096 Jun 25 13:31 .
drwxrwxr-x 46 hayashis hayashis 4096 Jun 25 12:15 ..
-rw-r--r-- 1 hayashis hayashis 1631 Jun 25 13:26 dwi.bvals
-rw-r--r-- 1 hayashis hayashis 9507 Jun 25 13:26 dwi.bvecs
-rw-r--r-- 1 hayashis hayashis 1496386061 Jun 25 13:26 dwi.nii.gz
drwxrwxr-x 2 hayashis hayashis 4096 Jun 25 13:31 tractseg_output
hayashis@xps15:~/test/tractseg $ ls -a tractseg_output/
. ..
Am I running this in a wrong way?
Hi, I'm new to using TractSeg. I tried to do bundle segmentation of the example provided by TractSeg as follow:
Mudathirs-MacBook-Pro:~ mudathirsalman$ ls examples
Diffusion.bvals Tests
Diffusion.bvecs example_output.nii.gz
Diffusion.nii.gz resources
Diffusion_mrtrix_peaks.nii.gz
But I got the following error:
Mudathirs-MacBook-Pro:/ mudathirsalman$ TractSeg -i /examples/Diffusion.nii.gz
Creating brain mask...
Error: input image /examples/Diffusion not valid
rm: /examples/tractseg_output/nodif_brain_mask.nii.gz: No such file or directory
mv: rename /examples/tractseg_output/nodif_brain_mask_mask.nii.gz to /examples/tractseg_output/nodif_brain_mask.nii.gz: No such file or directory
Creating peaks (1 of 3)...
Traceback (most recent call last):
File "/Users/mudathirsalman/mrtrix3/bin/dwi2response", line 80, in
app.makeTempDir()
File "/Users/mudathirsalman/mrtrix3/lib/mrtrix3/app.py", line 226, in makeTempDir
dir_path = dict.get('ScriptTmpDir', workingDir)
TypeError: descriptor 'get' requires a 'dict' object but received a 'str'
Creating peaks (2 of 3)...
dwi2fod: [ERROR] input file "/examples/Diffusion.bvecs" for option "-fslgrad" not found
Creating peaks (3 of 3)...
sh2peaks: [ERROR] failed to open key/value file "/examples/tractseg_output/WM_FODs.mif": No such file or directory
sh2peaks: [ERROR] error opening image "/examples/tractseg_output/WM_FODs.mif"
Traceback (most recent call last):
File "/Users/mudathirsalman/anaconda3/bin/TractSeg", line 109, in
data_img = nib.load(join(HP.PREDICT_IMG_OUTPUT, "peaks.nii.gz"))
File "/Users/mudathirsalman/anaconda3/lib/python3.6/site-packages/nibabel/loadsave.py", line 40, in load
raise FileNotFoundError("No such file: '%s'" % filename)
FileNotFoundError: No such file: '/examples/tractseg_output/peaks.nii.gz'
I checked FSL and MRtrix all are working fine. I wonder where was my mistake. Thanks
Dear Jakob (and other developers),
First of all, thanks for making this wonderful tool available for the community!
I'm using the latest version of TractSeg (1.9) in an anaconda3 environment on Ubuntu 18.04 (64bit). Usually I can run it with no problems on HCP data (7T diffusion), however now I use the following command:
TractSeg -i /path/to/dwi.nii.gz -o /path/to/outdir --raw_diffusion_input
and get the following FileNotFoundError:
No such file or no access: 'outdir/peaks.nii.gz'
And indeed, the peaks file is not being created.
Such an error was raised by another user in a closed issue, however I wasn't able to resolve it.
Do you have an idea what might cause this?
Many thanks,
Best,
Roey
Following the instructions (https://github.com/MIC-DKFZ/TractSeg/#install), I installed TractSeg and tried to run it, but could not because the current version of DiPy does not have the move_streamlines() function in dipy.tracking.utils. I tried to fix this by creating a new virtual environment without DiPy, but the installation of TractSect failed to download the required function from DiPy. This function is something that has been removed from the most recent release of DiPy. See below the error message I got after calling 'TractSeg' after installation.
Traceback (most recent call last):
File "/home/leevi/anaconda3/envs/tractseg/bin/TractSeg", line 38, in
from tractseg.libs import mrtrix
File "/home/leevi/anaconda3/envs/tractseg/lib/python3.7/site-packages/tractseg/libs/mrtrix.py", line 29, in
from tractseg.libs import tracking
File "/home/leevi/anaconda3/envs/tractseg/lib/python3.7/site-packages/tractseg/libs/tracking.py", line 9, in
from dipy.tracking.utils import move_streamlines
ImportError: cannot import name 'move_streamlines' from 'dipy.tracking.utils' (/home/leevi/anaconda3/envs/tractseg/lib/python3.7/site-packages/dipy/tracking/utils.py)
Is there something that I am missing?
Dear Jakob,
First of all, thanks for this great tool!
Using the documentation, I was able to create bundles and extract FA values for most of my sample.
However, sometimes a subject does not have 1 bundle (for example, the ICP_right - "tract endings mask of ICP_right empty" ) and it does not seem like Tractometry can give me the .csv output with the 71 available. I'm not particularly interested in this bundle now, so I would rather use all the rest at this point.
Is there a way to do that?
Thanks!!
João Paulo
Hi, I want to generate binary masks from the reference tracts provided here https://zenodo.org/record/1477956#.XOu-tdMzbBI
Could you please share the pipeline (tools you used) for the generation of binary tract masks (Step 5 in the paper) from the final streamlines?
Hi, after following the tutorial we now receive following error after completion of the 4th step of loading the weights. We tried it on our ubuntu 16.04 LTS system as well as on a macbook pro with Mojave 10.14. It occurs after the 3rd command in the tutorial TractSeg -i tractseg_output/peaks.nii.gz -o . --output_type TOM --track --filter_tracking_by_endpoints
. We used HCP data.
Tracking...
Traceback (most recent call last):
File "/home/bwgig/anaconda2/bin/TractSeg", line 202, in <module>
output_format=args.tracking_format)
File "/home/bwgig/anaconda2/lib/python2.7/site-packages/tractseg/libs/Mrtrix.py", line 172, in track
" -include " + tmp_dir + "/" + bundle + "_e.nii.gz" +
TypeError: cannot concatenate 'str' and 'NoneType' objects
Hi. I was trying to troubleshoot this error message.
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 196, in <module>
output_format=args.tracking_format)
File "/usr/local/lib/python2.7/dist-packages/tractseg/libs/Mrtrix.py", line 178, in track
" -include " + tmp_dir + "/" + bundle + "_e.nii.gz" +
TypeError: cannot concatenate 'str' and 'NoneType' objects
For some reason, I had to set --brain_mask testdata/mask.nii.gz
when I am running it with --track on one of our HPC system but works fine without it on Ubuntu 16 machine. (We are running via singularity so it shouldn't really matter..)
Even with --brain option set, TractSeg fails with OOM on our HCP system.
=>> PBS: job killed: vmem 289836974080 exceeded limit 68719476736
Here is the content of my testdata
hayashis@carbonate(h2):/N/dc2/scratch/hayashis/tractseg/testdata(master*) $ ls -lrt
total 1477428
-rwxr-xr-x 1 hayashis uits 26 Oct 8 09:41 makemask.sh
-rw-r--r-- 1 hayashis uits 13256170 Oct 8 09:42 t1.nii.gz
-rw-r--r-- 1 hayashis uits 3207305 Oct 8 09:42 mask.nii.gz
-rw-r--r-- 1 hayashis uits 1496386061 Oct 8 09:42 dwi.nii.gz
-rw-r--r-- 1 hayashis uits 9507 Oct 8 09:42 dwi.bvecs
-rw-r--r-- 1 hayashis uits 1631 Oct 8 09:42 dwi.bvals
lrwxrwxrwx 1 hayashis uits 9 Oct 8 13:35 T1w_acpc_dc_restore_brain.nii.gz -> t1.nii.gz
and I am running TractSeg with following options
TractSeg -i tractseg_output/peaks.nii.gz -o . --output_type TOM --track --filter_tracking_by_endpoints
Hi, we updated to version 1.7.
After --track, tractography is just performed from ST_FO_left.tck
to T_PAR_right.tck
, the other tractograms are missing.
The command we used was:
foreach * : TractSeg -i IN/T1w/Diffusion_7T/tractseg_output/peaks.nii.gz -o IN/T1w/Diffusion_7T --output_type TOM --track --filter_tracking_by_endpoints --tracking_format tck --bundle_specific_threshold
Hi,
we received following error when trying to plot the tractometry results:
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
AttributeError: 'module' object has no attribute 'lineplot'
We changed plt.tight_layout()
to plt.show()
and installed seaborn 0.9.0 via pip install seaborn==0.9.0
, which solved the problem.
I started testing the latest TractSeg 1.9.
I've noticed that TractSeg now spends few minutes generating "new fontManager".
INFO: font search path ['/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/ttf', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/afm', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
INFO: generated new fontManager
Iis there anyway to prerun this step to save time? Like.. can this step be done inside download_all_pretrained_weights ?
Hi all:
I move image to MNI space using --preprocess and generate TOM_trackings (trk format).
How can I move fibers to subject space?
Thanks a lot for this tool, it's just great!
I have a few dumb questions.
I tried to generate the CSD peaks with TractSeg, but doing so gave the following error:
TractSeg -i diffusion.nii --bvals diffusion_bvals --bvecs diffusion_bvecs --raw_diffusion_input
--preprocess --output_type tract_segmentation --csd_type csd
Creating brain mask...
Moving input to MNI space...
Creating brain mask...
Creating peaks (1 of 3)...
Traceback (most recent call last):
File "/usr/local/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: '327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n3
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 "//anaconda/lib/python3.6/site-packages/nibabel/loadsave.py", line 40, in load
stat_result = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tractseg_output/peaks.nii.gz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "//anaconda/bin/TractSeg", line 303, in <module>
main()
File "//anaconda/bin/TractSeg", line 201, in main
data_img = nib.load(peak_path)
File "//anaconda/lib/python3.6/site-packages/nibabel/loadsave.py", line 42, in load
raise FileNotFoundError("No such file or no access: '%s'" % filename)
FileNotFoundError: No such file or no access: 'tractseg_output/peaks.nii.gz'
So it seems to be caused by a mask generation error from mrtrix? As I already encountered issues on my data when using dwi2mask
, I am now using masks computed with fsl bet
.
TractSeg -i peaks.nii.gz --output_type TOM
Tracking -i peaks.nii.gz
and
TractSeg -i peaks.nii.gz --output_type TOM --track --only_track
preprocess
option, then I don't need to align my images with the MNI space before using TractSeg?Thanks a lot.
I am seeing a strange error message when TractSeg runs dwi2response.
+ TractSeg -i dwi.nii.gz --raw_diffusion_input --csd_type csd_msmt_5tt --output_type tract_segmentation --keep_intermediate_files --postprocess -o .
INFO: font search path ['/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/ttf', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/afm', '/usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
INFO: generated new fontManager
5ttgen:
5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen:
5ttgen: Generated temporary directory: /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/5ttgen-tmp-ANNWFJ/
Command: mrconvert /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/T1w_acpc_dc_restore_brain.nii.gz /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/5ttgen-tmp-ANNWFJ/input.mif
5ttgen: Changing to temporary directory (/N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/5ttgen-tmp-ANNWFJ/)
5ttgen: [WARNING] Voxel size larger than expected for T1-weighted images ([1.25, 1.25, 1.25]); note that ACT does not require re-gridding of T1 image to DWI space, and indeed retaining the original higher resolution of the T1 image is preferable
Command: mrconvert input.mif T1.nii -strides -1,+2,+3
Command: fsl5.0-fast T1.nii
5ttgen: [WARNING] Generating 1mm isotropic T1 image for FIRST in hope of preventing failure, since input image is of lower resolution
Command: mrresize T1.nii T1_1mm.nii -voxel 1.0 -interp sinc
Command: fsl5.0-run_first_all -m none -s L_Accu,R_Accu,L_Caud,R_Caud,L_Pall,R_Pall,L_Puta,R_Puta,L_Thal,R_Thal -i T1_1mm.nii -o first -b
5ttgen: Generating partial volume images for SGM structures... [=======================================================]
Command: mrmath mesh2voxel_L_Accu.mif mesh2voxel_R_Accu.mif mesh2voxel_L_Caud.mif mesh2voxel_R_Caud.mif mesh2voxel_L_Pall.mif mesh2voxel_R_Pall.mif mesh2voxel_L_Puta.mif mesh2voxel_R_Puta.mif mesh2voxel_L_Thal.mif mesh2voxel_R_Thal.mif sum - | mrcalc - 1.0 -min all_sgms.mif
Command: mrthreshold T1_pve_2.nii.gz - -abs 0.001 | maskfilter - connect - -connectivity | mrcalc 1 - 1 -gt -sub remove_unconnected_wm_mask.mif -datatype bit
Command: mrcalc T1_pve_0.nii.gz remove_unconnected_wm_mask.mif -mult csf.mif
Command: mrcalc 1.0 csf.mif -sub all_sgms.mif -min sgm.mif
Command: mrcalc 1.0 csf.mif sgm.mif -add -sub T1_pve_1.nii.gz T1_pve_2.nii.gz -add -div multiplier.mif
Command: mrcalc multiplier.mif -finite multiplier.mif 0.0 -if multiplier_noNAN.mif
Command: mrcalc T1_pve_1.nii.gz multiplier_noNAN.mif -mult remove_unconnected_wm_mask.mif -mult cgm.mif
Command: mrcalc T1_pve_2.nii.gz multiplier_noNAN.mif -mult remove_unconnected_wm_mask.mif -mult wm.mif
Command: mrcalc 0 wm.mif -min path.mif
Command: mrcat cgm.mif sgm.mif wm.mif csf.mif path.mif - -axis 3 | mrconvert - combined_precrop.mif -strides +2,+3,+4,+1
Command: mrmath combined_precrop.mif sum - -axis 3 | mrthreshold - - -abs 0.5 | mrcrop combined_precrop.mif result.mif -mask -
Command: 5ttcheck result.mif
Command: mrconvert result.mif /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/tractseg_output/5TT.mif
5ttgen: Changing back to original directory (/N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc)
5ttgen: Deleting temporary directory /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/5ttgen-tmp-ANNWFJ/
dwi2response:
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response:
dwi2response: Generated temporary directory: /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi2response-tmp-JCCNB0/
Command: mrconvert /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.nii.gz /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi2response-tmp-JCCNB0/dwi.mif -strides 0,0,0,1 -fslgrad /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvecs /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvals
dwi2response:
dwi2response: [ERROR] Command failed: mrconvert /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.nii.gz /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi2response-tmp-JCCNB0/dwi.mif -strides 0,0,0,1 -fslgrad /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvecs /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvals (dwi2response:86)
dwi2response: Output of failed command:
mrconvert: uncompressing image "/N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.nii.gz"... [==================================================]
dwi2response:
dwi2response: Script failed while executing the command: mrconvert /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.nii.gz /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi2response-tmp-JCCNB0/dwi.mif -strides 0,0,0,1 -fslgrad /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvecs /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi.bvals
dwi2response: For debugging, inspect contents of temporary directory: /N/dc2/scratch/brlife/karst-workflows/5bc53b4549193400454aae1d/5bd09669d0414253317dfcbc/dwi2response-tmp-JCCNB0/
I am seeing this error on about 5% of jobs launched on various computing resources (across all HCP3T subjects). A strange thing is that, mrconvert seems to be suceeding with generating the dwi.mif.
When I just run the "failing" command, it also successfully generate the dwi.mif. It's as if dwi2response script is incorrectly determining that the command is failing when in fact it's not.
I am not sure if this is really TractSeg issue or not, but since this issue only seems to happen when TractSeg runs it, I am hoping someone who might be having this issue could assist us.
I was able to run TractSeg successfully, but it didn't use our GPU available on our machine.
Here is the output
Creating brain mask...
Creating peaks (1 of 3)...
dwi2response: [ERROR] Output file './tractseg_output/response.txt' already exists (use -force to override)
Creating peaks (2 of 3)...
dwi2fod: [ERROR] output file "./tractseg_output/WM_FODs.mif" already exists (use -force option to force overwrite)
dwi2fod: [ERROR] error creating image "./tractseg_output/WM_FODs.mif"
Creating peaks (3 of 3)...
sh2peaks: [ERROR] output file "./tractseg_output/peaks.nii.gz" already exists (use -force option to force overwrite)
sh2peaks: [ERROR] error creating image "./tractseg_output/peaks.nii.gz"
Loading weights from: /.tractseg/pretrained_weights_tract_segmentation_v1.npz
Processing direction (1 of 3)
100%|########################################################################################| 144/144 [03:35<00:00, 1.49s/it]
Processing direction (2 of 3)
100%|########################################################################################| 144/144 [03:32<00:00, 1.47s/it]
Processing direction (3 of 3)
100%|########################################################################################| 144/144 [03:32<00:00, 1.47s/it]
real 11m40.197s
user 13m58.256s
sys 0m29.791s
I am running it through singularity with nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04 container, but other App that we run in similar manner can use our GPU just fine. I believe something needs to be reconfiguref for TractSeg for it to detect/use the GPU. How can I troubleshoot this?
Hi,
with the command TractSeg -i peaks_flip_z.nii.gz --output_type TOM --track --only_track --filter_tracking_by_endpoints --super_resolution --tracking_format tck --bundle_specific_threshold
we receive now the error message:
mrview: [ERROR] invalid first line for key/value file "/media/bwgig/64F2-0B2C/S161/tractseg_output/TOM_trackings/AF_left.tck" (expected "mrtrix tracks")
The bundle segmentations, endings segmentations and TOMs look fine and the .tck files are not empty.
We are using Version 1.8.
Hi guys,
first of all, congrats on the great tool. Works flawlessly and runs nicely on most datasets I've tested so far. Handles standard and state-of-the-art data (e.g., Connectom generated data) pretty well (>5 shells).
I do however have a small comment/question for future users/devs. regarding the Tractometry option. I see that you provide the option to generate the peak length along the tract (which in some way is a discretized Apparent Fiber Density similar to FBA/AFD analysis in MRtrix).
The problem with the current Tractometry implementation is that each subject is processed independently and therefore the response function is unique to each participant (which is contradictory to the recommended steps for AFD). Typically, one has to take the average response function (or a single 1 and apply it to the whole group to generate the fods.). This will allow a correct comparison of the amplitudes between subjects (e.g. comparing oranges with oranges). Some other steps would, in theory, be needed as well (i.e. bias field correction on the data before giving it as input to TractSeg or mtnormalise the msmt-csd outputs of TractSeg).
As mentioned by Thijs on the MRtrix forums: "In a way, the response function is the unit of your FOD"
Maybe a word of caution on the wiki page would help future users!
Best,
Max
I started seeing the following error message. I believe it was working fine before with the input data that I am testing with.
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 133, in <module>
data, flip_done = ImgUtils.flip_peaks_to_correct_orientation_if_needed(data_img)
File "/usr/local/lib/python2.7/dist-packages/tractseg/libs/ImgUtils.py", line 457, in flip_peaks_to_correct_orientation_if_needed
peaks = ImgUtils.enfore_shape(peaks, target_shape=(91, 109, 91, 9))
File "/usr/local/lib/python2.7/dist-packages/tractseg/libs/ImgUtils.py", line 410, in enfore_shape
data_new[:data.shape[0], :data.shape[1], :data.shape[2]] = data
ValueError: could not broadcast input array from shape (90,108,90,288) into shape (90,108,90,9)
Has anything changed?
@wasserth Jakob,
(I couldn't find your email address so I appologize in advance for posting it here!) As you might have noticed, I've been playing with TractSeg for the last few weeks and I am super impressed by what it can do! I've tested with a few of HCP dataset as well as some NKI data - both worked nicely!
I am actually a software engineer at Indiana University working for a NSF funded project called BrainLife and our platform allows researchers to publish algorithms as Apps and allows users to execute them on our compute resources. Apps can interface with other Apps developed by other researches through the use of registered datatypes to easily construct a workflow and explore new ways to use the algorithms.
I've registered an App on BrainLife here.
If you would signup on BrainLife, you will be able to run your App by visiting "Execute" tab via above URL.
I'd like to know if you have any concerns or questions about our platform and if you could let us publish your App through it. By having your App published on BrainLife, other users can discover and try your App with their own datasets, and take the output from your App and feed it to other registered Apps such as ..
This App can take tract masks and generate 3D volumes of the tracts and visualize them online (without having to download any software)
The output from 3D tract surfaces can then used by other Apps such as
etc..
As you can see, users can quickly explore / compare different Apps on our platform and promote code reuse and sharing across different fields of science.
I hope you will be interested in Brainlife, and please feel free to contact me directly at [email protected], or on our slack channel I am looking forward to hearing from you!
Thank you,
Soichi
Thank you very much for providing TractSeg.
Where exactly can I change the output format of the tractography files from .trk to .tck or add an additional .tck output to the existing .trk?
Since csd etc. is performed within mrtrix and all my other pipelines and workflows are using mrtrix, I would like to be able to stay within and use mrview for visualisation instead of trackvis.
The python script trk2tck.py outputs erroneous files, furthermore, I'd rather like to output a .tck file directly.
Thank you very much in advance, Lucius
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.