Skip to content

Commit

Permalink
Update to make life easier for multiUsers
Browse files Browse the repository at this point in the history
-pathFile.mat will now store the personal folder paths for the auto
pipeline
-other files modified to work accordingly
  • Loading branch information
Stereo-Boy authored and Stereo-Boy committed Oct 6, 2015
1 parent 2afba68 commit a967132
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
21 changes: 16 additions & 5 deletions zUsers/Adrien/automatedPipeline2015_1.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function automatedPipeline2015_1
function automatedPipeline2015_1(subjectID)
% ------------------------------------------------------------------------------------------------------------
% fMRI processing pipeline whose goal is to automatize steps as much as
% possible
Expand All @@ -10,9 +10,20 @@
clc
% ------------------------------------------------------------------------------------------------------------
% REPLACE THE FOLLOWING VARIABLE WITH YOUR VALUES
subject_folder = '/Users/adrienchopin/Desktop/Big_data_STAM/RN31/pre1/NewPipeline'; %no end slash
megavista_folder = '/Users/adrienchopin/Desktop/Megavista'; %no end slash
subjectID='RN31test';
disp('At that stage, DICOM files should be in the subject folder in a folder called 01_Raw_DICOM and the par files in the folder 01_PAR')
disp('Epi should be called epi01-whatever, epi02-whatever, ..., gems should be called gems-whatever and mprage, gems_mprage-whatever.')
answer = input('You should be in the subject folder for the subject that you want to analyse. 1 = ESC; any other key = OK ');
if answer == 1; error('ESCAPE'); end
%subject_folder = '/Users/adrienchopin/Desktop/Big_data_STAM/RN31/pre1/NewPipeline'; %no end slash
subject_folder = cd;

if ~exist('subjectID','var'); subjectID = 'default'; disp('Defaults subject ID...'); end

%Write the following line (not commented, with your correct path) in the
%command line to save the variable in a file called pathFile - move that
%file to your zUsers folder
%megavista_folder = '/Users/adrienchopin/Desktop/Megavista'; %no end slash
load('pathFile','megavista_folder')
% ------------------------------------------------------------------------------------------------------------


Expand Down Expand Up @@ -193,7 +204,7 @@
answer = input('Figure: Is everything OK? (y)es / (n)o: ', 's');
if strcmp(answer, 'n')==1; error('Something went wrong, according to you...');end
else %NOT GOOD
error('python motioncorrect.py: Something went wrong with last step')
error('python motionparams.py: Something went wrong with last step')
end
else %NOT GOOD
error('python motioncorrect.py: Something went wrong with last step')
Expand Down
5 changes: 3 additions & 2 deletions zUsers/Adrien/extractPARfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function extractPARfile(stamFile,rootEpi)
end
else
disp('Only one epi found')
dataSplit = data;
end

fixationDuration = 15.7;
Expand Down Expand Up @@ -98,8 +99,8 @@ function extractPARfile(stamFile,rootEpi)

parfileCorrelated
parfileUncorrelated
writeMatToFile(parfileCorrelated,[rootEpi,sprintf('%02.f',run),'_Correlated.txt'])
writeMatToFile(parfileUncorrelated,[rootEpi,sprintf('%02.f',run),'_Uncorrelated.txt'])
writeMatToFile(parfileCorrelated,[rootEpi,sprintf('%02.f',run),'_Correlated.par'])
writeMatToFile(parfileUncorrelated,[rootEpi,sprintf('%02.f',run),'_Uncorrelated.par'])
end
end

Expand Down
Binary file added zUsers/Adrien/pathFile.mat
Binary file not shown.
18 changes: 11 additions & 7 deletions zUsers/Sara/automatedPipeline2015_1.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
clc
% ------------------------------------------------------------------------------------------------------------
% REPLACE THE FOLLOWING VARIABLE WITH YOUR VALUES
subject_folder = '/Users/localadmin/Desktop/EM21/Pre1'; %no end slash
megavista_folder = '/Users/localadmin/megavista'; %no end slash
subjectID='EM21';
% subject_folder = '/Users/localadmin/Desktop/EM21/Pre1'; %no end slash
% megavista_folder = '/Users/localadmin/megavista'; %no end slash
% subjectID='EM21';
subject_folder = '/Users/adrienchopin/Desktop/Big_data_STAM/RN31/pre1/NewPipeline'; %no end slash
megavista_folder = '/Users/adrienchopin/Desktop/Megavista'; %no end slash
subjectID='RN31test';
% ------------------------------------------------------------------------------------------------------------


Expand Down Expand Up @@ -232,7 +235,8 @@
%added because deleting this folder manually everytime
%i wanted to redo this step during debugging was very
%annoying -- Sara Popham
[success, status]=rmdir([subject_folderMocoCheck,'/',mocoCheckFolder,'_nifti'],'s'); if success; disp('Deleted');else error(status); end
%ERROR HERE - [success, status]=rmdir([subject_folderMocoCheck,'/',mocoCheckFolder,'_nifti'],'s'); if success; disp('Deleted');else error(status); end
[success, status]=rmdir(subject_folderMocoCheck,'s'); if success; disp('Deleted');else error(status); end
case {2} %dont go, move to next step
doMotionCorrectionCheck = 0;
disp('Skipped');
Expand All @@ -253,9 +257,9 @@
[success, status]=copyfile([subject_folderMoco,'/*_mcf.nii.gz'],[subject_folderMocoCheck,'/',mocoCheckFolder,'_nifti']); if success; disp('Done');else error(status); end
[success, status]=copyfile([subject_folderDICOM,'/epi01*'],[subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom']); if success; disp('Done');else error(status); end
%rename epi_01_whatever to epi_01_whatever_mcf
epiFolder = dir([subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/epi01*']);
movefile([subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/',epiFolder.name],[subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/',epiFolder.name,'_mcf']);
disp('Starting motioncorrect.py in:');
epiFolder = dir([subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/epi01*']);
movefile([subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/',epiFolder.name],[subject_folderMocoCheck,'/',mocoCheckFolder,'_dicom/',epiFolder.name,'_mcf']);
disp('Starting motioncorrect.py in:');
cd(preprocessPath);
success = system(['python motioncorrect.py ', subject_folderMocoCheck]);
if success==0 %GOOD
Expand Down

0 comments on commit a967132

Please sign in to comment.