To Martin,

Thanks a bunch. I haven't tested out all the recommendations, but at least I know what's going on. If I did want to convert to uchar, how would I go about this? Is there a function included in the Freesurfer package, or would I have to write my own function to do so? It's not a concern, as I'm probably not going to explore this avenue, but if I get time, I might enjoy trying to write such a function...

Regards,
Mahen

On Wed, Feb 9, 2011 at 7:07 AM, Martin Reuter <mreuter@nmr.mgh.harvard.edu> wrote:
Hi Mahen,

4.5 is based on flirt registration which does a pairwise registration to
the first image. Since 5.0 we use the mri_robust_template tool (as it
can ignore outlier regions and produces more accurate registrations, see
Reuter et al Neuroimage 2010 "..robust registration"), but it is more
memory hungry and time consuming.

If your input images are large, it can happen that mri_robust_template
uses a lot of memory. I tested that tool in the longitudinal stream
where I successfully ran it on > 10 images on a 4 gig machine (those
images are probably smaller than yours).

So you have the following options:

1. use only the best 2 input images. This has been recommended in the
past, 5 inputs are usually not improving anything (see old emails on
this list from Bruce)

2. pass the flag -flirt-motioncor to recon-all and it will revert back
to using flirt (but accuracy of the registration might suffer, since the
inputs are full head images with potentially a lot of differences in
jaw, tongue, neck, eyes, scalp and cropping planes).

Another option would be to convert the inputs to uchar and see if that
fits into the memory. They will be converted to uchar anyway in the
conform step.

Best, Martin

On Tue, 2011-02-08 at 23:21 +0800, Mahen wrote:
> Hi all,
>
> Since upgrading to Freesurfer v5.0, I have been unable to complete the
> first step of recon-all ('recon-all -autorecon1 -subjid ...') when
> using 5 anatomical datasets (our typical load for surface
> reconstruction). The problem seems to come when the third dataset is
> being registered, at which point recon-all exits with the following
> error message:
> =========================
> Resolution: 0
>  Iteration(single-prec): 1 (subsample 200) mri_robust_template(47536)
> malloc: *** mmap(size=921600) failed (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
> MRIalloc(480, 480, 248): could not allocate 921600 bytes for 207th
> slice
>
> Cannot allocate memory
> /Users/mahen/fMRI/Surfaces/cck_kmu
> \n
> mri_convert /Users/mahen/fMRI/Surfaces/cck_kmu/mri/rawavg.mgz /Users/mahen/fMRI/Surfaces/cck_kmu/mri/orig.mgz --conform \n
> mri_convert /Users/mahen/fMRI/Surfaces/cck_kmu/mri/rawavg.mgz /Users/mahen/fMRI/Surfaces/cck_kmu/mri/orig.mgz --conform
> mghRead(/Users/mahen/fMRI/Surfaces/cck_kmu/mri/rawavg.mgz, -1): could
> not open file
> $Id: mri_convert.c,v 1.166.2.2 2010/08/10 19:11:50 greve Exp $
> reading from /Users/mahen/fMRI/Surfaces/cck_kmu/mri/rawavg.mgz...
> Darwin MahenWillEatYourChildren.local 10.6.0 Darwin Kernel Version
> 10.6.0: Wed Nov 10 18:13:17 PST 2010;
> root:xnu-1504.9.26~3/RELEASE_I386 i386
>
> recon-all -s cck_kmu exited with ERRORS at Tue Feb  8 20:50:00 CST
> 2011
> =====================
> My machine has 4gb of RAM, and I've ssh'd into my advisor's machine
> (which has 16gb) and had the same problem.
> I tryed updating the binaries for recon-all and mri_robust_template
> (from
> http://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/misc/macos-leopard-intel/), but the problem remained unsolved.
> My advisor informs me that it is now running with version 4.5 (all 5
> anatomicals); I'd still like to know what's going on. I have tried
> running it on version 5 with just 2 anatomical datasets, and it works
> just fine.
>
> Here is the output of bugr:
>
> FREESURFER_HOME: /Applications/freesurfer
>
> Build stamp: freesurfer-Darwin-leopard-i686-stable-pub-v5.0.0
>
> Kernel info: Darwin 10.6.0 i386
>
> Thanks in advance,
> Mahen
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer