Skip to content

Commit

Permalink
Fix bugs in external calls to FSL binaries in Matlab scripts used in …
Browse files Browse the repository at this point in the history
…ReApplyFix
  • Loading branch information
tbbrown committed Nov 26, 2015
1 parent 863f502 commit 0654f55
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
8 changes: 8 additions & 0 deletions ReApplyFix/ReApplyFixPipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,15 @@ main()
cd ${StudyFolder}/${Subject}/MNINonLinear/Results/${fMRIName}/${fMRIName}_hp${HighPass}.ica

if [ -f ../${fmri_orig}_Atlas${RegString}.dtseries.nii ] ; then
log_Msg "FOUND FILE: ../${fmri_orig}_Atlas${RegString}.dtseries.nii"
log_Msg "Performing imln"
$FSLDIR/bin/imln ../${fmri_orig}_Atlas${RegString}.dtseries.nii Atlas.dtseries.nii


log_Msg "START: Showing linked files"
ls -l ../${fmri_orig}_Atlas${RegString}.dtseries.nii
ls -l Atlas.dtseries.nii
log_Msg "END: Showing linked files"
fi

$FSLDIR/bin/imln ../$fmri filtered_func_data
Expand Down
Binary file not shown.
Binary file not shown.
14 changes: 13 additions & 1 deletion ReApplyFix/scripts/fix_3_clean_no_vol.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ function fix_3_clean(fixlist,aggressive,domot,hp)
CIFTI=getenv('FSL_FIX_CIFTIRW');
WBC=getenv('FSL_FIX_WBC');

func_name='fix_3_clean';
fprintf('%s - fixlist: "%s"\n', func_name, fixlist);
fprintf('%s - aggressive: %d\n', func_name, aggressive);
fprintf('%s - domot: %d\n', func_name, domot);
fprintf('%s - hp: %d\n', func_name, hp);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% read set of bad components
DDremove=load(fixlist);

%%%% find TR of data
[grot,TR]=call_fsl('fslval filtered_func_data pixdim4'); TR=str2num(TR)
fprintf('%s - After "fslval filtered_func_data pixdim4" - TR: %d\n', func_name, TR);

%%%% read and highpass CIFTI version of the data if it exists
DObrainord=0;
Expand All @@ -46,7 +53,12 @@ function fix_3_clean(fixlist,aggressive,domot,hp)
meanBO=mean(BO.cdata,2);
BO.cdata=BO.cdata-repmat(meanBO,1,size(BO.cdata,2));
save_avw(reshape([BO.cdata ; zeros(100*BOdimZnew-BOdimX,BOdimT)],10,10,BOdimZnew,BOdimT),'Atlas','f',[1 1 1 TR]);
call_fsl(sprintf('fslmaths Atlas -bptf %f -1 Atlas',0.5*hp/TR));

% call_fsl(sprintf('fslmaths Atlas -bptf %f -1 Atlas',0.5*hp/TR));
cmd_str=sprintf('fslmaths Atlas -bptf %f -1 Atlas',0.5*hp/TR);
fprintf('%s - About to execute: %s\n',func_name,cmd_str);
system(cmd_str);

grot=reshape(read_avw('Atlas'),100*BOdimZnew,BOdimT); BO.cdata=grot(1:BOdimX,:); clear grot; BO.cdata=BO.cdata+repmat(meanBO,1,size(BO.cdata,2));
ciftisave(BO,'Atlas_hp_preclean.dtseries.nii',WBC); % save out noncleaned hp-filtered data for future reference, as brainordinates file
end
Expand Down
4 changes: 2 additions & 2 deletions ReApplyFix/scripts/fix_3_clean_no_vol.prj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment-project plugin="plugin.deploytool" plugin-version="1.0">
<configuration target="target.standalone" target-name="Standalone Application" name="fix_3_clean_no_vol" location="/home/tbrown01/ReApplyFix" file="/home/tbrown01/ReApplyFix/fix_3_clean_no_vol.prj" build-checksum="1715923563">
<configuration target="target.standalone" target-name="Standalone Application" name="fix_3_clean_no_vol" location="/home/tbrown01/ReApplyFix" file="/home/tbrown01/ReApplyFix/fix_3_clean_no_vol.prj" build-checksum="1819143838">
<param.project.name>/home/tbrown01/ReApplyFix/fix_3_clean_no_vol.prj</param.project.name>
<param.target.type>Standalone Application</param.target.type>
<param.appname>fix_3_clean_no_vol</param.appname>
Expand Down Expand Up @@ -443,7 +443,7 @@
<vista>false</vista>
<linux>true</linux>
<solaris>false</solaris>
<osver>2.6.32-504.23.4.el6.x86_64</osver>
<osver>2.6.32-573.7.1.el6.x86_64</osver>
<os32>false</os32>
<os64>true</os64>
<arch>glnxa64</arch>
Expand Down
12 changes: 11 additions & 1 deletion ReApplyFix/scripts/functionmotionconfounds.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
TR = str2num(TR)
end
end

func_name='functionmotionconfounds';
fprintf('%s - TR: %d\n', func_name, TR);
fprintf('%s - hp: %d\n', func_name, hp);

%%%% must have "hp" and "TR" already set before calling this

[grota,grotb]=call_fsl('imtest mc/prefiltered_func_data_mcf_conf_hp');
Expand All @@ -30,7 +35,12 @@
end
if hp>0
save_avw(reshape(confounds',size(confounds,2),1,1,size(confounds,1)),'mc/prefiltered_func_data_mcf_conf','f',[1 1 1 TR]);
call_fsl(sprintf('fslmaths mc/prefiltered_func_data_mcf_conf -bptf %f -1 mc/prefiltered_func_data_mcf_conf_hp',0.5*hp/TR));

%call_fsl(sprintf('fslmaths mc/prefiltered_func_data_mcf_conf -bptf %f -1 mc/prefiltered_func_data_mcf_conf_hp',0.5*hp/TR));
cmd_str=sprintf('fslmaths mc/prefiltered_func_data_mcf_conf -bptf %f -1 mc/prefiltered_func_data_mcf_conf_hp',0.5*hp/TR);
fprintf('%s - About to execute: %s\n',func_name,cmd_str);
system(cmd_str);

confounds=functionnormalise(reshape(read_avw('mc/prefiltered_func_data_mcf_conf_hp'),size(confounds,2),size(confounds,1))');
end
end
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.13.1
v3.13.2

0 comments on commit 0654f55

Please sign in to comment.