uncensor 3D data

AFNI version info (afni -ver): Precompiled binary linux_ubuntu_16_64: Dec 21 2023 (Version AFNI_23.3.14 'Septimius Severus')

Dear AFNI board,

We're pre-processing some fMRI data and would like to ask if there is anyway of doing interpolation of signals at given time points in AFNI. Let's say I have an fMRI with 150 volumes, we'd like to do the following:

  1. Realignment (3dVolreg).
  2. Detection of motion censoring points (1d_tool.py).
    --> let's say we get 10 timepoints to censor.
  3. Motion censoring / filtering / signal regression (3dDeconvolve).
    --> our final dataset would have 140 volumes.
  4. EXTERNAL STEP (which should not contain any non-real signal).
  5. Now, to preserve the same number of time points as in the original dataset (for dynamic functional connectivity in sliding windows), we would like to bring back the removed volumes by doing interpolation of neighboring volumes. This would be exactly like using 3dTproject with -cenmode NTRP but with an input where no censor volumes exist, instead we would provide the pre-processed 140 volumes as input and the original motion_censor file.

We were thinking about using something similar to Example 12 in 1d_tool.py ("uncensor" the data, but in 3D) followed by an interpolation step (e.g. censor those uncensored volumes wit 3dTproject with -cenmode NTRP).

Is the "uncensoring" approach implemented for 3D? Do you recommend any other approach?

Thank you very much! - this is a request from another part of the Spanish Inquisition (C├ęsar and Patricia).

As far as I know, there is no direct way to do this. However, as you note, there is a function that does it in 3dTproject, FILLIN_censored_time_series(), and the list of time points could be passed along.

So it is missing a command-line interface. Would you happen to know of any brave soul who might want to code it? If so, I could imagine either writing a new program like 3dTinterp (or interpolate), or adding options to an existing program like 3dTfilter.

We might find a taker here, too. But if you are up for it, please let me know.


  • rick

Dear Rick,

thank you very much for your answer, glad to hear that it's feasible to implement this (thanks for clarifying that the tool is not user-ready at the moment).

If we can find someone for the job we will contact you in private, thank you for suggesting this.

Best wishes,