.fib file to .mat file failed

296 views
Skip to first unread message

wangn...@gmail.com

unread,
Oct 5, 2016, 4:47:44 PM10/5/16
to DSI Studio


Hello Frank,
I'm trying to load .fib file to matlab: I unzipped the .fib.gz file to .fib file, then change the name to .mat (For example:   B4_v1.nii.src.gz.odf6.f3rec.bal.de1.fx.rdi.gqi.1.25.fib   to   B4_v1.mat). It shows that:
>> load('B4_v1.mat')
Error using load
Unable to read MAT-file /Users/nw61/Documents/WN_papers/ISMRM/wn_multi_shell/B4_v1.mat. File might be corrupt.

PS: I was able to load the .src file by chaning to .mat file. My matlab version is R2015b.

Also, it there any way I can count  the cross fibers in some specific region/ the whole brain? 
 I'd like to know the distribution of the cross fibers, like how many single fiber /2 fibers /3 fibers in the ROI or the whole brain.
If somebody else also know how to analysis it, please let me know. Thanks!




















Any suggestions?


Thanks,
Nian

Fang-Cheng Yeh

unread,
Oct 5, 2016, 5:58:18 PM10/5/16
to dsi-s...@googlegroups.com
Hi Nian,

    If you file has a large size (> 1GB), then matlab cannot load it due to the limitation of the v4 format. If this is the case, you may reduce the image volume when you reconstruct the SRC file (use [Edit][Trim image].

Best regards,
Frank

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wangn...@gmail.com

unread,
Oct 6, 2016, 11:41:29 AM10/6/16
to DSI Studio
Hi Frank,
Yes, it's more than 1GB. I don't have enough room to trim images (I tried trim the images,but it still has 1.34 GB), since we did scan with high-res & high-angular brain.
Any other suggestions? Appreciate your help!

Thanks,
Nian
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.

Fang-Cheng Yeh

unread,
Oct 6, 2016, 12:06:44 PM10/6/16
to dsi-s...@googlegroups.com
Hi Nian,

    It seems to me that there is no other solution. I am sorry that the file cannot be loaded in matlab due to its large size.


Also, it there any way I can count  the cross fibers in some specific region/ the whole brain? 
 I'd like to know the distribution of the cross fibers, like how many single fiber /2 fibers /3 fibers in the ROI or the whole brain.
If somebody else also know how to analysis it, please let me know. Thanks!


Once you draw a region, use [Regions][Save Indices as] to find the informaiton you want.

Best regards,
Frank
 




















Any suggestions?


Thanks,
Nian

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+unsubscribe@googlegroups.com.

Nian Wang

unread,
Oct 6, 2016, 3:58:23 PM10/6/16
to dsi-s...@googlegroups.com
Hi Frank,
Sorry for bothering you again.I draw a region and save indices. I used GQI recon with maximum 3 fibers to be resolved.
Here is the ROI and indices:
I thought (dx0,dy0,dz0), (dx1,dy1,dz1), (dx2,dy2,dz2) are the 3 fibers info. It looks like in the ROI I chose, there's only one fiber in each voxel. How do I connect (dx0,dy0,dz0), (dx1,dy1,dz1), (dx2,dy2,dz2) info with how many fibers in each voxel? 

Also, I can downsampling my image to fit 1Gb restriction and load the .fib file (about 700M) after I changed the name to .mat.  Is there any basic code/equation I can use to calculate how many fibers in each voxel?

Inline image 1
Inline image 3







--
You received this message because you are subscribed to a topic in the Google Groups "DSI Studio" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dsi-studio/w_LVabDNbx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dsi-studio+unsubscribe@googlegroups.com.

Fang-Cheng Yeh

unread,
Oct 6, 2016, 8:23:54 PM10/6/16
to dsi-s...@googlegroups.com
Hi Nian,

    I will modify DSI Studio to output the number of fibers. Once it is available (in days), I will let you know.

Best regards,
Frank

Nian Wang

unread,
Oct 6, 2016, 10:42:06 PM10/6/16
to dsi-s...@googlegroups.com
Hi Frank,
Cool! Looking forward for your updating soon. 

BTW: could I do the GQI recon in matlab instead of  using GUI, and then I don't have the 1GB limit?

Thanks,
Nian

Sent from my iPhone

On Oct 6, 2016, at 8:23 PM, Fang-Cheng Yeh <fran...@gmail.com> wrote:

Hi Nian,

    I will modify DSI Studio to output the number of fibers. Once it is available (in days), I will let you know.

Best regards,
Frank

On Thu, Oct 6, 2016 at 3:58 PM, Nian Wang <wangn...@gmail.com> wrote:
Hi Frank,
Sorry for bothering you again.I draw a region and save indices. I used GQI recon with maximum 3 fibers to be resolved.
Here is the ROI and indices:
I thought (dx0,dy0,dz0), (dx1,dy1,dz1), (dx2,dy2,dz2) are the 3 fibers info. It looks like in the ROI I chose, there's only one fiber in each voxel. How do I connect (dx0,dy0,dz0), (dx1,dy1,dz1), (dx2,dy2,dz2) info with how many fibers in each voxel? 

Also, I can downsampling my image to fit 1Gb restriction and load the .fib file (about 700M) after I changed the name to .mat.  Is there any basic code/equation I can use to calculate how many fibers in each voxel?

Inline image 1
<Screen Shot 2016-10-06 at 3.47.04 PM.png>
To unsubscribe from this group and all its topics, send an email to dsi-studio+...@googlegroups.com.

Nian Wang

unread,
Oct 7, 2016, 4:02:50 PM10/7/16
to dsi-s...@googlegroups.com
Hi Frank,
I loaded a .src.gz file using matlab: [image b_table voxel_size] = read_src(file_name);
When I try to save the file back to .src.gz, it shows the message here:

>> file_name =  uigetfile('*.src.gz');
>> [image b_table voxel_size] = read_src(file_name);
>> save('filename.src','-v4');
Warning: Variable 'image' cannot be saved to a MAT-file whose version is older than 7.3.
To save this variable, use the -v7.3 switch.
Skipping... 

SO I change to '-v7.3', it works well and it can also be read by DSI studio, and I can do the recon using DSI studio.
>> save('filename.src','-v7.3');

It looks like "-v7.3" has more flexibility for matlab and maybe DSI studio, but since I'm not sure how DSI studio works with matlab, so I report my test results here, just for your consideration.

Thanks,
Nian



To unsubscribe from this group and all its topics, send an email to dsi-studio+unsubscribe@googlegroups.com.

Fang-Cheng Yeh

unread,
Oct 12, 2016, 12:33:21 PM10/12/16
to dsi-s...@googlegroups.com
Hi Nian,

    DSI Studio now will output 0 to dx? dy? dz? if there is no fiber. You can use it to know how many fibers are there in a voxel.

Best regards,
Frank

wangn...@gmail.com

unread,
Oct 12, 2016, 5:32:28 PM10/12/16
to DSI Studio
Hi Frank,
Thank you so much for the updating. I just did a quick test, it works!
BTW: I can also get the fa0,fa1,fa2 & nqa0,nqa1,nqa2 info from the .fib file and load to matlab. Do you know how to calculate how many fibers in each voxel in matlab using fa0,fa1,fa2 & nqa0,nqa1,nqa2? Is there any threshold being used?

Thanks,
Nian
Frank

--
You received this message because you are subscribed to a topic in the Google Groups "DSI Studio" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dsi-studio/w_LVabDNbx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dsi-studio+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "DSI Studio" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dsi-studio/w_LVabDNbx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dsi-studio+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Fang-Cheng Yeh

unread,
Oct 12, 2016, 11:55:11 PM10/12/16
to dsi-s...@googlegroups.com
Hi Nian,

    You can check whether they are zero to know the number of fibers in a voxel.

Best regards,
Frank

To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+unsubscribe@googlegroups.com.

wangn...@gmail.com

unread,
Feb 24, 2017, 5:46:50 PM2/24/17
to DSI Studio
Hi Frank,
I'm trying to calculate the cross fiber angles after GQI recon. 
I use Region----Save Voxel data as--- and get the dx0, dy0, dz0, and dx1, dy1, and dz1 information.
I changed the threshold of qa and the cross fibers in the GUI (attachment) are different. But the .txt file through "the save voxel data as" are the same. It looks like it doesn't change with qa threshold. 
Do you know how could I calculate the cross fiber angles with different qa threshold?

Thanks,
Nian
Picture1.png

Fang-Cheng Yeh

unread,
Feb 24, 2017, 11:10:39 PM2/24/17
to dsi-s...@googlegroups.com
Hi Nian,

    "the save voxel data as" saves all information regardless of the threshold applied, whereas the GUI shows only the fiber orientations with QA values greater than the threshold. 

    To get the same result you see on the GUI, you can apply the QA threshold to the "qa0", "qa1", "qa2" field of the text file to find out which fiber populations are eliminated after thresholding.

Best regards,
Frank

To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+unsubscribe@googlegroups.com.

Nian Wang

unread,
Mar 11, 2019, 4:18:41 PM3/11/19
to DSI Studio
Hi Frank,
I have some high resolution dMRI datasets and try to do quantitative measurements of fiber orientation through the whole brain (fa0, fa1, fa2, .....  index0, index1, index2 .....).
Do  we still have the -v4 format limitation for the large fib size (> 1Gb)? Our .fib size could be as large as 10 Gb after unzip. Is it possible to save as matlab -v7.3 to overcome this?
BTW: The mask generated for DTI or GQI reconstruction in DSI studio is based on averaged DWIs? Could we get the  averaged  DWI  image as an output (similar to save b0, 4dnii, bves  and tables)? For now, I have to load the whole 4dNII file to matlab to get it. 

Thanks,
Nian
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.

Fang-Cheng Yeh

unread,
Mar 11, 2019, 6:14:30 PM3/11/19
to dsi-s...@googlegroups.com
On Mon, Mar 11, 2019 at 4:18 PM Nian Wang <wangn...@gmail.com> wrote:
Hi Frank,
I have some high resolution dMRI datasets and try to do quantitative measurements of fiber orientation through the whole brain (fa0, fa1, fa2, .....  index0, index1, index2 .....).
Do  we still have the -v4 format limitation for the large fib size (> 1Gb)?

DSI Studio has no problem read a large fib file, but MATLAB cannot read/save save a large v4 mat.
 
Our .fib size could be as large as 10 Gb after unzip. Is it possible to save as matlab -v7.3 to overcome this?

Unfortunately, no. DSI Studio cannot read -v7.3 mat files, but you can save files as NIFTI files, and there won't be a size limit.
 
BTW: The mask generated for DTI or GQI reconstruction in DSI studio is based on averaged DWIs?

Yes
 
Could we get the  averaged  DWI  image as an output (similar to save b0, 4dnii, bves  and tables)?

Yes, the most recent version has a menu item under [File][Save DWI sum...] to save the image.
 
Best regards,
Frank

To post to this group, send email to dsi-s...@googlegroups.com.

Nian Wang

unread,
Mar 11, 2019, 6:43:11 PM3/11/19
to dsi-s...@googlegroups.com
Hi Frank,
Thanks for the quick response!
NIFTI is even better for me!
How could get these files (for example: fa0, fa1, fa2 .......) in NIFTI format?
I just download the latest version of DSI studio, but don't know where I can find this function.
I do see the averaged DWIs option, thank you!

Thanks,
Nian

--
Nian Wang, PhD
Assistant Professor
Center for In Vivo Microscopy
Department of Radiology
Duke University Medical Center


Fang-Cheng Yeh

unread,
Mar 12, 2019, 10:18:33 PM3/12/19
to dsi-s...@googlegroups.com
Hi Nian,

    You can save it as a 4D nifti file, with x y z stored in three different 3D volumes. DSI Studio can read this 4D nifti file in [Step3 Fiber Tracking]

    Let me knwo if this works for you.

Best,
Frank

Nian Wang

unread,
Mar 12, 2019, 11:46:28 PM3/12/19
to dsi-s...@googlegroups.com
Hi Frank,
You mean save the .fib.gz file to 4D nifti file? It looks like there are many files in the .fib.gz file. Not sure how to convert it to a single 4D nifti?  
I tried to change the .fib file to .nii or .nii.gz. It didn’t work. DSI studio shows it’s invalid nifti format.  

Thanks,
Nian


Sent from my iPhone

Fang-Cheng Yeh

unread,
Mar 13, 2019, 9:25:29 AM3/13/19
to dsi-s...@googlegroups.com
Hi Nian,

    Could you send me the mat file (the v7 format) and I will see how we can load it in DSI Studio. 

Best,
Frank

Nian Wang

unread,
Mar 13, 2019, 9:43:11 AM3/13/19
to DSI Studio
Hi Frank,
I sent you a XXXX.gqi.1.25.fib.gz file to you yesterday. I got the mat file from .fib.gz file by unzip and change name to .mat (through DSI studio documentation below), but I'm not sure it's -v7.3 format or not, probably not, in my opinion. The file size is about ~3Gb after unzip (we have even larger ones), and I cannot load it to matlab and extract the fiber orientation information. I did try a small size .fib.gz file (~ 1Gb after unzip), I can load it to matlab and extract all the fiber orientation information.
Is there any way I can get the fiber orientation information (fa0, fa1, fa2, index0, index1, index3, nqa1, nqa2, nqa3, odf_vertices, .....) with a large .fib.gz file?

"An FIB file contains fiber directions and related anisotropy indices such FA or QA (see how to get .fib file).  To load an FIB file into Matlab, extract the *.fib.gz file into ean uncompressed .fib file. Then rename the .fib file to .mat file and load it using Matlab. The meanings of each exported matrix are explained as follows."

Thanks,
Nian
--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.
To post to this group, send email to dsi-s...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.
To post to this group, send email to dsi-s...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fang-Cheng Yeh

unread,
Mar 13, 2019, 10:08:26 AM3/13/19
to dsi-s...@googlegroups.com
Now I see what you need. I will open up an interface to output this information to NIFTI.

Best,
Frank

Nian Wang

unread,
Mar 28, 2019, 4:36:43 PM3/28/19
to DSI Studio
Hi Frank,
How's going with the interface to output the information to NIFTI? Really appreciate for your help!
BTW: I'm a little confused about the "resampling" in bal option for the GQI reconstruction. How does DTI studio resample the diffusion scheme? Especially, if we only use half sphere for our diffusion acquisition.
It'll be grateful it there're some references about it.
bal: The diffusion scheme was resampled to ensure balance in the 3D space

Thanks,
Nian
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-s...@googlegroups.com.

Fang-Cheng Yeh

unread,
Mar 29, 2019, 10:40:12 AM3/29/19
to dsi-s...@googlegroups.com

How's going with the interface to output the information to NIFTI? Really appreciate for your help!

It is still on my plan. 
 
BTW: I'm a little confused about the "resampling" in bal option for the GQI reconstruction. How does DTI studio resample the diffusion scheme? Especially, if we only use half sphere for our diffusion acquisition.
It'll be grateful it there're some references about it.
bal: The diffusion scheme was resampled to ensure balance in the 3D space


The half sphere will be copied to become full sphere, and DSI Studio interpolates each shell into 642 directions. There is no reference, but it is only a simple interpolation using Guassian radial basis like how FSL eddy does to interpolate DWI signals.

Best regards,
Frank

Fang-Cheng Yeh

unread,
Apr 11, 2019, 11:40:44 AM4/11/19
to dsi-s...@googlegroups.com
Hi Nian,

    I found that DSI Studio already has this function in the command line to export fiber directions as 4D NIFTI files.

dsi_studio --action=exp --source=test.fib.gz --export=dirs 

    Hope it works for you.

Best,
Frank

Fang-Cheng Yeh

unread,
Apr 11, 2019, 11:44:06 AM4/11/19
to dsi-s...@googlegroups.com

wangni...@gmail.com

unread,
Apr 11, 2019, 5:22:44 PM4/11/19
to DSI Studio
Hi Frank,
Thank you so much! I'll try it and let you know how it goes.

Thanks,
Nian
Reply all
Reply to author
Forward
0 new messages