diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b047465..72dc01a3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,7 +7,7 @@ page `v0.32`_ -------- -Apr 10, 2020 +Apr 21, 2020 **Added**: @@ -21,6 +21,9 @@ Apr 10, 2020 * ``json2fslgrad`` now transposes B0s in BVAL file in accordance with FSL's gradient scheme * Documentation update +* ``Extras`` directory renamed to ``extras`` +* DKE conversion scripts modified to correctly create ft and dke + parameter files **Removed**: diff --git a/Extras/des2dke.m b/extras/des2dke.m similarity index 81% rename from Extras/des2dke.m rename to extras/des2dke.m index 2384bf6b..babc8e39 100644 --- a/Extras/des2dke.m +++ b/extras/des2dke.m @@ -86,7 +86,7 @@ function des2dke(inDir) save(fullfile(p,'gradient_dke.txt'),'Gradient1','-ASCII'); %% Create DKE Parameter File -fprintf('4: Creating parameter files\n'); +fprintf('4: Creating DKE parameter files\n'); fid=fopen('dke_parameters.txt'); %Original file fout=fullfile(dke_Path,'dke_parameters.txt');% new file @@ -96,9 +96,28 @@ function des2dke(inDir) s=fgetl(fid); s=strrep(s,'dir-sub-changeme',dke_Path); %s=strrep(s,'A201', subject_list{i}) replace subject s=strrep(s,'ndir = changeme',sprintf('ndir = %d',length(b1_idx_new))); + s=strrep(s,'bval = changeme',sprintf('bval = [%s]', num2str(unique(bval)))); s=strrep(s,'fn-gradients-changeme',fullfile(dke_Path,'gradient_dke.txt')); + s=strrep(s,'fwhm_img = res-changeme',sprintf('fwhm_img = 0 * [%s]', num2str(hdr.PixelDimensions(1:3),3))); fprintf(fidout,'%s\n',s); end fclose(fid); fclose(fidout); fprintf('.....Completed.....\n'); + +%% Create FT Parameter File +fprintf('4: Creating FT parameter files\n'); +fid=fopen('ft_parameters.txt'); %Original file +fout=fullfile(dke_Path,'ft_parameters.txt');% new file + +fidout=fopen(fout,'w'); + +while(~feof(fid)) + s=fgetl(fid); + s=strrep(s,'dir-sub-changeme',dke_Path); %s=strrep(s,'A201', subject_list{i}) replace subject + fprintf(fidout,'%s\n',s); +end +fclose(fid); +fclose(fidout); +fprintf('.....Completed.....\n'); + diff --git a/Extras/dke_parameters.txt b/extras/dke_parameters.txt similarity index 96% rename from Extras/dke_parameters.txt rename to extras/dke_parameters.txt index fd88bab8..2a1bbadc 100755 --- a/Extras/dke_parameters.txt +++ b/extras/dke_parameters.txt @@ -15,7 +15,7 @@ preprocess_options.fn_nii = 'dke.nii'; % four-dimensional nifti image fi % imaging diffusion weightings and directions -bval = [0 1000 2000]; % diffusion weightings (b-values) in s/mm^2 units; the first element of vector must always be 0 +bval = bval-changeme; % diffusion weightings (b-values) in s/mm^2 units; the first element of vector must always be 0 ndir = changeme; % number of gradient directions; if a scalar value is specified, the number of gradient directions for all b values is set to the scalar; otherwise, a 1-by-(nbval-1) vector should be specified, with each element of the vector corresponding to the number of gradient directions for a nonzero b-value @@ -63,7 +63,7 @@ dti_method.noise_tolerance = 0.09; % threshold for outlier detection % diffusion-weighted image filtering -fwhm_img = 0 * [2.0 2.0 2.0]; % full width at half maximum (FWHM) (in mm) of Gaussian kernel for smoothing diffusion-weighted images (default: 1.25 * voxel size); a zero value indicates no smoothing +fwhm_img = res-changeme; % full width at half maximum (FWHM) (in mm) of Gaussian kernel for smoothing diffusion-weighted images (default: 1.25 * voxel size); a zero value indicates no smoothing % Rician noise subtraction @@ -72,7 +72,7 @@ fwhm_noise = 0; % FWHM (in mm) of Gaussian kernel % parametric map filtering -median_filter_method = 0; % selective median filtering applied to voxels that violate the minimum directional kurtosis constraints (default: 2): (0) no filtering; (1) weak filtering (voxels with less than 15 unviolated constraints will be filtered); (2) strong filtering (voxels with any constraint violation will be filtered) +median_filter_method = 1; % selective median filtering applied to voxels that violate the minimum directional kurtosis constraints (default: 2): (0) no filtering; (1) weak filtering (voxels with less than 15 unviolated constraints will be filtered); (2) strong filtering (voxels with any constraint violation will be filtered) % parametric map interpolation diff --git a/extras/ft_parameters.txt b/extras/ft_parameters.txt new file mode 100644 index 00000000..1fd80cb3 --- /dev/null +++ b/extras/ft_parameters.txt @@ -0,0 +1,40 @@ +%-------------------------------------------------------------------------- +%USER OPTIONS +%-------------------------------------------------------------------------- +studydir = 'dir-sub-changeme'; %Full path to directory containing DT.mat, KT.mat, and fa.nii files. +subject_list = {''}; %Specify subject numbers (i.e. {'Subject01','Subject02','Subject03',...}). + +%ODF Optimizatinon + + odf_optimization = 1; %Analyze the kurtosis dODF (1) or skip odf optimization (0). This step must be performed prior to tractography. + sd = 4; %[3,4, or 5] Sampling distribution to use. See sphericalgrid3(4,5).m documentation for more info. + quasiNewton = 1; %Apply non-linear optimization to increase accuracy of peak detection (1) or use orientations directly from the pre-defined sampling distribution (0). + radial_weight = 4; %Radial weighting power.Recommended radial_weight = 4. + release_memory = 0; %Do not release memory (0), release memory after each subject (1), or release memory more frequently (2). See User's Guide for additional info. + wrt_flg = 1; %Write outputs (1) or don't write outputs (0). + pre_name = ''; %String to append to the beginning of output names. + post_name = ''; %String to append to the end of output names. + +%Tractography + + tractography_flg = 1; %Perform tractography (1) or don't perform tractography (0). + fa_threshold = 0.1; %FA threshold. + angle_threshold = 35; %Angle threshold in degrees. + trk_length = 20; %Minimum tract length in mm. + step_size = 1; %Step size in mm (0 defaults to half of the voxel length). + trk_mask = ''; %Path to tracking mask to apply in addition to other tract termination criteria defined above. Should be in the same orientation as the fa.nii image. + seed_mask = ''; %Mask within which to put seeds. Should be in the same orientation as the fa.nii image + seednum = 1E5; %Number of random seed points in the tracking mask. + shift = 0.5; %Shift applied to voxel coordinates in .trk file. + output_DTI_trks = 1; %Include tractography performed from just the diffusion tensor (1) or don't (0). + image_orientation = 'LAS'; %Orientation of input image volumes. By convention, spm writes images in 'LAS.' + odf_orientation = 'RAS'; %Orientation of the gradient table used to estimate the diffusion and kurtosis tensors. If SPM is used to estimate the gradient tables, this should be 'LAS.' + + +%Make DSI Studio .fib file + + make_fib_file = 1; %Make .fib file to read in DSI Studio (1) or skip this step (0). + save_odfs = 1; %Save dODFS in .fib file (1) or not (0). This only affects visualization as orientations are still saved for tractography. + scale_odf = 0.5; %Affects overall size of odfs in .fib file. This only affects visualization. + odf_size = 20000; %Size of odf_n variables. Reduce this if there are issues with RAM. + odf_res = 'low'; %{'low' or 'high'}; Number of points saved in ODFs ~ only affects visualization. Use 'low' to reduce memory requirements and use 'high' for the smoothest dODF surface renderings. \ No newline at end of file