Trying to get 100 iterations of connectivity matrices for all participants

14 views
Skip to first unread message

Elizabeth Castro

unread,
Mar 22, 2024, 3:04:53 PMMar 22
to DSI Studio
Hi Frank,

I am working on obtaining 100 connectivity matrices for each of my participants so I can threshold them to include the edges that are present in at least 10% of them.

I have written a batch script to do this, and it is running, however all of my matrices for each participant are identical. I am wondering why, because to my knowledge based on the fa_threshold, turning_angle, and step_size being set to random I should be getting slightly different matrices. I even tried running the dsi studio commend in the console a few times and I am getting matrices that are identical. The log file shows no error I can see and I even tried updating DSI studio. Is there a reason/solution to this you might know or am I overlooking something?

Batch script: @ECHO OFF

REM This is for one participant at one timepoint - NIHA1 BL

REM Path to DSI Studio
SET DSI_STUDIO_PATH=C:\dsi_studio_win

REM Path to input data for the participant
SET INPUT_DIR="C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL"

REM Output directory
SET OUTPUT_DIR="C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\repetitions"

REM Check if DSI Studio executable exists
IF NOT EXIST "%DSI_STUDIO_PATH%" (
    ECHO Error: DSI Studio executable not found at specified path.
    EXIT /B 1
)

REM Check if input directory exists
IF NOT EXIST "%INPUT_DIR%" (
    ECHO Error: Input directory does not exist.
    EXIT /B 1
)

REM Check if output directory exists, if not create it
IF NOT EXIST "%OUTPUT_DIR%" (
    MKDIR "%OUTPUT_DIR%"
)

REM Loop 100 times
FOR /L %%i IN (1,1,100) DO (
    REM Output file name for this iteration
    SET OUTPUT_FILE="%OUTPUT_DIR%\NIHA1_%%i.tt.gz"
    ECHO Output file for iteration %%i: %OUTPUT_FILE%

    REM Run DSI Studio CLI
    CALL "%DSI_STUDIO_PATH%\dsi_studio.exe" --action=trk --source="%INPUT_DIR%\eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz" --seed_count=1000000 --fa_threshold=0 --turning_angle=0 --step_size=0 --min_length=30 --max_length=200 --connectivity="%INPUT_DIR%\NIHA1BLatlas2ref_GM_fixed.nii.gz" --connectivity_threshold=0.000 --connectivity_type=end --connectivity_output=matrix --output="%OUTPUT_DIR%\NIHA1_%%i.tt.gz" > "%OUTPUT_DIR%\NIHA1_%%i.log.txt"

    REM Check if DSI Studio command failed
    IF ERRORLEVEL 1 (
        ECHO Error: DSI Studio command failed for iteration %%i.
        EXIT /B 1
    )
)

REM List files in the output directory
ECHO Output files in %OUTPUT_DIR%:
DIR /B "%OUTPUT_DIR%"

REM Script executed successfully
ECHO Script executed successfully.
EXIT /B 0

DSI studio command: --action=trk --source=eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz --seed_count=1000000 --fa_threshold=0 --turning_angle=0 --step_size=0 --min_length=30 --max_length=200 --connectivity=NIHA1BLatlas2ref_GM_fixed.nii.gz --connectivity_threshold=0.000 --connectivity_type=end --connectivity_output=matrix --output=NIHA1.tt.gz

log file output:[1;34mDSI Studio version: Chen"陳" Mar 19 2024 [0m
| cannot obtain GPU driver and device information (CUDA ERROR 35). please update the Nvidia driver and install CUDA Toolkit.
| [0;33mDSI Studio version [0m: Chen"陳"
| [0;32maction [0m=trk
| [0;32msource [0m=C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz
| [0;32mloop [0m=C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz
|- [1;34mrun trk [0m
| | loading C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz...
| |- [1;34mopen FIB file eddy_corrected_data.nii.gz.src.gz.gqi.1.25.fib.gz [0m
| | | loading fiber and image data
| | |- [1;34mloading image volumes [0m
| | | |_11 ms
| | | initiating data
| | | default template set to young adult
| | | FIB file loaded
| | |_1.462 s
| |- [1;34mtracking parameters: [0m
| | | [0;32motsu_threshold [0m=0.6
| | | [0;32mfa_threshold [0m=0
| | | [0;32mdt_threshold [0m=0
| | | [0;32mturning_angle [0m=0
| | | [0;32mstep_size [0m=0
| | | [0;32msmoothing [0m=0
| | | [0;32mmin_length [0m=30
| | | [0;32mmax_length [0m=200
| | | [0;32mrandom_seed [0m=0
| | | [0;32mmethod [0m=0
| | | [0;32mcheck_ending [0m=0
| | | [0;32mtip_iteration [0m=0
| | | [0;32mseed_count [0m=1000000
| | |_3 ms
| |- [1;34msetting up regions [0m
| | |_0 ms
| |- [1;34mstart fiber tracking [0m
| | | [0;32mthread_count [0m=8
| | |_1.315 s
| | 512906 tracts are generated using 1000000 seeds.
| | [0;32moutput [0m=C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\repetitions\NIHA1_1.tt.gz
| |- [1;34mpost-tracking analysis [0m
| | | [0;32mtip_iteration [0m=0
| | |- [1;34msave trajectories to NIHA1_1.tt.gz [0m
| | | |- [1;34mcompressing trajectories [0m
| | | | |_448 ms
| | | |- [1;34msaving file [0m
| | | | |_3.944 s
| | | |_4.5 s
| | | [0;32mconnectivity [0m=C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\NIHA1BLatlas2ref_GM_fixed.nii.gz
| | | [0;32mconnectivity_type [0m=end
| | | [0;32mconnectivity_value [0m=count
| | | [0;32mconnectivity_output [0m=matrix
| | | loading C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\NIHA1BLatlas2ref_GM_fixed.nii.gz
| | | reading C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\NIHA1BLatlas2ref_GM_fixed.nii.gz as a NIFTI ROI file
| | |- [1;34mopening file NIHA1BLatlas2ref_GM_fixed.nii [0m
| | | | NIHA1BLatlas2ref_GM_fixed loaded as multiple ROI file
| | | | looking for region label file C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\NIHA1BLatlas2ref_GM_fixed.txt
| | | | no label file found. Use default ROI numbering.
| | | | [0;33madd 3069 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 440 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 200 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 263 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 104 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 897 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 193 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 72 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 11 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 212 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 3058 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 435 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 206 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 267 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 97 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 207 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 93 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 18 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 201 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 6 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 51 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 19 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 36 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 40 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 39 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 102 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 51 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 504 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 202 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 104 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 688 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 713 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 684 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 135 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 585 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 415 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 400 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 268 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 737 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 100 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 244 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 256 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 147 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 244 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 182 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 718 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 139 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 978 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 648 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 92 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 882 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 1576 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 1051 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 803 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 803 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 67 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 161 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 53 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 345 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 144 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 52 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 346 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 177 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 115 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 562 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 869 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 870 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 111 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 744 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 401 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 390 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 268 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 828 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 84 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 238 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 185 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 177 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 290 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 144 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 636 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 132 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 958 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 722 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 100 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 1127 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 1541 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 890 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 704 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 792 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 101 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 172 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 37 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | [0;33madd 350 voxel(s) as a region with image size [0m: (96,96,53) resolution: 2.66667 2.66667 2.7
| | | | a total of 93 regions are loaded.
| | | |_845 ms
| | | [0;32mconnectivity_threshold [0m=0.000
| | |- [1;34mcalculating connectivity matrix [0m
| | | | [0;33mtract count [0m: 512906
| | | | [0;33mvalue [0m: count
| | | | [0;33muse_end_only [0m: yes
| | | | [0;33mthreshold [0m: 0
| | | | [0;33matlas_name [0m: roi
| | | |_141 ms
| | | export connectivity matrix to C:\Users\lizzy\Box\smuldoon-projects-Elizabeth\data\NIHA1\BL\repetitions\NIHA1_1.tt.gz.NIHA1BLatlas2ref_GM_fixed.count.end.connectivity.mat
| | |_5.597 s
| |_8.514 s
|_8.533 s

Thank you in advance!

Elizabeth

Frank Yeh

unread,
Mar 22, 2024, 3:08:36 PMMar 22
to ecast...@gmail.com, DSI Studio
set --random_seed=0 and --random_seed=1 ... so that different random
seed is used.
> --
> 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/1036ff32-e815-4b5b-8ef4-f82346132e38n%40googlegroups.com.

Elizabeth Castro

unread,
Mar 23, 2024, 12:51:47 PMMar 23
to DSI Studio
Frank,

Okay got it, so I will set 100 random seeds. Thank you! I will let you know if I encounter any further issues.

Reply all
Reply to author
Forward
0 new messages