Documentation‎ > ‎

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 FDF files

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


To parse DICOM files, click the step 1 button in the main window to open the image 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 shows gradient vectors in the image space. DSI Studio reads in the b-table from the headers. DSI Studio is able to retrieve the b-table from DICOM, Bruker method file, and Varian FDF files. The top [Files] menu provides functions to load an external table. You can add more diffusion images using [Files][Open images]

There are cases that the headers do not have b-table information, and the users are required to provide a b-table text file using with the following format (bvalue bvectorx bvectory bvectorz):

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

The first column is the b-value, and the rest are bx, by and bx of the directional vectors. You can load in the table using [Files][Open b-table];

Once the b-table is loaded, click the Ok button, and DSI Studio will generate a .src file for further reconstruction. This .src file is in fact a .mat file. You may load it in Matlab using the step described in this page.

Rename DICOM files according to their pulse sequences
DSI Studio is able to rename DICOM files and place them in different folders according to their pulse sequences. The function is placed under the "tools" menu, where you can see an item named  "rename DICOM Files".
To perform this function, select all the DICOM files that are ready to be renamed, and then the file will be moved into its related folders. It is highly recommended that the DICOM images are renamed first.

Applying slice orientation

Started from the September 2011 version, DSI Studio will apply slice orientation correction to the b-table. This approach is suggested by Dr. Kwan-Jin Jung at CMU to consider the slice tilting condition. The detail of the correction is the following. 

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 may 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.

Problems in loading GE, Philips, and Toshiba DICOM images

   GE, Philips, and Toshiba scanners often output each slice to an individual DICOM image, and the resulting DTI dataset may contain thousands of image files, causing trouble in parsing DICOM files. The solution is the following:

1. In Step1 open DICOM files, select some DICOM files. 
2. DSI Studio will ask whether you would like to load all other DICOM images. Select yes.
3. Load an external b-table to construct the src file.

   The Toshiba DICOM files may need to be corrected for their b-table orientation by clicking on "swap xy" and "flip z". The user should check out the output fiber orientation to see if the orientation is correct.

   You may need to rename DICOM files first by using the "rename DICOM" function provided by DSI Studio.

B-table problem in the SIEMENS WIP sequence

   Users of the Siemens WIP sequence may experience reconstruction error if the a full sampling scheme is used to acquire the full DSI. The cause to this problem is the b-table in the dicom header. When the WIP sequence acquires the full sampling DSI, it is, in fact, acquiring a half sampling and copying the acquired images to another half to make it a full one. However, the image copy fails to copy the b-table to the Dicom header and results in incorrect reconstruction. This is a known problem in the certain version of the WIP sequence using the full sampling. TrackVis is not affected by this because it is using its own built-in table and does not make use of the one in the Dicom header.

    The solution is the following, after reading the DICOM files, replace the b-table by clicking the "load b-table" button. The correct b-table can be found here. (choose the 515 one if q5 full is used). Replacing the b-table can solve this problem.

4D NIFTI files

    DSI Studio can use 4D nifti file. An example of this type of data is the human connectome project data. NIFTI file header does not contain b-table information, and thus, another text file is often needed to provide the b-table information (Please see the DICOM section for the format). The file can be loaded using the top menu [Files][Open b-table];

    Alternatively, DSI Studio will search in the same directory for b-value files named "bvals" or "bvals.txt" as well as "bvecs" or "bvecs.txt". The b value and b vector can also be loaded using the function under the top menu.

    DSI Studio can also use the gradient nonlinearity information. It will search under the same folder for a file named "grad_dev.nii.gz". A mask file named "nodif_brain_mask.nii.gz" can also be included. 

Bruker 2dseq files

    DSI Studio also supports Bruker images (2dseq file). To load the images, in the main window, click on the "STEP1" button and assign the "subject" file in the folder. DSI Studio will then scan all sessions under this subject and include all diffusion scans. If you have multiple diffusion scans, you may choose to 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 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.

    If you prefer to handle the 2dseq by yourself (e.g. perform addition noise reduction or distortion correction), you may parse the 2dseq using Matlab. The example is provided as follows:

Case 1: read 2dseq and convert 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.

Merge 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, first click on "STEP1 Open source image" 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...].

If you would like to merge scans of the same subject but the scans were acquired at different time points, additional steps are needed to linearly coregister the head position. The steps are the following:

(1) create separate SRC files for each of the scan
(2) open the SRC file using STEP2 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 "STEP1: 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...].
(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.

Flip b-table

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

Batch creating SRC files

DSI Studio supports batch processing to create SRC files. To use this function, the subjects' NIFTI files should be renamed according to any of the following naming convention:

1. DWI file renamed as "data.nii.gz", and the b-table file should be renamed as "bvals" and "bvecs", following the FSL format. 
2. DWI file renamed as "*.nii" or "*.nii.gz", and the b-table file should be renamed as "*.bvals" and "*.bvecs", following the FSL format. * here can be any file name.

These three files should be placed under a subfolder named by the subject ID. Click on the "Create SRC files" button under the "Tools: Batch Processing" tab and select the folder that contains all subjects subfolder to initiate the batch function. The SRC files will be created within each of the subject folders as "data.src.gz" or "*.src.gz".

Correction for susceptibility artifact

The EPI susceptibility artifact causes a strong distortion in the frontal lobe and temporal lobe, and its correction requires two set of dMRI scans acquired at opposite phase encoding directions (AP and PA direction, or LR and RL directions). DSI Studio can correct susceptibility artifact similar to FSL's TOPUP. To use it, you would need to create an SRC files for the AP scan (scan with phase encoding direction at AP) and another SRC file for the PA scan (The LR and RL scans are also supported). Then open one of the SRC files in STEP2 Reconstruction, click on [Edit][Correct AP-PA scans] and select another SRC file. DSI Studio do the rest of the correction job. It does not matter whether AP or PA scan are opened in the first place, 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

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)

Quality Control for SRC files

It is recommend that the SRC files are examined by a quality control procedure to ensure its integrity and quality. To do this, use [Tools: Batch Processing][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
100206 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.940147
100307 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94786
100408 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.939901
100610 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.936777
101006 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94627
101107 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.936007
101309 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.892282
101410 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.952898
101915 145 174 145 1.25 1.25 1.25 271 3 3010 Yes 0.94145
102008 145 174 145 1.25 1.25 1.25 180 3 3010 No 0.937926

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. It is recommended to use an outlier checking function (e.g. 3 median absolute deviation) to spot problematic data or simply sort this values and inspect subjects with low correlations to see if there is any quality issue.  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 niehgboring DWI correlation, you will need to examine the raw DWI images. To inspect individual SRC file, open it in STEP2 reconstruction and switch to the first tab that shows the raw images. You may scroll through all DWI to see if there is prominent movement, signal dropout, or any other issues. A good DWI data set should have normal signals intensity decrease as b-value goes up. Any abnormal signals drop indicates possible problem.