Spatial normalization and smoothing

44 views
Skip to first unread message

Jonas W.

unread,
Sep 6, 2022, 6:01:25 PMSep 6
to DSI Studio
Hello Frank,
I would like to know if there is a chance of smoothing the data when using —action=reg similar to the function in the GUI: tools -> Nonlinear registration -> smooth or removing the background.

In general, I have FW-corrected DTI maps and to run correlational tractography on those, I need to have my native space FW maps in MNI space. For systematic reasons I want to compare the results with QSDR-derived DTI-based correlational-tractography (I used smoothing there as well)
When using FSL tools (tbss_2) with my FW maps to bring them to standard space, the resulting db file looks very noisy, although the data is in MNI space.
I hope this helps you to follow my initial question and you can help me out. 

Best,
Jonas

Jonas W.

unread,
Sep 7, 2022, 5:02:31 PMSep 7
to DSI Studio
Addition:
I was trying to run the registration in general to create a preliminary file until I know how to smooth the data in the CLI like in the GUI.
However, I get no output file from the following command:

sudo /Applications/dsi_studio.app/Contents/MacOS/dsi_studio --action=reg --from=SUB_010_V1_freewater_fa.nii.gz --to=/Applications/dsi_studio.app/Contents/MacOS/atlas/ICBM152_adult/ICBM152_adult.QA.nii.gz --output=nonlinear1.nii.gz

the printing in the terminal looked normal:

DSI Studio "Chen" Jun 3 2022
action=reg
from=SUB_010_V1_freewater_fa.nii.gz
to=/Applications/dsi_studio.app/Contents/MacOS/atlas/ICBM152_adult/ICBM152_adult.QA.nii.gz
output=nonlinear1.nii.gz
running linear registration.
reg_type=1
FOV width:157 to 218
0.532132 -0.00526503 0.0122552 23.0608
0.0153371 0.560655 0.11689 9.67897
-0.0216588 -0.101208 0.559291 24.2343
correlation cofficient: 0.685021
reg_type=1
normalize_signal=1
normalizing signals
resolution=2
speed=1
iteration=200
min_dimension=8
compose output images
R2: 0.628265

Is this a bug or something else?

Best,
Jonas

Fang-Cheng Yeh

unread,
Sep 7, 2022, 11:43:00 PMSep 7
to dsi-s...@googlegroups.com
Sorry about the bug. I will check the code in detail and get back to you.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/dsi-studio/3e0069a3-cb06-4bca-a5ea-64d402f06449n%40googlegroups.com.

Fang-Cheng Yeh

unread,
Sep 12, 2022, 10:22:44 PMSep 12
to dsi-s...@googlegroups.com
> Hello Frank,
> I would like to know if there is a chance of smoothing the data when using —action=reg similar to the function in the GUI: tools -> Nonlinear registration -> smooth or removing the background.

Sorry for the late reply.
--from=sub.nii.gz,gaussian,gaussian will apply Gaussian filter twice.

Fang-Cheng Yeh

unread,
Sep 12, 2022, 10:30:21 PMSep 12
to dsi-s...@googlegroups.com
The names of the parameters have changed.
After you update DSI Studio try the following command

--action=reg --from=SUB_010_V1_freewater_fa.nii.gz
--to=/Applications/dsi_studio.app/Contents/MacOS/atlas/ICBM152_adult/ICBM152_adult.QA.nii.gz
--apply_warp=SUB_010_V1_freewater_fa.nii.gz

Jonas W.

unread,
Sep 13, 2022, 4:35:27 AMSep 13
to DSI Studio
Hey Frank,
thanks for the help with the command line output using the changed names (--applywarp). Now I get my output in MNI space.
However, there is still some difference to the Nonlinear-Registration-toolbox-GUI when using the code you suggested. I post the results here:

Gaussian

Pasted Graphic 1.png

without Gaussian

Pasted Graphic 2.png

from the GUI nonlinear registration toolbox 

Pasted Graphic 3.png

The last one looks the most similar from the results I get from the QSDR step, so it might be best comparable (I used only the default settings and smoothing).
How to achieve this using the command line?
Best, 
Jonas 

Fang-Cheng Yeh

unread,
Sep 13, 2022, 8:46:39 AMSep 13
to dsi-s...@googlegroups.com
It seems that smoothing the apply_warp is what you wanted but is currently not available yet.
I will update DSI Studio so that you can use --apply_warp=file.nii.gz,gaussian
Once done, I will let you know.
Frank

Jonas W.

unread,
Sep 13, 2022, 9:50:41 AMSep 13
to DSI Studio
Thanks for the help! I was wondering, since it is already available in the R2:Nonlinear Registration toolbox. So there is not yet any option for calling this tool from the command line?
Best,
Jonas 

Fang-Cheng Yeh

unread,
Sep 13, 2022, 9:57:08 AMSep 13
to dsi-s...@googlegroups.com
The functions are there, and I just have to open the interface.
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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dsi-studio/bdfc06bf-c1c5-40cb-a9b8-c4e461b36af9n%40googlegroups.com.

Fang-Cheng Yeh

unread,
Sep 13, 2022, 4:00:35 PMSep 13
to dsi-s...@googlegroups.com
Just updated DSI Studio.
You may assign --output=warpped.nii.gz as what you did in the first
email. It should be the smoothed version of the --from image.
In the updated version, please use --from=image.nii.gz+gaussian to
apply Gaussian smoothing instead of using a comma before the
"gaussian" part.
Best,
Frank

