Dear Doug,

yes, the point is, that my_initial_lta.lta does not have subject name in it.

Your suggestion to rearrange parameters in bbregister indeed helped to get further, however, later ended with error in bbregister execution in call of mri_segreg, which does not pass the subject parameter and reads it from the .reg file:

mri_segreg --mov /hydradb/hydra_io/vypocty/skoch/20160609_HCENAT_DWI/proc/HCE_C00573_20160524_1456_2/reg/tmp.bbregister.5112/template.nii --init-reg /hydradb/hydra_io/vypocty/skoch/20160609_HCENAT_DWI/proc/HCE_C00573_20160524_1456_2/reg/tmp.bbregister.5112/init.reg.5112.dat --out-reg /hydradb/hydra_io/vypocty/skoch/20160609_HCENAT_DWI/proc/HCE_C00573_20160524_1456_2/reg/tmp.bbregister.5112/bbr.pass1.dat --subsamp-brute 100 --subsamp 100 --tol 1e-4 --tol1d 1e-3 --brute -4 4 4 --surf white --gm-proj-frac 0.5 --gm-gt-wm 0.5

The error is:
mghRead(/hydradb/hydra_io/vypocty/skoch/20161008_HCENAT_struct/A_HCP_w_FS_dev_long/subject-unknown/mri/orig.mgz, -1): could not open file

I solved the issue by additional appending subject id into my_initial_lta.lta file. It seems to work OK, bbregister finishes without error.

Antonin

----------------------------------------------------------------------------------------------------

does my_initial_lta.lta have the subject name in it? If not, then put 
that argument before the --s
On 12/05/2016 10:34 AM, Antonin Skoch wrote:
> Dear experts,
>
> I am having trouble using --init-reg option in bbregister (FreeSurfer 
> v6 beta version).  It exits with error: must supply subject id.
>
> My command line is:
> bbregister --mov my_moveable.nii.gz --s my_subject_id --lta 
> my_lta_out.lta --dti --init-reg my_initial_lta.lta
>
> I traced the problem to reg2subject --r my_initial_lta.lta which is 
> executed inside bbregister. This script returns empty string. By 
> examining reg2subject code, it in case of .lta searches for string 
> "subject" in lta file. However there is no such string in my .lta.
>
> My .lta file was created by tkregister2 by conversion from fsl .mat 
> file (without specification of subject) by command:
>
> tkregister2 --mov mov.nii.gz --targ targ.nii.gz --ltaout mov2targ.lta 
> --fsl mov2targ.mat --reg /tmp/junk --noedit
>
> where mov2targ.mat is vox2vox fsl-style matrix encoding transformation 
> from mov.nii.gz to targ.nii.gz. I checked validity of produced .lta 
> file by tkregister2 and it looks OK.
>
> The straightforward remedy in my case possibly would be to remove 
> reg2subject invocation from bbregister (since I am already providing 
> the subject by --s option), or add subject id to .lta.
>
> General solution in bbregister code would possibly be to provide test 
> whether subject id is specified and in case it is not, then read the 
> subject id from registration file. Or read both and in case of 
> non-empty return of reg2subject, then compare obtained subject id with 
> subject id supplied by --s and  in case of different strings, produce 
> a warning and use one of them (--s would take precedence?).
>
> My second inquiry is following: My idea was to do the registration in 
> 3 stages: provide rough alignment with .lta, then mri_coreg (or 
> fsl-flirt) and then bb-registration. My experience is, that in some 
> situations when the images are very differently aligned, the 
> --init-fsl totally fails.
>
> Is it possible to realize it by supplying both --init-reg and 
> --init-coreg (or even combination of --init-reg --init-best to try 
> both mri_coreg and flirt)?
>
> Regards,
>
> Antonin Skoch