From f3502271f55b1d1d948bf64aa671aa7b3b677c7d Mon Sep 17 00:00:00 2001 From: Daniel Hasegan Date: Tue, 11 Jan 2022 12:47:53 -0800 Subject: [PATCH 1/5] Invert tmask to interpolate the correct timepoints --- core/functions/temporal_mask | 3 ++- utils/interpolate.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/functions/temporal_mask b/core/functions/temporal_mask index 1c0df3ed..0a42a9be 100644 --- a/core/functions/temporal_mask +++ b/core/functions/temporal_mask @@ -187,7 +187,8 @@ USAGE -s ${q_mask_sum} \ -t 0.5 \ -o ${tmask[cxt]} \ - -m ${censor_contig[cxt]} + -m ${censor_contig[cxt]} \ + -i TRUE configure censored 1 ################################################################ # Determine the number of volumes that fail the motion criterion diff --git a/utils/interpolate.py b/utils/interpolate.py index 77418adb..0204909d 100755 --- a/utils/interpolate.py +++ b/utils/interpolate.py @@ -100,7 +100,8 @@ def get_parser(): if n_samples_seen == 0: raise ValueError('No interpolation is necessary for this dataset.') if n_samples_seen / nvol > 0.7: - raise ValueError('More than 70% of the timepoints are to be interpolated.') + raise ValueError('More than 70% ({}%) of the timepoints are to be interpolated.'.format( + n_samples_seen / nvol)) ########################################################################## # Temoral indices of all observations, seen and unseen ########################################################################## From 51f10e2f8a95bea718ff938d7d7cf1d5e84485df Mon Sep 17 00:00:00 2001 From: Daniel Hasegan Date: Tue, 11 Jan 2022 12:50:44 -0800 Subject: [PATCH 2/5] mul by 100 --- utils/interpolate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/interpolate.py b/utils/interpolate.py index 0204909d..8efba4fe 100755 --- a/utils/interpolate.py +++ b/utils/interpolate.py @@ -101,7 +101,7 @@ def get_parser(): raise ValueError('No interpolation is necessary for this dataset.') if n_samples_seen / nvol > 0.7: raise ValueError('More than 70% ({}%) of the timepoints are to be interpolated.'.format( - n_samples_seen / nvol)) + 100.0 * n_samples_seen / nvol)) ########################################################################## # Temoral indices of all observations, seen and unseen ########################################################################## From c2ac91ade1e6dbeed44ef3b809404321094a0dad Mon Sep 17 00:00:00 2001 From: Daniel Hasegan Date: Tue, 11 Jan 2022 14:21:29 -0800 Subject: [PATCH 3/5] Change tmask from ones to zeros --- utils/tfilter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/tfilter b/utils/tfilter index 8c77b894..9c094ee3 100755 --- a/utils/tfilter +++ b/utils/tfilter @@ -142,7 +142,7 @@ order=1 pass=2 rpass=1 rstop=1 -tmask=ones +tmask=zeros unset tslist ################################################################### # Parse arguments @@ -237,7 +237,7 @@ done # the same number of volumes as the primary BOLD timeseries ################################################################### nvol=$(exec_fsl fslnvols ${image}) -if [[ ${tmask} != ones ]] +if [[ ${tmask} != zeros ]] then cvol=$(wc -l < ${tmask}) else @@ -275,7 +275,7 @@ t_rep=$(exec_fsl fslval ${image} pixdim4) # 1. Interpolate over masked-out epochs, if a temporal mask has # been provided. ################################################################### -if [[ ${tmask} != ones ]] +if [[ ${tmask} != zeros ]] then subroutine @u.1a Interpolating over masked-out epochs... subroutine @u.1b This will be slow From e2a06d59168ea26dbe558016103e33efcc6ea8a0 Mon Sep 17 00:00:00 2001 From: Daniel Hasegan Date: Tue, 11 Jan 2022 17:55:17 -0800 Subject: [PATCH 4/5] Reverting back as something else broke. Going to change the interpolate.py instead --- core/functions/temporal_mask | 3 +-- utils/interpolate.py | 8 ++++---- utils/tfilter | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/functions/temporal_mask b/core/functions/temporal_mask index 0a42a9be..1c0df3ed 100644 --- a/core/functions/temporal_mask +++ b/core/functions/temporal_mask @@ -187,8 +187,7 @@ USAGE -s ${q_mask_sum} \ -t 0.5 \ -o ${tmask[cxt]} \ - -m ${censor_contig[cxt]} \ - -i TRUE + -m ${censor_contig[cxt]} configure censored 1 ################################################################ # Determine the number of volumes that fail the motion criterion diff --git a/utils/interpolate.py b/utils/interpolate.py index 8efba4fe..799d981f 100755 --- a/utils/interpolate.py +++ b/utils/interpolate.py @@ -31,9 +31,9 @@ def get_parser(): '-t', '--tmask', action='store', required=True, help='[required]' '\nTemporal mask indicating whether each volume is seen or ' - '\nunseen. For instance, 1 (or >1) indicates that a volume ' - '\nshould be scrubbed, while 0 would indicate that the ' - '\nvolume should be retained.') + '\nunseen. For instance, 0 indicates that a volume ' + '\nshould be retained, while 1 would indicate that the ' + '\nvolume should be fixed.') parser.add_argument( '-m', '--mask', action='store', help='\nSpatial mask indicating the voxels of the input image ' @@ -81,7 +81,7 @@ def get_parser(): tmask = np.loadtxt(opts.tmask) indices = tmask.shape[-1] -t_obs=np.array(np.where(tmask != 0)) +t_obs=np.array(np.where(tmask == 0)) ########################################################################## # Total timespan of seen observations, in seconds diff --git a/utils/tfilter b/utils/tfilter index 9c094ee3..8c77b894 100755 --- a/utils/tfilter +++ b/utils/tfilter @@ -142,7 +142,7 @@ order=1 pass=2 rpass=1 rstop=1 -tmask=zeros +tmask=ones unset tslist ################################################################### # Parse arguments @@ -237,7 +237,7 @@ done # the same number of volumes as the primary BOLD timeseries ################################################################### nvol=$(exec_fsl fslnvols ${image}) -if [[ ${tmask} != zeros ]] +if [[ ${tmask} != ones ]] then cvol=$(wc -l < ${tmask}) else @@ -275,7 +275,7 @@ t_rep=$(exec_fsl fslval ${image} pixdim4) # 1. Interpolate over masked-out epochs, if a temporal mask has # been provided. ################################################################### -if [[ ${tmask} != zeros ]] +if [[ ${tmask} != ones ]] then subroutine @u.1a Interpolating over masked-out epochs... subroutine @u.1b This will be slow From a7d1c61f8b63aee8dda901a595b4e2a73fd3626c Mon Sep 17 00:00:00 2001 From: Daniel Hasegan Date: Tue, 11 Jan 2022 18:43:24 -0800 Subject: [PATCH 5/5] Changing the argumentparser for the nth time --- utils/interpolate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/interpolate.py b/utils/interpolate.py index 799d981f..de6bc3ad 100755 --- a/utils/interpolate.py +++ b/utils/interpolate.py @@ -31,8 +31,8 @@ def get_parser(): '-t', '--tmask', action='store', required=True, help='[required]' '\nTemporal mask indicating whether each volume is seen or ' - '\nunseen. For instance, 0 indicates that a volume ' - '\nshould be retained, while 1 would indicate that the ' + '\nunseen. For instance, 1 indicates that a volume ' + '\nshould be retained, while 0 would indicate that the ' '\nvolume should be fixed.') parser.add_argument( '-m', '--mask', action='store',