pnlbwh / ukftractography

Other
25 stars 27 forks source link

Error, a variable became negative. Most likely something went wrong in the QP #163

Open kavandeloo97 opened 3 months ago

kavandeloo97 commented 3 months ago

Hello,

Although UKFTractography completed without error for most of my cases, I have 3 cases that threw the following error. Any insight is appreciated - thank you!

(pnlpipe3) [root@4d78e987681f dwi]# UKFTractography --dwiFile sub-TRD24_ses-01_desc-UnXc_dwi_EdEp.nhdr --maskFile sub-TRD24_ses-01_desc-UnXc_dwi_EdEp_maskQc.nhdr --numThreads 8 --seedsPerVoxel 1 --recordTensors --freeWater --recordFreeWater --tracts ./ukf/sub-TRD24_ses-01_desc-UnXc_dwi_EdEp.vtk Using the 2T simple model with free water estimation. Setting the default parameters accordingly: "*": set by user "-": default setting

Using 2-tensor simple model with free water estimation. Branching disabled

Using constrained filter Error, a variable became negative. Most likely something went wrong in the QP terminate called without an active exception Aborted

yrathi commented 3 months ago

Most likely, the data has too many negative values. Check your brain mask for these cases first, and if there is an issue (ie. mask includes regions outside brain or holes, remove them). Next option could be to threshold data to not have negative values...so preoprocess it and then pass to the UKF tractography module.

kavandeloo97 commented 3 months ago

Thanks, will start with your first suggestion. Otherwise, how is thresholding the data to not have negative values accomplished? Currently running UKFTractography in the terminal from the pnlpipe docker container (not through the Slicer GUI)

yrathi commented 3 months ago

Has to be done separately using your own custom script in python or other languaget that you can write to threshold anything below 0 to be 1 (in the un-normalized dMRI data).

kavandeloo97 commented 3 months ago

Doesn't seem to be the first issue. Do you have an example script by chance for thresholding (i.e., in linux) or could you point me towards a resource? Thank you for your time

kavandeloo97 commented 3 months ago

Just looking to follow-up, thank you!

yrathi commented 3 months ago

Perhaps you can use DiPy to see if they have some functions to do it.

tashrifbillah commented 3 months ago

Do you have an example script by chance for thresholding

No but this may be useful:

import nibabel as nib
img=nib.load('image.nii.gz')
img[img.get_fdata()<0]=0
new_img=nib.Nifti1Image(img.get_fdata(), img.header.get_best_affine(), header=img.header)