Translating 3dvolreg 1Dfile to 3dAllineate -1Dparam_apply

Hello

I am trying to use the output from 3dvolreg to adjust a data set using 3dAllineate -1Dparam_apply.

Reading the program help file: 3dvolreg outputs:


roll  = rotation about the I-S axis }
pitch = rotation about the R-L axis } degrees CCW
yaw   = rotation about the A-P axis }
dS  = displacement in the Superior direction  }
dL  = displacement in the Left direction      } mm
dP  = displacement in the Posterior direction }

Question 1) Would ‘dL’ be x-shift; ‘dS’ be y-shift; and ‘dP’ be z-shift?

I ask this because I read in 1dApar2mat help file:


* The 12 parameters are, in the order used on the 1dApar2mat command line
  (the same order as output by 3dAllineate):
   x-shift         in mm
   y-shift         in mm
   z-shift         in mm
   z-angle (roll)  in degrees (not radians!)
   x-angle (pitch) in degrees
   y-angle (yaw)   in degrees
   x-scale         unitless factor, in [0.10,10.0]
   y-scale         unitless factor, in [0.10,10.0]
   z-scale         unitless factor, in [0.10,10.0]
   y/x-shear       unitless factor, in [-0.3333,0.3333]

[b]
Question 2) OR if my understanding of the ordering in question 1 is incorrect. Can someone please show me how to correct the below array using the output of 3dvolreg, to input in 3dAllineate (‘C1’ is Column 1 which is rolll, ‘C2’ is Column 2 which is pitch, etc.):

C1 C2 C3 C4 C5 C6 ===> ?
[/b]

Question 3) How can I easily add columns of zeros to the end of the 1Dfile output by volreg so it can have the required 12 columns for 3dAllineate? Currently, I do this in matlab, but to know how to do in AFNI would be very helpful.

OR is there a more simple way to do what I am trying to do?

Thank you in advance!

Cheers,
Edwin

Hi Edwin,

I pondered this a few years back, and my take is expressed via example 23 from 1d_tool.py -help:

1d_tool.py -infile dfile_rall.1D -volreg2allineate -write allin_rall_aff12.1D

Give that a try and please let me know what you think.

  • rick

Hi Rick,

Thank you very much for your help with this. I unfortunately ran into a likely unrelated error when attempting to run the below.


1d_tool.py -infile $AnimalID/$FolderID/dfile_VolReg2.1D -volreg2allineate -write $AnimalID/$FolderID/dfile_VolReg2_aff12.1D

I just tried to run ‘1d_tool.py’ and get the same error:


>> 1d_tool.py
Traceback (most recent call last):
  File "/Users/ebaldelo/abin/1d_tool.py", line 2731, in <module>
    sys.exit(main())
  File "/Users/ebaldelo/abin/1d_tool.py", line 2719, in main
    aint = A1DInterface()
  File "/Users/ebaldelo/abin/1d_tool.py", line 1424, in __init__
    self.init_options()
  File "/Users/ebaldelo/abin/1d_tool.py", line 1756, in init_options
    acplist = LAD.g_1D_write_styles,
AttributeError: 'module' object has no attribute 'g_1D_write_styles'

I ran afni_system_check.py to check the status of things but don’t see anything that sticks out to me (details below). Any thoughts or anything that sticks out to you?


>> afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture:         64bit 
system:               Darwin
release:              17.7.0
version:              Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
distribution:         unknown Darwin
number of CPUs:       24
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/ebaldelo/abin/afni
afni version         : Precompiled binary macos_10.12_local: Jan  6 2023 
                     : AFNI_23.0.00 'Commodus'
AFNI_version.txt     : AFNI_23.0.00, macos_10.12_local, Jan 06 2023
which python         : /usr/bin/python
python version       : 2.7.10
which R              : /usr/local/bin/R
R version            : R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
which tcsh           : /bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/Users/ebaldelo/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/3.5/Resources/bin/R)
    python  : 1   (/usr/bin/python)
    python2 : 0 
    python3 : 0 


testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success
    uber_subject.py      : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success
    3dMVM                : FAILURE
        Error in dyn.load(ll) : 
          unable to load shared object '/Users/ebaldelo/abin/R_io.so':
          dlopen(/Users/ebaldelo/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
          Referenced from: /Users/ebaldelo/abin/R_io.so
          Reason: Incompatible library version: R_io.so requires version 3.6.0 or later, but libR.dylib provides version 3.5.0
        Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
        Execution halted

checking for R packages...
    rPkgsInstall -pkgs ALL -check : success

R RHOME : /Library/Frameworks/R.framework/Resources

checking for $HOME files...
    .afnirc                   : found
    .sumarc                   : missing
    .afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** failed to load module PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp

++ module loaded: matplotlib.pyplot
   module file : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc

-------------------------------- env vars --------------------------------
PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/ebaldelo/abin

PYTHONPATH = 
R_LIBS = 
LD_LIBRARY_PATH = 
DYLD_LIBRARY_PATH = 
DYLD_FALLBACK_LIBRARY_PATH = 

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : found TT_N27+tlrc  under /Users/ebaldelo/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.2

which brew           : /usr/local/bin/brew
brew version         : Homebrew 3.6.1

-- for PyQt4 under brew, consider running:
   brew install cartr/qt4/pyqt
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
   -- found 'libXt' dylib files:
      /opt/X11/lib/flat_namespace/libXt.6.dylib
** env var DYLD_LIBRARY_PATH is not set to contain /opt/X11/lib/flat_namespace
   (so afni and suma may fail)

=========================  summary, please fix:  =========================
*  just be aware: login shell 'bash', but our code examples use 'tcsh'
*  AFNI programs show FAILURE
*  please run: "suma -update_env" for .sumarc
*  insufficient data for AFNI bootcamp
*  OS X version might be old
*  consider setting DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace

Hi Edwin,

Hmmm, that is a bit strange. Do you know of anything peculiar in your python setup? I don’t see anything strange in the system check output. But the error suggests maybe there is a discrepancy between versions of python files.

What is the output from this?

find ~/abin/ -name lib_afni1D.py
grep g_1D_write_styles ~/abin/afnipy/lib_afni1D.py
echo pypath = $PYTHONPATH

Thanks,

  • rick

Output:


>> find ~/abin/ -name lib_afni1D.py
/Users/ebaldelo/abin//afnipy/lib_afni1D.py

>> grep g_1D_write_styles ~/abin/afnipy/lib_afni1D.py
>> echo pypath = $PYTHONPATH
pypath =

I also tried:


>> grep g_1D_write_styles /Users/ebaldelo/abin//afnipy/lib_afni1D.py
>> echo pypath = $PYTHONPATH
pypath =

  1. Weird to me that in the path to ‘lib_afni1D.py’ there is two forward slash after ‘abin’.

  2. pypath is empty.

  3. 1d_tool.py still outputs the same error.

Not sure if this is helpful but I did the following and got:


>> python -c 'import sys;print sys.path'
['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']


So that library is missing the symbol. Is it old for some reason? What is the output from:

ls -l ~/abin/afnipy/lib_afni1D.py

You could get a new version of that file, but it makes me doubt your installation. It might be worth updating your whole install, just to be sure.

@update.afni.binaries -defaults

Is that something you can do right now? Otherwise we could investigate more. But I suspect you have only a partial update for some reason.

  • rick

Output:


>> ls -l ~/abin/afnipy/lib_afni1D.py
-rw-r--r--  1 20892  staff  152834 Aug 19  2020 /Users/ebaldelo/abin/afnipy/lib_afni1D.py

I really thought I did ‘@update.afni.binaries -defaults’ sometime last year. Either way… just tried it. and after downloading some files and extracting I start seeing a lot of ‘Permission Denied’, e.g:


-- running @update.afni.binaries version 3.21, July 22, 2022
-- have AFNI binaries under /Users/ebaldelo/abin
-- install dir: using existing /Users/ebaldelo/abin
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package macos_10.12_local under
   install dir: /Users/ebaldelo/abin...
-- have install dir
++ working in new temp dir, .tmp.install
++ getting install prog: curl -O -f bin/misc/@update.afni.binaries ...
curl -O -f https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50045  100 50045    0     0   161k      0 --:--:-- --:--:-- --:--:--  162k
-- fixing lost permissions on @update.afni.binaries
-- @update.afni.binaries is current, continuing with this version...
++ downloading test file: curl -O -f macos_10.12_local/afni ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.7M  100 11.7M    0     0  13.4M      0 --:--:-- --:--:-- --:--:-- 13.4M

++ update needed, installing...

++ downloading full package: curl -O -f macos_10.12_local.tgz ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  975M  100  975M    0     0  26.5M      0  0:00:36  0:00:36 --:--:-- 26.8M
++ extracting package macos_10.12_local.tgz...
++ backing up current binaries to auto_backup.macos_10.12_local
mv: rename ../afniRTI to auto_backup.macos_10.12_local/afniRTI: Permission denied
mv: rename ../afnipy to auto_backup.macos_10.12_local/afnipy: Permission denied
mv: rename ../auto_backup.macos_10.12_local to auto_backup.macos_10.12_local/auto_backup.macos_10.12_local: Permission denied
mv: rename ../funstuff to auto_backup.macos_10.12_local/funstuff: Permission denied
mv: rename ../lib_RetroTS to auto_backup.macos_10.12_local/lib_RetroTS: Permission denied
mv: rename ../meica.libs to auto_backup.macos_10.12_local/meica.libs: Permission denied
mv: rename ../shiny to auto_backup.macos_10.12_local/shiny: Permission denied
deleting old backup directory, auto_backup.macos_10.12_local ...


and it goes on…I’d be happy to try a complete re-install?

Indeed, the output from that “ls -l” command shows that you do not own or have write permission to that library file (or any of the other ‘denied’ ones) It was possibly installed by an admin.
If you want to clean up, I would suggest a sequence like this:

cd
mv abin abin.corrupt
cp -r abin.corrupt abin
@update.afni.binaries -defaults

That will leave the current abin as abin.corrupt, if you ever want to mess with it (deleting might be fine, but that might require admin rights).

Give that a try.

  • rick

Just tried that sequence and now I get this:


>> @update.afni.binaries -defaults
-bash: /Users/ebaldelo/abin/@update.afni.binaries: No such file or directory

here’s this if it’s helpful:


>> ls -al /Users/ebaldelo/abin/
total 0
drwxr-xr-x   10 ebaldelo  staff    320 Mar  2 11:38 .
drwxr-xr-x@ 134 ebaldelo  staff   4288 Mar  2 11:38 ..
drwxr-xr-x    6 ebaldelo  staff    192 Mar  2 11:38 .tmp.install
drwxr-xr-x   10 ebaldelo  staff    320 Mar  2 11:38 afniRTI
drwxr-xr-x  100 ebaldelo  staff   3200 Mar  2 11:38 afnipy
drwxr-xr-x  958 ebaldelo  staff  30656 Mar  2 11:38 auto_backup.macos_10.12_local
drwxr-xr-x  796 ebaldelo  staff  25472 Mar  2 11:38 funstuff
drwxr-xr-x   14 ebaldelo  staff    448 Mar  2 11:38 lib_RetroTS
drwxr-xr-x    8 ebaldelo  staff    256 Mar  2 11:38 meica.libs
drwxr-xr-x    6 ebaldelo  staff    192 Mar  2 11:38 shiny

I don’t understand why the regular files were not copied, but maybe just run the version in the moved directory with explicit options:

tcsh ~/abin.corrupt/@update.afni.binaries -bindir ~/abin -package macos_10.12_local -defaults
  • rick

I don’t understand why either. It’s very strange. Here’s the output:


>>tcsh ~/abin.corrupt/@update.afni.binaries -bindir ~/abin -package macos_10.12_local -defaults

/Users/ebaldelo/abin.corrupt/@update.afni.binaries: No such file or directory.

Here’s this if it’s worth knowning:


>> ls -l ~/abin*
/Users/ebaldelo/abin:
total 0
drwxr-xr-x   10 ebaldelo  staff    320 Mar  2 11:38 afniRTI
drwxr-xr-x  100 ebaldelo  staff   3200 Mar  2 11:38 afnipy
drwxr-xr-x  958 ebaldelo  staff  30656 Mar  2 11:38 auto_backup.macos_10.12_local
drwxr-xr-x  796 ebaldelo  staff  25472 Mar  2 11:38 funstuff
drwxr-xr-x   14 ebaldelo  staff    448 Mar  2 11:38 lib_RetroTS
drwxr-xr-x    8 ebaldelo  staff    256 Mar  2 11:38 meica.libs
drwxr-xr-x    6 ebaldelo  staff    192 Mar  2 11:38 shiny

/Users/ebaldelo/abin.corrupt:
total 0
drwxr-xr-x   10 20892  staff    320 Aug 20  2020 afniRTI
drwxr-xr-x  100 20892  staff   3200 Aug 20  2020 afnipy
drwxr-xr-x  958 root   staff  30656 Aug 20  2020 auto_backup.macos_10.12_local
drwxr-xr-x  796 20892  staff  25472 Aug 19  2020 funstuff
drwxr-xr-x   14 20892  staff    448 Aug 20  2020 lib_RetroTS
drwxr-xr-x    8 20892  staff    256 Aug 19  2020 meica.libs
drwxr-xr-x    6 20892  staff    192 Aug 19  2020 shiny

I’m willing to delete related AFNI/abin files and try a fresh install if worth it…

Oh, I think one of the @uab commands did a partial job, and now those files are hiding in the auto_backup subdirectory.

Forget it though. Instead of hunting for the old script, just start with a downloaded version.

cd
curl -O [https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries](https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries)
tcsh @update.afni.binaries -bindir ~/abin -package macos_10.12_local -defaults
  • rick
  1. This is the end of the output:

++ update needed, installing...

++ downloading full package: curl -O -f macos_10.12_local.tgz ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  975M  100  975M    0     0  16.6M      0  0:00:58  0:00:58 --:--:-- 17.5M
++ extracting package macos_10.12_local.tgz...
++ backing up current binaries to auto_backup.macos_10.12_local
deleting previous backup directory, auto_backup.macos_10.12_local ...
++ installing new binaries...
++ will source .cshrc from newly created /Users/ebaldelo/.tcshrc
++ adding /Users/ebaldelo/abin to PATH in /Users/ebaldelo/.zshrc ...
++ setting DYLD_LIBRARY_PATH in /Users/ebaldelo/.zshrc ...
-- seem be be sourcing .bashrc from /Users/ebaldelo/.bash_profile
++ setting DYLD_LIBRARY_PATH in /Users/ebaldelo/.profile ...
/Users/ebaldelo/.profile: Permission denied.

I went in and manually changed ownership via:


>> sudo chown ebaldelo /Users/ebaldelo/.profile 

this is what I got when I repeated:


>> tcsh @update.afni.binaries -bindir ~/abin -package macos_10.12_local -defaults
-- running @update.afni.binaries version 3.21, July 22, 2022
-- have AFNI binaries under /Users/ebaldelo/abin
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package macos_10.12_local under
   install dir: /Users/ebaldelo/abin...
-- have install dir
deleting old temporary directory...
++ working in new temp dir, .tmp.install
++ getting install prog: curl -O -f bin/misc/@update.afni.binaries ...
curl -O -f https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50045  100 50045    0     0   202k      0 --:--:-- --:--:-- --:--:--  202k
-- fixing lost permissions on @update.afni.binaries
-- @update.afni.binaries is current, continuing with this version...
++ downloading test file: curl -O -f macos_10.12_local/afni ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.7M  100 11.7M    0     0  12.9M      0 --:--:-- --:--:-- --:--:-- 12.9M
++ no update needed

  1. 1d_tool.py now seems to work. And I am am able to (finally) attempt the original prompt. I attempted it on the same pre-registered data set I got the 1D file from. It looks pretty similar but there are a few places where the 3dvolreg data set looks different from the 3dAllineate data set. Is this to be expected?

Thank you VERY much for your time and help!

Great, I am glad the install is settled. I should have asked if you had admin rights…

To be sure, are you using 3dAllineate to apply the (converted) 3dvolreg parameters and are comparing the results?

What is the 3dAllineate command?
Can you be more specific about in what way (in a few places) the result looks unexpected? Does that mean a few locations in the volume? At a few time points? Does the difference seem to be one of interpolation, or something bigger?

Thanks,

  • rick

Below is my command and a few things worth mentioning:

  1. Unregistered Data is: $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box+orig
  2. Data is despiked before registration: $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box.DS+orig


3dvolreg \
-overwrite \
-prefix $AnimalID/$FolderID/${AnimalID}_${FolderID}.DS.BoxReg \
-base $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box.Mean+orig[0] \
-weight $AnimalID/$FolderID/COPY_tempab2+orig[0] \
-heptic \
-dfile $AnimalID/$FolderID/dfile_VolReg2 \
-1Dfile $AnimalID/$FolderID/dfile_VolReg2.1D \
$AnimalID/$FolderID/${AnimalID}_${FolderID}.Box.DS+orig

1d_tool.py \
-overwrite \
-infile $AnimalID/$FolderID/dfile_VolReg2.1D \
-volreg2allineate \
-write $AnimalID/$FolderID/dfile_VolReg2_aff12.1D

3dAllineate \
-overwrite \
-prefix $AnimalID/$FolderID/${AnimalID}_${FolderID}.BoxReg1D \
-master $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box.Mean+orig[0] \
-1Dparam_apply $AnimalID/$FolderID/dfile_VolReg2_aff12.1D \
-final quintic \
-quiet \
-input $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box+orig

It seems that at a number of time points (>10) the 3dAllineate volume is spatially different/shifted, up to 2 voxels different, from the 3dVolreg volume… The rest, they are similar but I can still see some differences which may be due to interpolation differences.

I did not test it methodically. I went straight toward my desired application; SO I should ask, if I were to take the exact same volume (here, $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box.DS+orig) and apply it using the 3dAllineate command, should I expect the two volumes to be near identical with only differences being due to interpolation differences?

*UPDATE: It seems to do the same thing regardless of which ‘master’ is used. I have another data set with much more noticeable motion, and the differences between the volreg volume and 3dAllineate volume are more noticeable and confirmed.

SECOND UPDATE/QUESTION: Does it matter if the unregistered volume was segmented using:


3dZeropad \
-overwrite \
-master $AnimalID/$FolderID/tempab2+orig \
-prefix $AnimalID/$FolderID/${AnimalID}_${FolderID}.Box \
 $AnimalID/$FolderID/${AnimalID}_${FolderID}.RGNorm+orig

I thought it worth starting a new reply for this:

I took a smaller subset and methodically edited the different values. It appears column 4, roll, value appeared to be the culprit. Below are values from a dfile_VolReg2_aff12.1D file:


-0.0288 -0.124 -0.005 0.8544 0.0083 -0.0323 0 0 0 0 0 0
-0.0254 -0.1439 -0.002 0.8848 0.0439 -0.0921 0 0 0 0 0 0
0.1401 -0.7076 0.0146 4.8042 0.101 0.1251 0 0 0 0 0 0
0.3368 -1.6307 0.0161 5.428 0.0873 0.2056 0 0 0 0 0 0
0.4403 -1.1964 -0.0157 6.8392 0.094 -0.2051 0 0 0 0 0 0
0.1105 -0.3726 0.0019 1.46 0.0443 -0.0523 0 0 0 0 0 0
0.0628 -0.2221 -0.0054 1.0794 0.0573 -0.1024 0 0 0 0 0 0
0.0428 -0.1325 -0.0043 0.3687 0.0532 -0.0329 0 0 0 0 0 0
0.0241 -0.0445 -0.0008 0.272 0.0817 -0.047 0 0 0 0 0 0
-0.0033 -0.0147 0.0126 0.0418 -0.0239 -0.0296 0 0 0 0 0 0
0.1256 -0.4107 -0.0024 2.4248 0.1107 0.0819 0 0 0 0 0 0

I thought it was strange that each of the roll values are typically an order or two magnitude higher than the pitch or yaw. EDITED* I looked more closely through the data set and perhaps actual data/image volume does move more so in the roll direction. BUT it also seems to apply a translation! Or something weird.

Anyway, IF I use the dfile_VolReg2_aff12.1D file, BUT make all of column 4, roll values, zero, it looks MUCH more near identical to the registered volume using 3dvolreg. Could it be a order of operation, whether translation or rotation gets applied first??

QUESTION: Is there a way to make only this column zero in AFNI? Currently can only do in matlab…

I have looked at this, and there are more subtleties. Basically, the param files between 3dvolreg and 3dAllineate are not appropriate for passing between the programs. Besides the column order, there are appear to be negatives between the shifts. Also, 3dvolreg uses the center of the volume for rotations, while 3dAllineate uses xyz = (0,0,0) for its center. So the sets of rotations/shifts will not equate, even if they are “properly” rearranged and signed.

This brings up why both programs have -1Dmatrix_save options. The matrices translate better than the parameters. I will compare those, too…

  • rick

Indeed, they produce approximately the same matrices. So you could use 3dvolreg -1Dmatrix_save and apply it with 3dAllineate -1Dmatrix_apply and get similar output (subject to interpolation choices).

  • rick

Thanks. That seems to work. Thank you again very much for your time into this. I am very appreciative

Glad it’s working for you, thanks for the update.

  • rick