Jonas W.

unread,
Sep 16, 2022, 5:14:56 AMSep 16
to DSI Studio
This works, thank you!
Still, my aim is to use FW corrected DTI maps in the same way I would use FA obtained by QSDR in a connectometry analysis. Although the function above works fine, the results and the db seem very noisy and look different compared to the "standard" pipeline (src -> QSDR -> group connectometry) despite the same data was used. 

Is it possible for you to open a function that allows me to feed a diffusion space FW-FA image into the same registration process like in QSDR, also allowing to use functions like resample to 2mm, smoothing etc.? 

It would help me a lot to compare the two approaches for my data (the problem is that because of single shell b=1000 acquisition I cannot use ISO and QA). 
Thank you very much for your incredible help!
Best,
Jonas

Jonas W.

unread,
Sep 25, 2022, 6:17:45 PMSep 25
to DSI Studio
Is it possible for you to open a function that allows me to feed a diffusion space FW-FA image into the same registration process like in QSDR, also allowing to use functions like resample to 2mm, smoothing etc.? 

Is this to tricky or a lot work? Otherwise, it would be nice to know what I have to do to imitate QSDR registration algorithm on my NIFTIs to achieve better results in group analysis.
 
Best, Jonas 

Fang-Cheng Yeh

unread,
Sep 26, 2022, 9:54:40 AMSep 26
to dsi-s...@googlegroups.com
Is it possible for you to open a function that allows me to feed a diffusion space FW-FA image into the same registration process like in QSDR, also allowing to use functions like resample to 2mm, smoothing etc.? 

Both GUI and CLI reconstruction steps can carry native space images to the QSDR space.
GUI: [Step T2b(2)][Attach Images]
CLI: check out --other_image at https://dsi-studio.labsolver.org/doc/cli_t2.html

Best,
Frank

Jonas W.

unread,
Sep 27, 2022, 6:49:26 AMSep 27
to DSI Studio
Thanks for this advice!
I reconstructed the files with the following command:

/Applications/dsi_studio.app/Contents/MacOS/dsi_studio --action=rec --source=PA_eddy_unwarped_V1_${subject_id}.src.gz --mask=PA_brain_mask_V1_${subject_id}.nii.gz --cmd="[Step T2][Edit][Smooth Signals]+[Step T2][Edit][Resample]=2+[Step T2a][Remove Background]+[Step T2][B-table][flip by]" --method=7 --param0=1.25 --record_odf=1 --other_image=FW_FA:${subject_id}_V1_freewater_fa.nii.gz,FW_MD:${subject_id}_V1_freewater_md.nii.gz,FW_AD:${subject_id}_V1_freewater_ad.nii.gz,FW_RD:${subject_id}_V1_freewater_rd.nii.gz,FW:${subject_id}_V1_freewater.nii.gz --thread_count=64

I got my fib files that I also visually checked and used them to create a connectometry database with FW_FA as the index of interest.
The resulting .db file only has a few MB and the db looks like this:
Choosing dti_fa for control led to a normal db file.
What can I do?
Best,
Jonas
Bildschirmfoto 2022-09-27 um 12.48.08.png

Jonas W.

unread,
Sep 27, 2022, 7:30:42 AMSep 27
to DSI Studio
PS: using the GUI works, but the smoothing resampling is not applied to the image, so that the built-in dti_FA and the FW_FA look much different
dti_fa
Bildschirmfoto 2022-09-27 um 13.29.26.png
FW_FA
Bildschirmfoto 2022-09-27 um 13.29.35.png

Fang-Cheng Yeh

unread,
Sep 27, 2022, 8:53:05 AMSep 27
to dsi-s...@googlegroups.com
Update DSI Studio and create the DB again. 
If the updated version still does not work, you can send me the FIB file, and I will fix the bug.
Best,
Frank

Jonas W.

unread,
Sep 27, 2022, 1:02:26 PMSep 27
to DSI Studio
I tried again with the CLI and the latest Mac version and nothing changed, so I shared the fib with you 
Best,
Jonas

Fang-Cheng Yeh

unread,
Sep 27, 2022, 1:36:18 PMSep 27
to dsi-s...@googlegroups.com
Thank you, and sorry for the bug.
I will fix it asap.
Frank

Fang-Cheng Yeh

unread,
Sep 27, 2022, 1:45:16 PMSep 27
to dsi-s...@googlegroups.com
I opened the FIB in Step T3 to check the inserted volumes. They are all black.
It seems that the problem is upstream.

Could you send me the SRC file and one of the attached images?

Jonas W.

unread,
Sep 27, 2022, 2:33:03 PMSep 27
to DSI Studio
Done. Thanks already!

Fang-Cheng Yeh

unread,
Sep 27, 2022, 4:21:57 PMSep 27
to dsi-s...@googlegroups.com
The bug is due to --other_image called before image resampling, so the alignment of inserted images is not correct. 
The updated version will align the images after the resampling commands.

Once done, you can update DSI Studio to see if it works for you.


Fang-Cheng Yeh

unread,
Sep 27, 2022, 4:23:35 PMSep 27
to dsi-s...@googlegroups.com
BTW, your MD data needs to be scaled with 1,000 so that it can be stored in 32-bit floating points. Otherwise, it will be all zeros.

Reply all
Reply to author
Forward
0 new messages