codecov-io: # [Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=h1) Report
> Merging [#2031](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=desc) into [master](https://codecov.io/gh/nipy/nipype/commit/90cfdd8a63114dbe2e1ce6dea9dd739d04f84a4a?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `22.22%`.

[![Impacted file tree graph](https://codecov.io/gh/nipy/nipype/pull/2031/graphs/tree.svg?width=650&height=150&src=pr&token=Tu0EnSSGVZ)](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #2031      +/-   ##
==========================================
- Coverage    72.2%   72.19%   -0.01%     
==========================================
  Files        1132     1132              
  Lines       57024    57032       +8     
  Branches     8165     8167       +2     
==========================================
+ Hits        41173    41175       +2     
- Misses      14567    14572       +5     
- Partials     1284     1285       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #smoketests | `72.19% <22.22%> (-0.01%)` | :arrow_down: |
| #unittests | `69.79% <22.22%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ype/interfaces/freesurfer/tests/test\_BBRegister.py](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnJlZXN1cmZlci90ZXN0cy90ZXN0X0JCUmVnaXN0ZXIucHk=) | `77.77% <ø> (ø)` | :arrow_up: |
| [nipype/interfaces/freesurfer/preprocess.py](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnJlZXN1cmZlci9wcmVwcm9jZXNzLnB5) | `64.84% <22.22%> (-0.32%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=footer). Last update [90cfdd8...ab826ef](https://codecov.io/gh/nipy/nipype/pull/2031?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py
index 0ff32ad74..4e164c342 100644
--- a/nipype/interfaces/freesurfer/preprocess.py
+++ b/nipype/interfaces/freesurfer/preprocess.py
@@ -1155,6 +1155,8 @@ class BBRegisterInputSpec(FSTraitedSpec):
                         desc='degrees of freedom for initial registration (FSL)')
     out_fsl_file = traits.Either(traits.Bool, File, argstr="--fslmat %s",
                                  desc="write the transformation matrix in FSL FLIRT format")
+    out_lta_file = traits.Either(traits.Bool, File, argstr="--lta %s", min_ver='5.2.0',
+                                 desc="write the transformation matrix in LTA format")
     registered_file = traits.Either(traits.Bool, File, argstr='--o %s',
                                     desc='output warped sourcefile either True or filename')
 
@@ -1171,6 +1173,7 @@ class BBRegisterInputSpec6(BBRegisterInputSpec):
 class BBRegisterOutputSpec(TraitedSpec):
     out_reg_file = File(exists=True, desc='Output registration file')
     out_fsl_file = File(desc='Output FLIRT-style registration file')
+    out_lta_file = File(desc='Output LTA-style registration file')
     min_cost_file = File(exists=True, desc='Output registration minimum cost file')
     registered_file = File(desc='Registered and resampled source file')
 
@@ -1219,6 +1222,16 @@ class BBRegister(FSCommand):
             else:
                 outputs['registered_file'] = op.abspath(_in.registered_file)
 
+        if isdefined(_in.out_lta_file):
+            if isinstance(_in.out_fsl_file, bool):
+                suffix = '_bbreg_%s.lta' % _in.subject_id
+                out_lta_file = fname_presuffix(_in.source_file,
+                                               suffix=suffix,
+                                               use_ext=False)
+                outputs['out_lta_file'] = out_lta_file
+            else:
+                outputs['out_lta_file'] = op.abspath(_in.out_lta_file)
+
         if isdefined(_in.out_fsl_file):
             if isinstance(_in.out_fsl_file, bool):
                 suffix = '_bbreg_%s.mat' % _in.subject_id
@@ -1234,7 +1247,7 @@ class BBRegister(FSCommand):
 
     def _format_arg(self, name, spec, value):
 
-        if name in ['registered_file', 'out_fsl_file']:
+        if name in ['registered_file', 'out_fsl_file', 'out_lta_file']:
             if isinstance(value, bool):
                 fname = self._list_outputs()[name]
             else:

bbregister api: new version allows saving to lta (preferred)
diff --git a/nipype/interfaces/freesurfer/tests/test_BBRegister.py b/nipype/interfaces/freesurfer/tests/test_BBRegister.py
index 90305697d..e29ea17b6 100644
--- a/nipype/interfaces/freesurfer/tests/test_BBRegister.py
+++ b/nipype/interfaces/freesurfer/tests/test_BBRegister.py
@@ -15,6 +15,7 @@ def test_BBRegister_inputs():
         init_reg_file=dict(argstr='--init-reg %s', mandatory=True, xor=['init'],),
         intermediate_file=dict(argstr='--int %s',),
         out_fsl_file=dict(argstr='--fslmat %s',),
+        out_lta_file=dict(argstr='--lta %s', min_ver='5.2.0',),
         out_reg_file=dict(argstr='--reg %s', genfile=True,),
         reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],),
         reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],),
@@ -37,6 +38,7 @@ def test_BBRegister_inputs():
         init_reg_file=dict(argstr='--init-reg %s', xor=['init'],),
         intermediate_file=dict(argstr='--int %s',),
         out_fsl_file=dict(argstr='--fslmat %s',),
+        out_lta_file=dict(argstr='--lta %s', min_ver='5.2.0',),
         out_reg_file=dict(argstr='--reg %s', genfile=True,),
         reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],),
         reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],),
@@ -62,6 +64,7 @@ def test_BBRegister_inputs():
 def test_BBRegister_outputs():
     output_map = dict(min_cost_file=dict(),
                       out_fsl_file=dict(),
+                      out_lta_file=dict(),
                       out_reg_file=dict(),
                       registered_file=dict(),
                       )

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
click==8.0.4
configparser==5.2.0
decorator==4.4.2
funcsigs==1.0.2
future==1.0.0
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
lxml==5.3.1
mock==5.2.0
networkx==2.5.1
nibabel==3.2.2
-e git+https://github.com/nipy/nipype.git@90cfdd8a63114dbe2e1ce6dea9dd739d04f84a4a#egg=nipype
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
prov==2.0.1
py==1.11.0
pydotplus==2.0.2
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
rdflib==5.0.0
scipy==1.5.4
simplejson==3.20.1
six==1.17.0
tomli==1.2.3
traits==6.4.1
typing_extensions==4.1.1
zipp==3.6.0

name: nipype
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - click==8.0.4
      - configparser==5.2.0
      - decorator==4.4.2
      - funcsigs==1.0.2
      - future==1.0.0
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - isodate==0.6.1
      - lxml==5.3.1
      - mock==5.2.0
      - networkx==2.5.1
      - nibabel==3.2.2
      - numpy==1.19.5
      - packaging==21.3
      - pluggy==1.0.0
      - prov==2.0.1
      - py==1.11.0
      - pydotplus==2.0.2
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - rdflib==5.0.0
      - scipy==1.5.4
      - simplejson==3.20.1
      - six==1.17.0
      - tomli==1.2.3
      - traits==6.4.1
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/nipype

nipype/interfaces/freesurfer/tests/test_BBRegister.py::test_BBRegister_inputs
nipype/interfaces/freesurfer/tests/test_BBRegister.py::test_BBRegister_outputs
nipype/interfaces/freesurfer/preprocess.py
nipype/interfaces/freesurfer/preprocess.py