Skip to content

Commit 88b42a1

Browse files
committed
ENH: Allow specification of high_pass_cutoff
1 parent 2f55a70 commit 88b42a1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nipype/algorithms/confounds.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ class CompCorInputSpec(BaseInterfaceInputSpec):
337337
False, usedefault=True,
338338
desc='Use cosine basis to remove low-frequency trends pre-component '
339339
'extraction')
340+
high_pass_cutoff = traits.Float(
341+
128, usedefault=True, requires=['high_pass_filter'],
342+
desc='Cutoff (in seconds) for high-pass filter')
340343
repetition_time = traits.Float(
341344
desc='Repetition time (TR) of series - derived from image header if '
342345
'unspecified')
@@ -835,14 +838,14 @@ def is_outlier(points, thresh=3.5):
835838
return timepoints_to_discard
836839

837840

838-
def cosine_filter(data, timestep, remove_mean=False, axis=-1):
841+
def cosine_filter(data, timestep, period_cut, remove_mean=False, axis=-1):
839842
datashape = data.shape
840843
timepoints = datashape[axis]
841844

842845
data = data.reshape((-1, timepoints))
843846

844847
frametimes = timestep * np.arange(timepoints)
845-
X = _full_rank(_cosine_drift(128, frametimes))[0]
848+
X = _full_rank(_cosine_drift(period_cut, frametimes))[0]
846849
non_constant_regressors = X[:, :-1]
847850

848851
betas = np.linalg.lstsq(X, data.T)[0]
@@ -984,7 +987,7 @@ def compute_noise_components(imgseries, mask_images, degree, num_components,
984987
# If degree == 0, remove mean in same pass
985988
voxel_timecourses, hpf_basis = cosine_filter(
986989
voxel_timecourses, repetition_time,
987-
remove_mean=(degree == 0))
990+
self.inputs.high_pass_cutoff, remove_mean=(degree == 0))
988991

989992
# from paper:
990993
# "The constant and linear trends of the columns in the matrix M were

0 commit comments

Comments
 (0)