Skip to content
Snippets Groups Projects
PPMI_NODDI.m 2.72 KiB
Newer Older
addpath(genpath('NODDI_toolbox_v1.01'));
importPPMIlist
PatientNumber=VarName1;
%for i=1:floor(length(PatientNumber)/3)
% 
% [bVal, bGradX, bGradY, bGradZ] = textread(strcat('/data/project/dti/For_William/rotateDWIv2/BMTXT/',int2str(PatientNumber(i)),'.rotatetwo.BVEC.txt'),'%f %f %f %f');
% lengthB = length(bGradX);
% 
% fileID = fopen(strcat('/data/project/dti/For_William/rotateDWIv2/BMTXT/',int2str(PatientNumber(i)),'.rotatetwo.bval'),'w');
% 
% formatSpec = '%f ';
% 
%         for j=1:lengthB
%             fprintf(fileID,formatSpec,bVal(j));
%         end
%         fclose(fileID);
% 
% clear fileID
% 
% fileID = fopen(strcat('/data/project/dti/For_William/rotateDWIv2/BMTXT/',int2str(PatientNumber(i)),'.rotatetwo.bvec'),'w');
% 
% formatSpec = '%f ';
% 
%         for j=1:lengthB
%             fprintf(fileID,formatSpec,bGradX(j));
%         end
%         
%         fprintf(fileID,'\n');
%         
%         for j=1:lengthB
%             fprintf(fileID,formatSpec,bGradY(j));
%         end
%         
%         fprintf(fileID,'\n');
%         
%         for j=1:lengthB
%             fprintf(fileID,formatSpec,bGradZ(j));
%         end
%         fclose(fileID);
% 
% clear fileID

CreateROI(strcat('/data/project/dti/For_William/rotateDWIv2/finalrotatedDWIv2/',int2str(PatientNumber(i)),'.DWI.rotat.med.nii'),strcat('/data/project/dti/For_William/rotateDWIv2/brainMasks/',int2str(PatientNumber(i)),'.brainmask.nii'),strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.NODDIroi.mat'));
%CreateROI('/data/project/dti/For_William/rotateDWIv2/finalrotatedDWIv2/3111.DWI.rotat.med.nii','/data/project/dti/For_William/rotateDWIv2/brainMasks/3111.brainmask.nii','NODDIroi1.mat')
protocol = FSL2Protocol(strcat('/data/project/dti/For_William/rotateDWIv2/BMTXT/',int2str(PatientNumber(i)),'.rotatetwo.bval'),strcat('/data/project/dti/For_William/rotateDWIv2/BMTXT/',int2str(PatientNumber(i)),'.rotatetwo.bvec'))
noddi = MakeModel('WatsonSHStickTortIsoV_B0');
batch_fitting(strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.NODDIroi.mat'),protocol,noddi,strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.FittedParams.mat'),24);
SaveParamsAsNIfTI(strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.FittedParams.mat'),strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.NODDIroi.mat'),strcat('/data/project/dti/For_William/rotateDWIv2/brainMasks/',int2str(PatientNumber(i)),'.brainmask.nii'),strcat('/data/project/dti/For_William/rotateDWIv2/FreeWaterResults_WB/',int2str(PatientNumber(i)),'.noddi'))