3dAllineate issue

Hi there. I am having an issue with 3dAllineate. I am resampling with grid spacings of 3mm (either by using mast_dxyz or by using a base with 3mm grid spacings), but then when I create a temporal standard deviation image from the resulting .nii file, it has very visible striped brands across the whole brain. Is this a known problem that has come up before? Any idea what I am doing that is causing it, or what I can do to prevent it? If I just apply the transform (motion correction) without specifying that new grid, there are no stripes.


Can you please provide your exact commands?

Also, have you looked at the time series before running 3dAllineate (raw time series, and perhaps its own mean and stdev)-- does that have any stripiness?



Here are my exact commands. Here is what I did when using mast_dxyz:

3dAllineate -overwrite -base pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz -input pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz -1Dmatrix_apply pb01.MOV008_20180330.r01.e1.tcat.2NEW.motion_REF-EPI1.aff12.1D -mast_dxyz 3 -prefix pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_forallineate.nii.gz

And here is what I did when I didn’t use mast_dxyz but instead used a base with 3mm grid sampling:

3dAllineate -overwrite -base pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_forallineate.nii.gz -input pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz -1Dmatrix_apply pb01.MOV008_20180330.r01.e1.tcat.2NEW.motion_REF-EPI1.aff12.1D -prefix pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_allineate_forcedresample.nii.gz

And to answer your question, the raw time series has no banding in its own standard deviation image. It is only after running it through 3dAllineate with a resampling to a 3mm grid that the bands are created.


Hmmm, a couple things:

In the first command, your input and base are the same:
Are you just resampling the data? How did you align it to itself? You could use “3dresample -dxyz …” to resample it (and you can specify the mode.

In the second command, I don’t think that just using “-base …” will force the output data to have its grid size; the output will have something close to teh original resolution. Using “-master …” there would, though, make the output be on the grid of the “master” data set.

Also, what is your original 3dAllineate command?

Finally, what is the output of this:

3dinfo -o3 -ad3 -orient -prefix pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_forallineate.nii.gz  pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz


Here is the output from the 3dinfo command:

-108.727364 91.842567 -74.730621 3.000000 3.000000 3.000000 RPI pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_forallineate.nii.gz
-109.027374 92.142578 -74.430626 2.400000 2.400000 2.400000 RPI pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz

I should also clarify that the command I sent you was one I did for just testing out the banding, which is why I had the same input and base (I was just keeping it simple). The actual original command from my script that caused the banding was this:

-base mprage.noskull_at.nii.gz
-input pb01.${sub}.r${run}.e${echo}.tcat.nii.gz
-1Dmatrix_apply pb01.${sub}.r${run}.e${echo}.tcat.XFM.EPI2EPI2MPR2ATL_motionINT_EPIxEPI1.aff12.1D
-mast_dxyz 3
-prefix pb01.${sub}.r${run}.e${echo}.tcat.atlas_motionINT_EPIxEPI1.nii.gz

I also reran 3dAllineate using -master (code below) and the image still had bands:

3dAllineate -overwrite -base pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz -master pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_forallineate.nii.gz -input pb01.MOV008_20180330.r01.e1.tcat.2NEW.nii.gz -1Dmatrix_apply pb01.MOV008_20180330.r01.e1.tcat.2NEW.motion_REF-EPI1.aff12.1D -prefix pb01.MOV008_20180330.r01.e1.tcat.2NEW.REF-EPI1_allineate_forcedresample_withmaster.nii.gz



Hi, Ben-

THanks, with the 3dinfo I was trying to get a sense of whether the voxel sizes were changing dramatically or something.

With the 2nd 3dAllineate, I don’t htink you need/want both “-base …” and “-master …”.

I’m not sure what’s happening. I will PM you instructions so you can upload the dset and I can take a look more directly on this side, if that works for you.


OK, it looks like the apparent grid-iness in the output stdev is just a minor interpolation artifact when the applied transformation matrix is just a small perturbation off of an identity transform. That is, the regridding is just a little different than being an identity, and the interpolation used is low order interpolation (the default in 3dAllineate is “just” cubic); then this kind of thing can appear-- note that it is only really noticeable at the level of looking at the standard deviation. You can get around this by applying a higher-order interpolant in 3dAllineate, such as wsinc5, say via adding “-final wsinc5”. (Alternatively, if your data were integer-valued, you could use “-final NN”.)


A related issue that came up a few years ago and some years before that too.