qsdr MNI transform

437 views
Skip to first unread message

Matthew Cieslak

unread,
Apr 15, 2013, 2:08:36 AM4/15/13
to dsi-s...@googlegroups.com
Hi Frank,

Is there any way to find the transform used by qsdr to go from B0 to MNI? I haven't found any affine transforms in  the fib file, or the log.txt.  The Slices > Export Mapping does not produce a file save dialog when the qsdr fib file is opened in the viewer.  Does this information get saved anywhere? 


Fang-Cheng Yeh

unread,
Apr 15, 2013, 10:26:21 AM4/15/13
to dsi-s...@googlegroups.com
Hi Matthew,

I am sorry to way that the transformation is discarded after the
reconstruction. Besides, the transformation is nonlinear, which means
that the mapping is more than a transformation matrix. It is much hard
to get the mapping function than a simple linear transformation.

Best.,
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+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Matthew Cieslak

unread,
Apr 15, 2013, 7:35:24 PM4/15/13
to dsi-s...@googlegroups.com
Ah, that makes sense. I thought it might be interesting to compare QSDR tractography to GQI tractography brought into MNI-space the old fashioned way (using DTK's track_transform tool). I had an idea for approximating the native space -> MNI  transform:

1) Reconstruct a .fib.gz using gqi instead of qsdr
2) Export GFA in a volume "GFA_GQI"
3) use flirt to register "GFA_GQI" to a QA volume from the QSDR reconstruction
4) use DTK's track_transform tool to bring GQI tracks to  MNI space

I noticed some strange behavior of the QA volumes when checking in trackvis with the DTK b0 volume as the background and the "GQI_QA" volume. Theoretically these should be the same shape and size, but when I look in the nifti headers I find for DTK's b0:

++ 3dinfo: AFNI version=AFNI_2011_12_21_1014 (Apr  5 2013) [64-bit]

Dataset File:    dsi_b0.nii
Identifier Code: NII_rBV7WNzr291JltuImRZUQA  Creation Date: Mon Apr 15 16:12:05 2013
Template Space:  ORIG
Dataset Type:    Anat Bucket (-abuc)
Byte Order:      LSB_FIRST {assumed} [this CPU native = LSB_FIRST]
Storage Mode:    NIFTI
Storage Space:   940,032 (940 thousand) bytes
Geometry String: "MATRIX(2.40625,0,0,-119.0572,0,2.40625,0,-145.8262,0,0,2.4,-38.72223):96,96,51"
Data Axes Tilt:  Plumb
Data Axes Orientation:
  first  (x) = Right-to-Left
  second (y) = Anterior-to-Posterior
  third  (z) = Inferior-to-Superior   [-orient RAI]
R-to-L extent:  -119.057 [R] -to-   109.537 [L] -step-     2.406 mm [ 96 voxels]
A-to-P extent:  -145.826 [A] -to-    82.768 [P] -step-     2.406 mm [ 96 voxels]
I-to-S extent:   -38.722 [I] -to-    81.278 [S] -step-     2.400 mm [ 51 voxels]
Number of values stored at each pixel = 1

And for the "GFA_GQI" file:
++ 3dinfo: AFNI version=AFNI_2011_12_21_1014 (Apr  5 2013) [64-bit]

Dataset File:    0105A.src.gz.odf8.f3rec.gqi.1.25.fib.gz.gfa.nii.gz
Identifier Code: NII_QHCUBYCDHSPqUpYK9T8uqA  Creation Date: Mon Apr 15 16:11:33 2013
Template Space:  ORIG
Dataset Type:    Anat Bucket (-abuc)
Byte Order:      LSB_FIRST {assumed} [this CPU native = LSB_FIRST]
Storage Mode:    NIFTI
Storage Space:   1,880,064 (1.9 million) bytes
Geometry String: "MATRIX(-1,0,0,0,0,-1,0,0,0,0,1,0):96,96,51"
Data Axes Tilt:  Plumb
Data Axes Orientation:
  first  (x) = Left-to-Right
  second (y) = Posterior-to-Anterior
  third  (z) = Inferior-to-Superior   [-orient LPI]
