Read DICOM, NIFTI, Bruker 2dseq, or Varian FDF Files



The following list is the image formats supported by DSI Studio.

1. DICOM Format, including image acquired by SIEMENS TIM, SIEMENS Trio, GE SIGNA HDx, and Philips 4D DICOM.

2. Analyze format, Nifti format, 3D volume or 4D volume (diffusion space as the highest dimension order)

3. Bruker 2dseq files

4. Varian and Agilent FDF files

If your image formats are not listed in the list, you may send me a test image dataset (upload link in the Discussion page), and I will improve the format support in the future release.

Read DICOM Files

Before using the DICOM files, I would recommend rename them using [Batch processing][Step B1: Rename DICOM files] or [Batch processing][Step B1: Rename DICOM in Subfolders]. The former one needs to select all the DICOM files that are ready to be renamed, and then the file will be moved into its related folders. The later one needs to assign a root folder containing all DICOM files to be sorted. DSI Studio will rename DICOM files and place them in different folders according to their pulse sequences (see figure to the right). 

After renaming DICOM files, you can use [Batch processing][Step B2: DICOM to SRC] and select the root folder that contains all scan data to generate SRC files for the next step.
Alternatively, you may use [Diffusion MRI Analysis][Step T1: Open Source Images] in the main window and manually select all dMRI files. After parsing the DICOM files, DSI Studio will be presenting a new window with a b-value table, as shown in the figure. 

The GUI will show b-table extracted from the DICOM headers. You may also assign a different vector table by using the top [Files] menu. 

Click [Ok] button to generate an SRC file for further reconstruction.

*TIP: GE, Philips, and Toshiba scanners output numerous DICOM image for dMRI acquisitioni. Instead of selecting all files, you can select only one of the DICOM files in [Step T1: Open Source Images], and DSI Studio will ask whether you would like to load all other DICOM images. Select yes to specify that you want all DICOM files to be loaded.

Read 4D NIFTI files

    To read 4D NIFTI file, click [Step T1: Open Source Images] in the main window and select the NIFTI file. 

    It is noteworthy that NIFTI file header does NOT invlude any b-table information, and thus, one or more b-table text files are often needed to provide the information. 

    DSI Studio can take FSL's bval and bvec file. The bval file is a text file stroing the b-value for each DWI, whereas bvec stores the diffusion encoding direction in a unit vector format. DSI Studio will search in the NIFTI file directory for "bvals" or "bvals.txt" as well as "bvecs" or "bvecs.txt". If DSI Studio cannot find any b-table file, it will notify users about missing the b-table, and then the files need to be manually loaded using the top menu [Files][Open b-table] (see below):

    DSI Studio also has its own b-table text file format: (bvalue bvectorx bvectory bvectorz). The first column is the b-value, and the rest is a unit vector of diffusion gradient direction.

3000 0.994200 -0.000000 -0.107600
3000 0.985100 -0.130800 0.111300
3000 0.985100 0.130800 0.111300
3000 0.963800 -0.245300 -0.104400
3000 0.963800 0.245300 -0.104400
3000 0.994200 -0.000000 -0.107600
3000 0.985100 -0.130800 0.111300
3000 0.985100 0.130800 0.111300
3000 0.963800 -0.245300 -0.104400
3000 0.963800 0.245300 -0.104400

    DSI Studio will also search under the NIFTI file directory for a file named "grad_dev.nii.gz" to include gradient nonlinearity information and also "nodif_brain_mask.nii.gz" as the brain mask. 

Read Bruker 2dseq files

    To read 2dseq file, click [Step T1: Open Source Images] in the main window and select the "2dseq" file for creating the SRC file. 

    Note that DSI Studio will obtain spatial parameters from other accessory files including "3dproc" and "reco", which is stored in the same directory as 2dseq. In addition to these two files, the b-table will be obtained from the "method" file, which should be stored in the upper directory.  Make sure that these files exist and are in a correct relative directories.

    Once the image is loaded, the b-table may need addition flipping (e.g. swap x-y, y-z, or x-z). For example, you may need to swap x-y to get a correct result.

Read Varian and Agilent FDF files

    Click [Step T1: Open Source Images] in the main window and select all fdf files in the folder. DSI Studio will extract b-table information and the DWI from the files.

Quality Inspection


    Open the created SRC file in [Step T2: Reconstruction] and switch the first tab [Source Images]. 

    (1) Check eddy current distortion and motion: click on the b-table list on the left and use keyboard arrow key to scroll down the list. If the brain distorted across DWI, it is likely caused by the eddy current. Subject head movement can also be seen when scrolling through the DWIs.

    (2) Check bad slices: click on the [Show bad slices] button (available after 10/2/2019 version) and DSI Studil will mark bad slices and their belonging DWI volume in red (see below). I recommend using saggital view to check the bad slices (click on the saggital view button on the right)

Batch Quality Control for SRC files

It is recommended that the SRC files are examined by a quality control procedure to ensure its integrity and quality. The reference for this procedures is documented in Yeh, Fang-Cheng, et al. "Differential tractography as a track-based biomarker for neuronal injury." NeuroImage 202 (2019): 116131.

To do this, use [Diffusion MRI Analysis][QC1: SRC Files Quality Control] and select the folder that contains SRC files (DSI Studio will search for all SRC files in the subdirectories). DSI Studio will provide a report in the following format, which can be paste in Excel:

FileName Image dimension Resolution DWI count Shell count Max b-value B-table matched Neighboring DWI correlation #Bad Slices
100206 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.940147 0
100307 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94786         0
100408 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.939901 0
100610 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.936777 0
101006 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94627         0
101107 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.936007 0
101309 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.892282 0 low-quality outlier 
101410 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.952898 0
101915 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94145         0
102008 145 174 145 1.25 1.25 1.25 180 3 3010 No 0.937926 0

The first thing to check is the consistency of image dimension, resolution, DWI count, shell count. It is likely that certain scans are incomplete, and the total DWI count will be different (see subject 102008 in the example.

The second thing to check is the "neighboring DWI correlation". "Neighboring DWI correlation" calculates the correlation coefficient of low-b DWI volumes that have similar gradient direction. Higher correlation indicates good quality. The value will decrease if there is a prominent eddy current artifact, head motion, or any head coil issues that may impact the diffusion signals. 

DSI Studio will use an outlier checking function (e.g. 3 median absolute deviations) to label problematic data with "low quality outlier."  The example on the top identifies a dataset with a neighboring DWI correlation of only 0.892282, which is substantially lower than the other. Another dataset 102008 has a different b-table, which cannot be used together with the others. If a dataset has a very low neighboring DWI correlation, you will need to examine the raw DWI images (see video above) to see if the problem is correctable. Otherwise, the problematic datasets should be excluded from analysis.

Optional: Flip b-table

DSI Studio allows for flipping the b-table before creating the SRC file. The functions are under the [Edit] menu.

Optional: Batch creating SRC files

DSI Studio supports batch processing to create SRC files. You will need to update DSI Studio if your version is before 10/2/2019.

Please store subject's files using BIDS ( or the following:

(1) The NIFTI or DICOM files of each subject are stored by a folder named by subject's ID:
(2) All subject's folder are stored under a containing project folder
(3) If NIFTI files are used, please name the 4D DWI as "data.nii.gz", and the b-table file should be renamed as "bvals" and "bvecs". Alternatively, you can store the 4D DWI in arbitrary file name "*.nii.gz", but the corresponding bval and bvec should be "*.bvals" and "*.bvecs", following the FSL format.
(4) If DICOM files are used, please be noted that DSI Studio will rename DICOM files within each subject's folder. You may need to backup your DICOM to avoid missing files.

To initiate batch SRC files construction, click on the [Batch Processing][Step B2: Create SRC/NIFTI files] select the folder that stores all subjects folder to initiate the process. DSI Studio will create a new "SRC" files under the selected folderto store all created SRC file. 

Optional: Interpolating dMRI signals

DSI Studio can up-sample the dMRI signals to achieve a high spatial resolution. Once an SRC files is created (following the steps mentioned above), you may use the following steps to get a new SRC file with interpolated dMRI signals that achieves x2 or x4 upsampling

    1. Open the created SRC file in [step 2 reconstruction]
    2. Export a 4D nifti file using [Files][Save 4D nifti] and a b-table file using [Files][save b-table]    (For Mac and linux users, the [Files] menu is on the very top of the system menu)
    3. Open the 4D nifti file in step 1 open source images.
    4. Load the created b-table file using [Files][Open b-table]
    5. In the left bottom corner, select upsample 2 or upsampling 4
    6. Create a new SRC file that has interpolated dMRI signals (which leads to interpolated ODF)

Optional: Aggregating multiple scans

DSI Studio allows for merging multiple scans of the same subjects. There are two ways to merge them. The first way assumes that the head position is the same for the scans (e.g. the subject was scanned twice consecutively). 

To merge the scans from NIFTI files or DICOM files:

Click on [Step T1: Open source images] and select the files from the first scan. DSI Studio will open up a dialog showing the DWI loaded. Then in the top menu, click on the item [Files][Open images...] and select the files from the second scans. The dialog will append these new DWIs to the existing list. If you load 4D NIFTI files here, you may need to manually concatenate the b-table and load the merged b-table using [Files][Load b-table...].

To merge scans from two SRC files:

(1) open the SRC file using [Step T2: Reconstruction] and to export a 4D NIFTI file using the top menu [File][Save 4D nifti]. You also need to export the b-table as a single text file here.
(2) repeat the same step for another SRC files.
(3) manually merge two b-table text files using a text editor. Adding one after another.
(4) Back to the DSI Studio main window. Click [Step T1: Open source images] and open the first exported 4D nifti file. DSI Studio will open up a new dialog. Add the second 4D NIFTI using the top menu item [Files][Open Images...].
(5) Load the merged b-table created from (3) using the top menu item [Files][Load b-table...]
(6) Create a joint SRC file which has merged all previous scans.

If the scans were acquired at different time points, additional registration steps are needed to linearly align the head position. The steps are the following:

(1) create separate SRC files for each of the scans
(2) open the SRC file using [Step T2: Reconstruction] and rotate the volume to a common T1w image using the top menu item [Edit][To T1w/T2w space]. DSI Studio will ask for a T1W image volume. 
(3) export the rotated volume using the top menu [File][Save 4D nifti]. You may also need to export the b-table as a text file here.
(4) manually merge the b-table text file using a text editor.
(5) Back to the DSI Studio main window. Click [Step T1: Open source imagesand open the first exported 4D nifti file. DSI Studio will open up a new dialog. Add the second 4D NIFTI using the top menu item [Files][Open Images...].
(6) Load the merged b-table created from (4) using the top menu item [Files][Load b-table...]
(7) Create a joint SRC file which has merged all previous scans.

Optional: Apply slice orientation

DSI Studio will apply slice orientation correction to the b-table:

corrected b-vector = [slice orientation matrix] * original b-vector;

The first two columns of the slice orientation matrix are obtained from the DICOM header (0x0020,0x0037). The third column is the orthogonal vector calculated from the first two columns, making this matrix a unitary matrix. The corrected b-vector is calculated by applying the orientation matrix to the original b-vector.

NIFTI files do not have slice orientation matrix in the header, and DSI Studio will not apply rotation to the b-table if nifti files are used as the input. Thus, the users are recommended to rotate the b-table by multiplying the slice orientation matrix to the b-table.

Optional: Correction for susceptibility artifact

DSI Studio now provides a routine to correct susceptibility artifact similar to FSL's TOPUP. 

To use it, you would need to (1) create an SRC file and (2) prepare a NIFTI file of b0 image acquired at the opposite phase encoding. 

Then open the SRC files in [STEP T2 Reconstruction], click on [Edit][Correct AP-PA scans] and select the b0 acquired with an opposite phase encoding. DSI Studio will handle the rest of the correction job. It does not matter whether AP or PA scan is opened first, DSI Studio will figure it out. 

*Please note that DSI Studio's distortion correction routine CANNOT handle eddy current correction. If your data were acquired without "bipolar pulse", I would suggest using FSL's eddy and TOPUP with the following steps:

1. Convert DICOMS to NIfTI

       In DSI-Studio:

  1. Create SRC file from DICOM files:
    • Use STEP1: Open Source Images
  2. Save b_table using option under File.
    • Filename: DWI_PA_b_table.txt
  3. Load SRC file using STEP2: Reconstruction
  4. Save NIfTI of SRC:
    • Use Save 4D NIfTI open under File
    • Filename: DWI_PA.nii.gz
  5. Save .bvals using option under File
    • Filename: DWI_PA.bvals
  6. Save .bvecs using option under File
    • Filename: DWI_PA.bvecs
  7. Repeat for AP scan
  8. Close DSI Studio

2. Extract b0

In this case we'll just use the first volue b0.

  1. fslroi DWI_AP.nii.gz DWI_b0_AP 0 1
  2. fslroi DWI_PA.nii.gz DWI_b0_PA 0 1
  3. fslmerge -t both_b0 DWI_b0_AP DWI_b0_PA



3. Make param File

  1. Make acq_params.txt

  2. Contents in this case for 121ms TE, AP = -1, PA = 1:

    0 -1 0 0.121

    0 1 0 0.121

4. Run TOPUP

topup --imain=both_b0 --datain=acq_params.txt --config=b02b0.cnf --out=topup_results --fout=field --iout=unwarped_images

*b02b0.cnf is already included in the FSL package.

his step will take a while (if not there may be some problems with the input files).

5. Run Eddy

Create a mask for eddy:

fslmaths unwarped_images -Tmean mean_b0
bet mean_b0 b0_brain -m

Create index file index.txt (see

Now we can run eddy:

eddy --imain=data --mask=b0_brain_mask --acqp=acq_params.txt --index=index.txt --bvecs=bvecs --bvals=bvals --topup=topup_results --repol --out=eddy_corrected_data

Optional: matlab code for reading 2dseq and converting the image to src format

    Bruker scanner exported image files as "2dseq" binary files. The following code can be used to transform 2dseq file to .src file for further reconstruction. 

num_dif = 7;
dimension = [128 128 100]; % [x y z] the dimension of the 2dseq file, suppose average=1
voxel_size = [0.1 0.1 0.1]; % [x y z] pixel spacing in mm
f1 = fopen('2dseq','r');

% slope is a dimension(3) x num_dif matrix that defines the scaling parameters 
% input the slope here
slope=[81.3139111191806 81.3139111191806 81.3139111191806 81.3139111191806
slope = slope./min(min(slope));
slope = reshape(slope',dimension(3),num_dif);
for i = 1:dimension(3)
for j = 1:num_dif
    A(:,:,i,j) = A(:,:,i,j)/slope(i,j);

% image0 ~ imageN, where N is the number of diffusion gradient encoding
image0 = reshape(A(:,:,:,1),prod(dimension),1);
image1 = reshape(A(:,:,:,2),prod(dimension),1);
image2 = reshape(A(:,:,:,3),prod(dimension),1);
image3 = reshape(A(:,:,:,4),prod(dimension),1);
image4 = reshape(A(:,:,:,5),prod(dimension),1);
image5 = reshape(A(:,:,:,6),prod(dimension),1);
image6 = reshape(A(:,:,:,7),prod(dimension),1);

% if averaging on the repeat images is needed, run
% repeat = 5;
% dimension(3) = dimension(3)/repeat; 
% image0 = reshape(sum(reshape(image0,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image1 = reshape(sum(reshape(image1,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image2 = reshape(sum(reshape(image2,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image3 = reshape(sum(reshape(image3,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image4 = reshape(sum(reshape(image4,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image5 = reshape(sum(reshape(image5,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;
% image6 = reshape(sum(reshape(image6,dimension(1),dimension(2),dimension(3),repeat),4),prod(dimension),1)/repeat;

% the b-table should be arranged in the format of [b-value1 bx by bz; b-value2 bx by bz;...;b-valueN bx by bz] 

b_table=[0 0 0 0
1000 0.337968743631421 0.337968743631421 0
1000 0 0.337968743631421 0.337968743631421
1000 0.337968743631421 0 0.337968743631421
1000 -0.337968743631421 0.337968743631421 0
1000 0 -0.337968743631421 0.337968743631421
1000 0.337968743631421 0 -0.337968743631421
]';% [b_value bx by bz; b_value bx by bz; ...]
b_table(4,:) = -b_table(4,:);    % note that the z-dimension should be flipped for images from bruker 
clear A;
clear ans;
clear f1;
save '1.src' '-v4'
    The saved .src file can be used by DSI Studio for further reconstruction. Bruker images may have been scaled during the post-processing. The scaling parameters are recorded in reco file (RECO_slope). If this is the case, you have to scale the image back to get the correct reconstruction result.