Saving design matrix for filter

Hello AFNI experts,

I am interested in applying either a high pass or bandpass filter from afni in another program, and am wondering whether there is a way to save the design matrix (possibly a .1D file?) for this filter as a series of columns that can be regressed out of my timeseries in another software.

I would use AFNI’s 3dTproject, but I want to perform the “non-aggressive” denoising used by ICA-AROMA (which performs partial regression, making signal and noise components compete for variance so that shared variance in noise components is not removed).
So ideally, I hope to get columns for a filter I can append to the matrix for my other nuisance regressors to simultaneously perform partial regression and filtering in FSL using the fsl_regfilt command.

Any guidance here will be greatly appreciated. Thank you!

An update to the post above:

I have found the command 1dBport, which does exactly this. However, it always seems to output sine/cosine regressors of one timepoint less than the number of volumes. Is there a way to make it match the number of volumes so I can perform a regression, or am I misinterpreting how to use these regressors?
Would it be appropriate to increase the number of volumes by 1 to output my intended regressor length, or will this slightly frequency shift the band power of my intended bandpass?

Thank you in advance!

Hi, Will-

What is the 1dBport command you are using?

For example, let’s say you want to create regressors to remove frequencies outside the interval [0.01, 0.1] Hz. The following code should give you an appropriate set of bandpass regressors for a particular dset outputting the results to a text file called OUTPUT.1D:


set dset = [some name of dset]
set N = `3dinfo -nv "${dset}"`
set TR = `3dinfo -tr "${dset}"`

1dBport -nodata ${N} ${TR} -band 0.01 0.1 -invert -nozero > OUTPUT.1D

I stole the above command from what does in generating regressors for bandpassing when the following option is used:

-regress_bandpass lowf highf : bandpass the frequency range

                e.g.  -regress_bandpass 0.01 0.1

            This option is intended for use in resting state analysis.

            Use this option to perform bandpass filtering during the linear
            regression.  While such an operation is slow (much slower than the
            FFT using 3dBandpass), doing it during the regression allows one to
            perform (e.g. motion) censoring at the same time.

            This option has a similar effect to running 3dBandpass, e.g. the
            example of '-regress_bandpass 0.01 0.1' is akin to running:

                3dBandpass -ort motion.1D -band 0.01 0.1

            except that it is done in 3dDeconvolve using linear regression.
            And censoring is easy in the context of regression.

            Note that the Nyquist frequency is 0.5/TR.  That means that if the
            TR were >= 5 seconds, there would be no frequencies within the band
            range of 0.01 to 0.1 to filter.  So there is no point to such an

            On the flip side, if the TR is 1.0 second or shorter, the range of
            0.01 to 0.1 would remove about 80% of the degrees of freedom (since
            everything above 0.1 is filtered/removed, up through 0.5).  This
            might result in a model that is overfit, where there are almost as
            many (or worse, more) regressors than time points to fit.

            So a 0.01 to 0.1 bandpass filter might make the most sense for a
            TR in [2.0, 3.0], or so.

            A different filter range would affect this, of course.

            See also -regress_censor_motion.


Thank you very much for this help! This has worked exactly as hoped.
I was using -input and wasn’t using -invert (an oversight on my part) or -nozero. I also found that if I adjusted frequencies by multiplying by my TR (2s) when using 1dBandpass, I could also bandpass my .1D file of regressors directly.

Given I adjust the frequencies properly, do 1dBandpass and 3dBandpass work equivalently?

This seemed to work as planned when I bandpassed my timeseries, bandpassing my covariates, then regressing out these new covariates. The resulting timeseries retained the initial bandpass.

Thank you for the assistance here,