R-to-L extent:   -95.000 [R] -to-    -0.000     -step-     1.000 mm [ 96 voxels]
A-to-P extent:   -95.000 [A] -to-    -0.000     -step-     1.000 mm [ 96 voxels]
I-to-S extent:     0.000     -to-    50.000 [S] -step-     1.000 mm [ 51 voxels]
Number of values stored at each pixel = 1


The different headers result in very strange alignment in MNI space. Where do the nifti headers from from in images exported from dsi studio?

Thanks,
Matt

Fang-Cheng Yeh

unread,
Apr 15, 2013, 10:18:13 PM4/15/13
to dsi-s...@googlegroups.com
Hi Matthew,

The nifti file from DSI Studio does not include the spatial
transformation for MNI mapping. You may find that the "geometry
string" here in QA file only outputs an identity matrix. To get the
correct mapping, addition registration (e.g. using flirt) is
required,but DSI Studio is not designed to handle this. One solution
is using the header info from dsi_b0 file to overwrite the QA file
header, or you may use flirt to get the transformation matrix and
write it to the nifti header.


Best regards,
Frank

Matthew Cieslak

unread,
May 4, 2013, 10:36:29 PM5/4/13
to dsi-s...@googlegroups.com
Hi Frank,

Just wondering -- is there a possibility that DSI studio will be able to write out some form of the nonlinear mapping from qsdr? It would be wonderful to be able to map region labels from b0 space to the standardized version. Going back to regular GQI and affine transforming to MNI made me realize how valuable the qsdr approach really is.

Also, in case anyone else is trying to do something similar, it's possible to get DSI studio trk files to MNI space using DTK's track_transform tool but it's necessary to replace the headers in both the trk file and the b0 nifti file with headers produced by DTK for track_transform to work properly.
Nibabel and dipy provide tools that make this really easy.

thanks again,
Matt

Fang-Cheng Yeh

unread,
May 4, 2013, 10:39:30 PM5/4/13
to dsi-s...@googlegroups.com
Hi Matt,

I think it's possible to output an one-to-one mapping matrix for
this purpose. I am listing this on the do-to list.

Best regards,
Frank

Fang-Cheng Yeh

unread,
May 6, 2013, 12:21:40 PM5/6/13
to dsi-s...@googlegroups.com
Hi Matt,

I implemented a function to export mapping to the fib file and
uploaded new sources codes to github. The Windows and Mac version will
be updated later.

The new interface has a checkbox in reconstruction window labeled
"output mapping", which exports three matrix "mx", "my", and "mz".
Each matrix records how each voxel in the QSDR space maps to the
subject space at the x , y, and z coordinates, respectively. Please
note that the coordinates stores in these matrix are 0-based.

Should there be any further suggestions/questions regarding this
function, please let me know.

Matthew Cieslak

unread,
May 6, 2013, 12:40:26 PM5/6/13
to dsi-s...@googlegroups.com
Thanks Frank!! Downloading now - I'll send some results



--
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/gjvCEyqKWdI/unsubscribe?hl=en.
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/groups/opt_out.





--
Matt

Matthew Cieslak

unread,
May 16, 2013, 10:17:03 PM5/16/13
to dsi-s...@googlegroups.com
Hi Frank, I'm still having issues getting the new gui to compile. Is there any chance you could post some of the windows 32 bit binaries? I've been running DSI Studio through wine. 

Thanks,
--
Matt

Fang-Cheng Yeh

unread,
May 16, 2013, 10:24:04 PM5/16/13
to dsi-s...@googlegroups.com
Hi Matthew,

You may download the win32 version in
http://dsi-studio.labsolver.org/dsi-studio-download

Qt 5.0 seems to have a big revision and may cause compilation
error (the current code is based on Qt. 4.7). If this is the case,
then you may need to switch to an older version of Qt.

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

Matthew Cieslak

unread,
Jun 11, 2013, 1:40:29 PM6/11/13
to dsi-s...@googlegroups.com
Hi Frank,

It works excellently! Attached is a screenshot of a parcellation from the connectome mapper toolkit mapped to qsdr space. Is there any way to access the mapping function from the commandline?
qsdr_mapped_atlas.png

Fang-Cheng Yeh

unread,
Jun 11, 2013, 2:45:41 PM6/11/13
to dsi-s...@googlegroups.com
Hi Matthew,

I implemented this feature, and you may download source codes from
github (TIPL also needs to be updated). To use it, add --output_map=1
to export this information into the fib file.

