Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kavandeloo97 opened this issue Aug 3, 2024 · 7 comments

Comments

@kavandeloo97
Copy link

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

  • stoppingFA: 0.15
  • seedingThreshold: 0.18
  • Qm: 0.001
  • Ql: 50
  • Rs: 0.02
  • stepLength: 0.3
  • recordLength: 0.9
  • Qw: 0.0015
  • stoppingThreshold: 0.1
  • seedsPerVoxel: 1
    Found 8 cores on your system.
    Running tractography with 8 thread(s).
    DWMRI_b-value 1000
    Number of non-zero gradients: 64
    Number of zero gradients: 1
    Permuting the axis order to: 3 0 1 2
    Resizing the data to: 64 128 128 63
    Computing the baseline image
    Dividing the signal by baseline image
    Data normalization finished!

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
Copy link
Collaborator

yrathi commented Aug 7, 2024

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
Copy link
Author

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
Copy link
Collaborator

yrathi commented Aug 7, 2024

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
Copy link
Author

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
Copy link
Author

Just looking to follow-up, thank you!

@yrathi
Copy link
Collaborator

yrathi commented Aug 21, 2024

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

@tashrifbillah
Copy link
Collaborator

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants