I found the problem. To save space I only included the surf/{l,r}h.white and surf/{l,r}h.white.reg files in the ICBM2009c_fs6 subejct folder (to save space in my container). After including everything the corregistration run under 10s.

Do you have some ideas which files are speeding up the process?

Best,
Chris

On Thu, Nov 10, 2016 at 12:37 PM, Chris Filo Gorgolewski <chris.gorgolewski@gmail.com> wrote:
There is only one frame in rh.sig.mgh file (see below). Most time seems to be spent in calculating forward and reverse loops. Ideas?

root@36ddc1c5be86:/code# mri_info /d/drive/workspace/brainbrowser/examples/models/rh.sig.mgh
Volume information for /d/drive/workspace/brainbrowser/examples/models/rh.sig.mgh
          type: MGH
    dimensions: 163842 x 1 x 1
   voxel sizes: 1.000000, 1.000000, 1.000000
          type: FLOAT (3)
           fov: 163842.000
           dof: 0
        xstart: -81921.0, xend: 81921.0
        ystart: -0.5, yend: 0.5
        zstart: -0.5, zend: 0.5
            TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees
       nframes: 1
       PhEncDir: UNKNOWN
       FieldStrength: 0.000000
ras xform present
    xform info: x_r =  -1.0000, y_r =   0.0000, z_r =   0.0000, c_r =     0.0000
              : x_a =   0.0000, y_a =   0.0000, z_a =   1.0000, c_a =     0.0000
              : x_s =   0.0000, y_s =  -1.0000, z_s =   0.0000, c_s =     0.0000

talairach xfm :
Orientation   : LIA
Primary Slice Direction: coronal

voxel to ras transform:
               -1.0000   0.0000   0.0000 81921.0000
                0.0000   0.0000   1.0000    -0.5000
                0.0000  -1.0000   0.0000     0.5000
                0.0000   0.0000   0.0000     1.0000

voxel-to-ras determinant -1

ras to voxel transform:
               -1.0000  -0.0000  -0.0000 81921.0000
               -0.0000  -0.0000  -1.0000     0.5000
               -0.0000   1.0000  -0.0000     0.5000
               -0.0000  -0.0000  -0.0000     1.0000


On Thu, Nov 10, 2016 at 12:34 PM, Douglas N Greve <greve@nmr.mgh.harvard.edu> wrote:
16min is a very long time. How many frames are in rh.sig.mgh? For a
single frame it should only take 10 or 20 sec


On 11/10/2016 03:25 PM, Chris Filo Gorgolewski wrote:
> Thanks for a prompt reply. The command takes ~16 minutes per
> hemisphere in my setting. Are those realistic numbers or is it longer
> than it should take?
>
> mri_surf2surf --s fsaverage --hemi rh --sval
> /d/drive/workspace/brainbrowser/examples/models/rh.sig.mgh
> --trgsubject ICBM2009c_fs6 --tval /tmp/out.mgh
>
> sysname  Linux
> hostname 36ddc1c5be86
> machine  x86_64
> user     root
> srcsubject = fsaverage
> srcval     = /d/drive/workspace/brainbrowser/examples/models/rh.sig.mgh
> srctype    =
> trgsubject = ICBM2009c_fs6
> trgval     = /tmp/out.mgh
> trgtype    =
> srcsurfreg = sphere.reg
> trgsurfreg = sphere.reg
> srchemi    = rh
> trghemi    = rh
> frame      = 0
> fwhm-in    = 0
> fwhm-out   = 0
> label-src  = (null)
> label-trg  = (null)
> OKToRevFaceOrder  = 1
> UseDualHemi = 0
> Reading source surface reg
> /opt/freesurfer/subjects/fsaverage/surf/rh.sphere.reg
> Loading source data
> Reading target surface reg
> /opt/freesurfer/subjects/ICBM2009c_fs6/surf/rh.sphere.reg
> Done
> Using surf2surf_nnfr()
> Mapping Source Volume onto Source Subject Surface
> surf2surf_nnfr: building source hash (res=16).
> Surf2Surf: Forward Loop (157000)
>
> surf2surf_nnfr: building target hash (res=16).
> Surf2Surf: Reverse Loop (163842)
> Reverse Loop had 117731 hits
> Surf2Surf: Dividing by number of hits (157000)
> INFO: nSrcLost = 0
> nTrg121 = 152424, nTrgMulti =  4576, MnTrgMultiHits = 26.7279
> nSrc121 = 133857, nSrcLost =     0, nSrcMulti = 29985, MnSrcMultiHits
> = 4.69815
> Saving target data
> Saving to /tmp/out.mgh
>
> real    16m25.129s
> user    16m24.160s
> sys     0m0.260s
>
> On Thu, Nov 10, 2016 at 11:40 AM, Douglas N Greve
> <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> wrote:
>
>     Years ago I used to have code that would cache this transform, but we
>     abandoned it because it would get out of synch whenever someone
>     updated
>     their recon, and, for ordinary apps, it does not take that much time.
>
>
>     On 11/10/2016 02:13 PM, Chris Filo Gorgolewski wrote:
>     > Thanks for a quick reply. I'm actually in a situation where I do not
>     > have all of the overlays at the same time so I cannot
>     concatenate them.
>     >
>     > To put more contexts: I am building surface support into neurovault.
>     > When someone uploads a surface statistical map I want to
>     automatically
>     > calculate a projection of this map into MNI volume. To improve
>     the MNI
>     > volume surface mapping I have reconstructed the surface of the
>     > 2009c_asym_nlin template. For every incoming map I am doing
>     > fsaverage -> MNI2009c mri_surf2surf followed by mri_surf2vol.
>     However,
>     > the mri_surf2surf takes quite a bit of time to run and most of it is
>     > spend on coregistration - which is always the same. If only I could
>     > calculate the coregistration once and apply it to every incoming map
>     > it would speed things up tremendously.
>     >
>     > Let me know if you have any ideas.
>     >
>     > Best,
>     > Chris
>     >
>     > On Thu, Nov 10, 2016 at 10:26 AM, Douglas N Greve
>     > <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>
>     <mailto:greve@nmr.mgh.harvard.edu
>     <mailto:greve@nmr.mgh.harvard.edu>>> wrote:
>     >
>     >     You can use mri_concat to create a stack of overlays, then
>     >     mri_surf2surf
>     >     the entire stack, then split the stack.
>     >
>     >
>     >     On 11/10/2016 12:28 AM, Chris Filo Gorgolewski wrote:
>     >     > Hi,
>     >     > I need to convert a big number of scalar surface maps from
>     fsaverage
>     >     > to one particular subject space. This means running
>     mri_surf2surf
>     >     > command many times. For each execution the same
>     transformation is
>     >     > calculated and then applied. Since estimating the
>     transformation
>     >     take
>     >     > a substantial amount of time I was wondering if I could
>     >     calculate the
>     >     > transformation once and just apply it (which is a common
>     thing in
>     >     > volumetric registration). I perused the website and the
>     command line
>     >     > options, but I could not find anything. Is it possible to
>     save and
>     >     > reuse surface transformations?
>     >     >
>     >     > Best,
>     >     > Chris
>     >     >
>     >     >
>     >     > _______________________________________________
>     >     > Freesurfer mailing list
>     >     > Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>     >     >
>     https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>     >     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>     >
>     >     --
>     >     Douglas N. Greve, Ph.D.
>     >     MGH-NMR Center
>     > greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>
>     <mailto:greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>>
>     >     Phone Number: 617-724-2358 <tel:617-724-2358>
>     <tel:617-724-2358 <tel:617-724-2358>>
>     >     Fax: 617-726-7422 <tel:617-726-7422> <tel:617-726-7422
>     <tel:617-726-7422>>
>     >
>     >     Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
>     <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting>
>     >     <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
>     <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting>>
>     >     FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
>     <https://gate.nmr.mgh.harvard.edu/filedrop2>
>     >     <https://gate.nmr.mgh.harvard.edu/filedrop2
>     <https://gate.nmr.mgh.harvard.edu/filedrop2>>
>     > www.nmr.mgh.harvard.edu/facility/filedrop/index.html
>     <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>
>     >     <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html
>     <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>>
>     >     Outgoing:
>     > ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/
>     <ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/>
>     >     <ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/
>     <ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/>>
>     >
>     >     _______________________________________________
>     >     Freesurfer mailing list
>     > Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     <mailto:Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>     > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>     >
>      <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>     >
>     >
>     >     The information in this e-mail is intended only for the
>     person to
>     >     whom it is
>     >     addressed. If you believe this e-mail was sent to you in
>     error and
>     >     the e-mail
>     >     contains patient information, please contact the Partners
>     >     Compliance HelpLine at
>     > http://www.partners.org/complianceline
>     <http://www.partners.org/complianceline>
>     >     <http://www.partners.org/complianceline
>     <http://www.partners.org/complianceline>> . If the e-mail was sent
>     >     to you in error
>     >     but does not contain patient information, please contact the
>     >     sender and properly
>     >     dispose of the e-mail.
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > Freesurfer mailing list
>     > Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>
>     --
>     Douglas N. Greve, Ph.D.
>     MGH-NMR Center
>     greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>
>     Phone Number: 617-724-2358 <tel:617-724-2358>
>     Fax: 617-726-7422 <tel:617-726-7422>
>
>     Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
>     <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting>
>     FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
>     <https://gate.nmr.mgh.harvard.edu/filedrop2>
>     www.nmr.mgh.harvard.edu/facility/filedrop/index.html
>     <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>
>     Outgoing:
>     ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/
>     <ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/>
>
>     _______________________________________________
>     Freesurfer mailing list
>     Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>     <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>
>
>
>
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

--
Douglas N. Greve, Ph.D.
MGH-NMR Center
greve@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer