Error Computing FEM Tensors for Anatomy Folder Imported from SimNIBS

Hi Brainstorm team,

First of all, thanks a lot for the wonderful tool. I am reaching out to you because I am running into an error with Brainstorm with 'Convert DWI to DTI' and I would appreciate it very much if you can help me out.

I am using SimNIBS headreco to construct the FEM model from my T1 and T2 MRI scans. I manually fixed the segmentation masks and ran headreco surfacemsh and headreco volumemesh to update the final mesh file. I then successfully imported the anatomy folder into Brainstorm in order to obtain the FEM model. Since I would like to estimate anisotropic conductivity values, I would need to import the DWI and 'Compute Tensors' for my FEM model. However, the following error shows up when I try to run 'Convert DWI to DTI':

Unable to determine this version of BDP. Check for a bdpmanifest.xml file in
the same directory as your BDP executables.
BST> Emptying temporary directory...
BST> System call: bse -i "/home/jason/.brainstorm/tmp/brainsuite/testT1.nii" --auto -o "/home/jason/.brainstorm/tmp/brainsuite/skull_stripped_mri.nii.gz" --mask "/home/jason/.brainstorm/tmp/brainsuite/bse_smooth_brain.mask.nii.gz" --hires "/home/jason/.brainstorm/tmp/brainsuite/bse_detailled_brain.mask.nii.gz" --cortex "/home/jason/.brainstorm/tmp/brainsuite/bse_cortex_file.nii.gz"
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.
error: datatype (sint32) is not currently supported for BSE.

  1. cost(3,25,0.64,1)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  2. cost(3,25,0.64,1)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  3. cost(3,25,0.64,1)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  4. cost(3,25,0.64,1)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  5. cost(3,25,0.64,2)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  6. cost(3,25,0.64,2)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  7. cost(3,25,0.64,2)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
    error: datatype (sint32) is not currently supported for BSE.
  8. cost(3,25,0.64,2)=1.00006e+06
    lowest cost(3,25,0.64,2)=1.00006e+06
    error: datatype (sint32) is not currently supported for BSE.

status =

 1

** Error: Cannot convert files:
** /home/jason/data/MRI/test/nifti/dmri.nii.gz
** /home/jason/data/MRI/test/nifti/dmri.bval
** /home/jason/data/MRI/test/nifti/dmri.bvec
** BrainSuite failed at step 1/3 (BSE).
** Check the Matlab command window for more information.


Please note that I am using Brainstorm version: 3.210325.

I tested around and found that I am able to successfully run 'Convert DWI to DTI' if I created the SimNIBS FEM model by running headreco within Brainstorm using the Github Commit 8646eeb24e99d107ba36cbfe520364c15a8a0bde according to this link. However, this doesn't suffice for what I need to do, because I need to manually fix the segmentation masks within SimNIBS so I would like to import the anatomy folder instead.

Based on the test above, it suggests that the datatype error may not be with the DWI file but rather with the files imported from the SimNIBS anatomy folder. However, I am not sure which file(s) Brainstorm / Brainsuite is having issues with based on the error message. I am also unsure how I can convert the problematic file(s) to the right datatype. Any help would be greatly appreciated!

Once again, thank you very much for your help!

Jason

@tmedani @juangpc @Anand_Joshi
Any suggestion for debugging this issue?

Hello @Francois, @jleung,
I think that part of the pipeline is done with Brainsuite. Can't help too much there.

Hi all,

This error is at the level of Brainsuite, at the BSE (Brain Surface Extractor) step, and does not require the FEM mesh at this level.

which Brainsuite's version do you have?

I guess it can be an issue with the MRI? @ajoshi?

Hi everyone,

Thanks for the quick replies. @tmedani I am using BrainSuite 19b for linux. Im running this on ubuntu 20.10.

Thanks!
Jason

Hi everyone,

I seem to have figured out what the issue is. Apparently the BSE step only works with MRI image that is in uint8 and my T1 image is in uint16. I just have to manually cast the image (the Cube variable) using im2uint8 and Convert DWI to DTI ran without errors. However, the resulting tensors look rather odd. I was wondering if you have any ideas what is going on?

Thanks,

dti

Jason

Looks funny, something is wrong with the size of the lines as well as the directions.

For the lines, you need to reduce the size of the lines, you can do that with "shift + Up/Down arrows"
hit the "H" and then you will have a full list of options that can help with the display.

Then, you may need just to display the tensors on the WM and check if the orientation looks correct, you need to look around the corpus callosum to check the orientations.

1 Like

I seem to have figured out what the issue is. Apparently the BSE step only works with MRI image that is in uint8 and my T1 image is in uint16. I just have to manually cast the image (the Cube variable) using im2uint8 and Convert DWI to DTI ran without errors.

@tmedani @ajoshi
Do you confirm this observation?
If this is the case, it should probably be set as something to fix in future versions of BrainSuite.
In the meantime, we need to handle this in process_dwi2dti.m. Maybe by replacing line 226 with something like the following code?

sMriT1 = in_mri_bst(T1BstFile);
if ~isa(sMriT1.Cube, 'uint8')
    sMriT1.Cube = uint8(double(sMriT1.Cube) ./ max(double(sMriT1.Cube(:))) .* 255);
end

Not from my side, I will check it with @Anand_Joshi