ds003604/code/dwi_qa/DTI_qa_composite.m
2021-04-08 18:48:11 +00:00

36 lines
1.1 KiB (Stored with Git Annex)
Matlab

%%This code will be used to read in the output txt file from of the mriqc
% after running singularity mriqc-py3.simg mriqc <input> <output> group
% Then decide which T1 is the better one
filepath='/gpfs51/dors2/gpc/JamesBooth/JBooth-Lab/BDL/ELP/bids/derivatives/dwi_mv_snr/';
output_name='dwi_qa_ses-7_comp.txt';
readfile='dwi_qa_ses-7.tsv';
session='ses-7';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%do not modidy below this line %%%%%%%%%%
cd(filepath);
fid=fopen(output_name,'w');
hdr='participant_id run_name quality_score';
fprintf(fid,'%s \n', hdr);
qc_data=tdfread([filepath, readfile]);
qc_data.zabs_rms_mean=zscore(qc_data.abs_rms_mean);
qc_data.zoutlier_pct=zscore(qc_data.outlier_pct);
% qc_data.zsnr=zscore(qc_data.b0_snr_mean);
qc_data.zcnr=zscore(qc_data.dwi_cnr_mean);
qc_data.quality=qc_data.zcnr-(qc_data.zabs_rms_mean + qc_data.zoutlier_pct);
names=qc_data.run_name;
quality=qc_data.quality;
for j=1:length(names)
if contains(names(j,:),session)
sub=names(j,5:8);
run_name=names(j,:);
value=quality(j);
fprintf(fid,'%s %s %f\n',sub,run_name, value);
end
end