e.g. dsi_studio --action=rec --thread=2
--source=20081006_M025Y_1Shell.src.gz --method=7 --param0=1.25
--param1=2 --output_map=1

Best regards,
Frank

Sahil Bajaj

unread,
Oct 27, 2014, 7:39:35 PM10/27/14
to dsi-s...@googlegroups.com
Thanks for this discussion Frank and Matthew. I am little confused after this discussion, could you guys please summarize how can we transform the obtained fibers from default space to MNI space so that I can import my ROIs externally which are defined in MNI space (using MRIcron) ?

Thanks,
Sahil

Fang-Cheng Yeh

unread,
Oct 27, 2014, 7:47:00 PM10/27/14
to dsi-s...@googlegroups.com
What you need to do is selecting "QSDR" when you reconstruct data from the SRC files.

It works for DTI, DSI, and multi-shell data.



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

Sahil Bajaj

unread,
Oct 28, 2014, 6:25:58 PM10/28/14
to dsi-s...@googlegroups.com
Hi Frank,

I tried using both DSI and QSDR. 'DSI' works fine but when I select 'QSDR', it generates '.fib.gz' and when I load this file, it doesn't show any fibers or anything. Everything is completely blank.

I would greatly appreciate any suggestions.

Sahil


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.



--

-------------------------------------------------

Sahil Bajaj
Graduate Student
Neuroscience Research Group
Department of Physics & 
Astronomy
Georgia State University
Atlanta, GA, USA.

E-mail:sahil...@gmail.com

Fang-Cheng Yeh

unread,
Oct 28, 2014, 6:48:22 PM10/28/14
to dsi-s...@googlegroups.com
Can you send me the src file to figure out the problem?

Best regards,
Frank

Sahil Bajaj <sahil...@gmail.com> 於 2014年10月28日星期二寫道:

Sahil Bajaj

unread,
Oct 28, 2014, 6:51:00 PM10/28/14
to dsi-s...@googlegroups.com
Frank, please find the attached '.src' file.

Thanks.
20140811_O075Y_LC140804.src.gz

Fang-Cheng Yeh

unread,
Oct 28, 2014, 7:33:12 PM10/28/14
to dsi-s...@googlegroups.com
Hi Sahil,

    I checked the file in detail. It seems that the images are simulated, and there is no valid b-vector for each DWI. A total of 48 sampling is not a standard DSI acquisition. Both DSI, GQI, and QSDR failed in the reconstruction.

    Are these data acquired from an MR scanner?

Best regards,
Frank

Sahil Bajaj

unread,
Oct 28, 2014, 7:41:08 PM10/28/14
to dsi-s...@googlegroups.com
Hi Frank,

