Purpose of "all-1 dataset" in volreg step from Proc

This is just a general question. I am taking a new student through each of the steps of a preprocessing pipeline as generated by uber_subject.py. In the ‘volreg’ section of the proc script after the TLRC step the script does the following:
“# create an all-1 dataset to mask the extents of the warp”
Then it makes an intersection mask for the runs and creates an ‘extents’ mask of all runs.

My understanding of this step is that it removes any voxel time series where there is invalid data but I have a couple of questions as to its purpose.

  1. It seems from the math that the voxel has to have invalid data during ALL runs for it to be masked out. Because if you use 3dMean on all of the runs (say you have 3 runs) and then mask out anything with a mean value less than 1 only, wouldn’t you retain the voxel if it had a minimum value of 0 during 2 runs but then a minimum value of 4 for the last run? If this is true I don’t really see the point of the command since the voxel has invalid data during 2 of the runs and just happens to have an arbitrarily high enough minimum value in the last run for it to get over the masking hump. However it’s also likely I’m not understanding he command correctly so I just wanted to ensure these commands are doing what I think they’re doing.

  2. I guess my follow-up question is again to the purpose of the extents mask since it seems like - with the mask it created for my data at least - all of the data removed at this step is outside of the ultimate automask anyway. So wouldn’t it be more efficient to just use automask at a later step?

Thanks for any clarification here. I just don’t want to be giving the wrong information to people.


Hi Lauren,

1)The input to that 3dMean command is made from
warping 1’s. There should be no minimum of 4 as
input to that.

So the result of 3dMean will be a 1 only if all of
the inputs to it were 1 (at a given voxel). And the
subsequent 3dcalc sets any values below 1 to zero.

That means if a voxel is set in the mask_epi_extents
dataset, it should have valid data at every time point
in every run.

  1. It seems reasonable to consider the extents mask
    to be required. But applying the full_mask is up to
    the user, and is something we do not actually suggest
    (because it is better to see any artifacts from the
    analysis before masking them out).

Does that seem reasonable?

  • rick

Hi Rick:

Thanks for taking the time to explain this. I think I was misunderstanding the purpose of the mask. So in the initial 3dcalc command when you first make the all-1 dataset, it literally makes the entire dataset 1 out to the edges. So the purpose of the extents mask is not to identify individual voxels in the functional run where a TR may be 0 but is instead meant to, basically, find the ‘edges’ of the functional datasets?

I think I was thrown off because, in my functional run there are, for example, voxels at the anterior brain edge with data values of 0 at one or more timepoints and the original 3dcalc command makes gives these voxels a value of 1 in the mask. But those voxels do not seem to be within the purview of this mask if I am now understanding its function correctly.


Yes, you have that right. The purpose is to remove
voxels where we do not even know what the values
should be (across all time points). Such voxels are
outside the known universe of the EPI volume at
some point in time, due to motion.

  • rick

Perfect, I understand now and get its utility.
Thanks for your time, Rick, I appreciate it.