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

Rename DICOM Files

Before using the DICOM files, I would recommend rename them using [Tool: Batch processing][Rename DICOM files] and select all the DICOM files that are ready to be renamed, and then the file will be moved into its related folders. You may also use [Rename DICPOM in subfolders] 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). 
*You may skip this DICOM renaming steps, but DSI Studio may not be able to figure out the correct slice order if you are using GE or Phillips scanners.

Read DICOM Files

To read DICOM files, click the [Step 1 Open Source Images] 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 will show gradient vectors extracted from the DICOM headers. You may also assign a different vector table by using the top [Files] menu. You can also aggregate more diffusion images using [Files][Open images]. Occasionally, the DICOM headers do not have any 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.  

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

Read 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: 

Read Varianand Agilent FDF files

    DSI Studio can parse FDF files. To load the images, in the main window, click on the "STEP1" button and select all fdf files in the folder. DSI Studio should be able to get the b-table information and the DWI from the files.

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.

Optional: Loading large amount of 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 select all the DICOM files. To make this selection easier, you can select only part of the DICOM files in [Step1 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.

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

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: 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 from NIFTI files or DICOM files:

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

To merge scans from two SRC files:

(1) open the SRC file using STEP2 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 "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...].
(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 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 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.

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

The EPI susceptibility artifact causes a strong distortion in the frontal lobe and temporal lobe, and its correction requires two sets of dMRI scans acquired at two opposite phase encoding directions (AP and PA direction, or LR and RL directions). 

DSI Studio now provides a routine to correct susceptibility artifact similar to FSL's TOPUP. To use it, you would need to create one SRC file from the AP scan 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 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"to eliminate eddy current, the data will need a simultaneous eddy current correction and gradient distortion correction. It is recommended to do this using FSL's eddy and TOPUP.

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.