When I run using 'DSI', reconstruction works for me. Please find the attached .fib files- one generated using DSI (which gives fibers) and other using QSDR (which doesn't give anything and is blank).

Yes, this data is collected from MRI scanner.

Thanks. 
FromDSI.src.gz.odf8.f5.dsi.17.fib.gz
FromQSDR.src.gz.odf8.f5.hs.reg0.qsdr.1.25.2mm.R-2147483648.fib.gz

Fang-Cheng Yeh

unread,
Oct 28, 2014, 7:48:25 PM10/28/14
to dsi-s...@googlegroups.com
Hi Sahil,

    The DSI reconstruction does not gives valid fiber orientations. If you click on fiber tracking, it is not showing valid tracks. The problem seems to be the SRC file. Did you use DICOM files to generate the SRC files? Can you send me the files you used to create the SRC?

    Thanks a lot!

Best,
Frank 

Sahil Bajaj

unread,
Oct 28, 2014, 8:00:06 PM10/28/14
to dsi-s...@googlegroups.com
Hi Frank,

Please find the attached folder "DSI_LC.zip', containing the .dcm files which I used to create SRC file:

Thank you so much Frank for all your time and great help in figuring out this issue.

Thanks.

Fang-Cheng Yeh

unread,
Oct 28, 2014, 8:01:22 PM10/28/14
to dsi-s...@googlegroups.com
Thanks a lot for your patience in helping me figure out the problem.

I will let you know once I come up with a solution.

Best regards,
Frank

Fang-Cheng Yeh

unread,
Oct 28, 2014, 8:36:34 PM10/28/14
to dsi-s...@googlegroups.com
Hi Sahil,

I checked the DICOM in detail, and I found some problems here.

First, it seems that the header does not store the bvector
condition. (Are you using an experimental sequence that does not
output bvector information?). A typical SIEMENS diffusion DICOM has
b-vector information stored in (0x0019,0x100E), (0x0019,0x1027), or
the CSA header under "DiffusionGradientDirection". There is no
information stored in either of these three fields.

Second, the "dsi q4 half" usually has 128 sampling directions, but
the dataset only have 48 directions. I cannot match it with my
existing table.

Thirds, SIEMENS diffusion DICOM often save image as mosaic, but
here the data are stored for each slice. DSI Studio can handle this,
but I just curious which sequence you used to acquire the data.

Last but the most important, the signal attenuation for different
b-value does not behave normally. Usually in high b-value acquisition,
there is no signal from gray matter. But in your data, there is still
signals from gray matter at b-value=7,000. It seems that the images
were acquired in about 3,000. This is why I mentioned that the images
look like a simulated/interpolated one.

I am sorry that I cannot come up with a solution here. It seems
that there is something to sort out at the image acquisition side.
Maybe you may provide more information about how the sequence is
setup.

Best regards,
Frank




On Tue, Oct 28, 2014 at 8:01 PM, Fang-Cheng Yeh <fran...@gmail.com> wrote:
> Thanks a lot for your patience in helping me figure out the problem.
>
> I will let you know once I come up with a solution.
>
> Best regards,
> Frank
>
> On Tue, Oct 28, 2014 at 7:59 PM, Sahil Bajaj <sahil...@gmail.com> wrote:
>>
>> Hi Frank,
>>
>> Please find the attached folder "DSI_LC.zip', containing the .dcm files
>> which I used to create SRC file:
>>
>> Thank you so much Frank for all your time and great help in figuring out
>> this issue.
>>
>> Thanks.
>> S

Sahil Bajaj

unread,
Oct 28, 2014, 9:24:47 PM10/28/14
to dsi-s...@googlegroups.com
Hi Frank,

I think there is some data mess up. I looked into the server where originally data was stored. There was another folder of DSI data-named 'DSI q4'. For that data set, looks like QSDR works fine. Please find the attached folder- containing raw '.dcm' files, '.src' file and '.fib' generated using QSDR.

Could you please confirm:
1). If everything looks fine to you and I can proceed in the same way for other subjects ?

If everything is fine then:
2). When I insert T1w or white matter (wm) image to fibers, fibers don't completely overlap the image, some portion of the image (on all sides) are lacking of any fibers. Is that common or I should play with reconstruction parameters (dilution, erosion, smoothing etc.) more ?
3). If I import ROIs externally (which are defined in MNI space) to these fibers, it transforms these ROIs to make image dimensions consistent with ROI dimensions, but I couldn't find the transformation matrix, where its saved, which does this transformation ?
4). Is there any way to perform 2nd level analysis- compute results over a set of subjects ?

Thanks a lot Frank.

Fang-Cheng Yeh

unread,
Oct 28, 2014, 10:02:00 PM10/28/14
to dsi-s...@googlegroups.com
There are still some DWI files missing and the reconstruction result is still not good enough. The b-table seems incomplete.
 
If everything is fine then:
2). When I insert T1w or white matter (wm) image to fibers, fibers don't completely overlap the image, some portion of the image (on all sides) are lacking of any fibers. Is that common or I should play with reconstruction parameters (dilution, erosion, smoothing etc.) more ?

Diffusion MRI fiber tracking cannot reach deep in gray matter, and it seems that there is nothing we can do here.
 
3). If I import ROIs externally (which are defined in MNI space) to these fibers, it transforms these ROIs to make image dimensions consistent with ROI dimensions, but I couldn't find the transformation matrix, where its saved, which does this transformation ?

If you are using QSDR reconstructed data, there is only a displacement used. If you are using regular GQI or DSI reconstruction, the transformation is done in the background, and currently I haven't opened an interface to export it out because the matrix can be easily calculated from SPM or FLIRT.
 
4). Is there any way to perform 2nd level analysis- compute results over a set of subjects ?

You may do either 1) region-based analysis, 2) track-specific analysis, or 3) connectometry. There are some documents on the website to assist you, and you are welcome to email me for any problem/questions.

Best regards,
Frank

Sahil Bajaj

unread,
Oct 29, 2014, 3:48:16 PM10/29/14
to dsi-s...@googlegroups.com
Thank you so much Frank. I am trying to figure out what's wrong with data collection. I will update you once I figure out the issue.

Thanks again for all your help and for this wonderful toolbox.

Regards,
Sahil

Alessandro De Maio

unread,
Jan 24, 2026, 6:15:52 PM (11 days ago) Jan 24
to DSI Studio
Dear Frank,

Sorry for replying to quite an old post.
I'm trying to obtain the linear + nonlinear transforms estimated and applied during the QSDR reconstruction so that I can apply them to other maps obtained externally (like DKI IVIM ...). My idea is to use my DWI data for obtaining DKI metric maps (in native space) and then map them onto the QSDR-generated QA maps and tractography obtained through DSIStudio (template space).
I did try both flags on the command line " --output_map=1" and "--output_jac=1" but it seems that with the latest version I am not able to obtain the transforms as additional mapping_field.mz or transform.txt files. Also, I cannot seem to find a flag on the QSDR gui for this.

Additionally, if I were to reproduce what happens in the background with QSDR registrations, given a B0 map (or any other int used by DSIStudio for QSDR) how do I register it to the templates provided following the registration command line? Since I thing there is ISO and QA normalization steps in between, plus linear and non-linear registrations with parameters I am not sure where to find.

Please let me know if you can help, 
Thank you in advance for your support, 

Alessandro

Frank Yeh

unread,
Jan 24, 2026, 7:54:58 PM (10 days ago) Jan 24
to 9ale...@gmail.com, DSI Studio
The registration from CLI provides the same: https://dsi-studio.labsolver.org/doc/cli_reg.html
QSDR uses anisotropy and isotropy to register subject and template space. B0 is not ideal here.

Alessandro De Maio

unread,
Jan 25, 2026, 6:54:19 AM (10 days ago) Jan 25
to DSI Studio
Awesome, thanks!!

As a workaround, can you please help with the following:

- for QSDR via the CLI reg: I need to (1) reconstruct via GQI, (2) export ISO and QA, (3) dual registration of ISO and QA to their respective templates to obtain the linear and nonlinear transforms, (4) apply transforms to the DWI volume (from nativeto template space), (5) perform GQI on the newly template-registered DWI volume.
I seem to get comparable results to QSDR but are these steps correct? Wouldn't the bvecs need to be transformed as well?

- can you help with outputting the transforms directly after launching QSDR on cli? I tried --output_map=1 and --output_jac=1 but it doesnt seem to output them. It would be extremely useful to obtain those mapping/transforms this way through the software (cli or gui). Please let me know if this could be implemented or if it already is.


Best regards,
Alessandro

Frank Yeh

unread,
Jan 25, 2026, 6:59:09 AM (10 days ago) Jan 25
to 9ale...@gmail.com, DSI Studio
1. QSDR is GQI, so the steps are just redundant.

2. The reg CLI provides the transformation.

Best regards
Frank


Alessandro De Maio

unread,
Jan 25, 2026, 5:32:51 PM (10 days ago) Jan 25
to DSI Studio
As always, Thanks for the support.
1) Absolutely. Upon observing the console output it got clearer. I thought it was necessary to rotate the bvecs as well.

2) I apologize, I will try to be clearer. While the reg CLI provides a transform when using source and template, I am trying to use the rec CLI.
To obtain the transform via the rec CLI for QSDR registration, I am currently using the following command to reconstruct via QSDR: 
--action=rec --source=*.sz --thread_count=8 --make_isotropic --dti_ignore_high_b=0 --method=7 --param0=1.25 --output_map=1 
I found through previous chats, like this one, that " —output_map=1 " is supposed to output the transform for the registration, however it doesn't output the transform in this versionboe can't find much details in the web docs. Could you help with this?

Many thanks for your patience,
Alessandro

Frank Yeh

unread,
Jan 25, 2026, 6:13:30 PM (10 days ago) Jan 25
to 9ale...@gmail.com, DSI Studio
The reconstruction CLI does not have an interface to save mappings.

The solution I know is to use reg CLI because they are using the same code for transformation.

Best regards 
Frank


Reply all
Reply to author
Forward
0 new messages