Error loading freesurfer segmentation

Hi, I am facing the same problem. When I try to load a freesurfer segmentation (a standard aparc+aseg.mgz) on Ubuntu (either using the importer interface, the load volume interface or a slicerpython command) I will get this error:

ReferenceImageExtentOffset attribute was not found in NRRD segmentation file. Assume no offset.

“Slicer has caught an application error, please save your work and restart.\n\nThe application has run out of memory. Increasing swap size in system settings or adding more RAM may fix this issue.\n\nIf you have a repeatable sequence of steps that causes this message, please report the issue following instructions available at\n\n\nThe message detail is:\n\nException thrown in event: std::bad_alloc”

I’m using last version of Slicer and FreeSurferImporter on Ubuntu 23.04

@Maurilio_Genovese, the error message you get suggests that the image you try to load is too big for the RAM memory you have. Could you provide a pointer to the concrete dataset you try to load and the specifications of your computer? I’m not a user of FreeSurferImporter but I could try to install it and give it a try in my Linux machine.

I have 8gb RAM memory and I can load without error this segmentation in the same machine windows partition. Moreover a collegue had the same error on a linux high performance machine.
I also tried with standard freesurfer course data ( and, and I’m still getting the same error on linux.
I think this is a bug and not a problem of my computer setting.
Should I report at SlicerFreeSurfer or is this the right place?

@Maurilio_Genovese I can reproduce the same issue on my Linux machine (32 GB). To me it looks that is not a memory issue but a bug as you pointed out. The error seems to be triggerd by the QTGUI component: in Slicer. I’m currently building a debug version of Slicer to inspect more on this. I’ll come back with more info

Great! Thank you for your help

@Maurilio_Genovese, I’ve built Slicer on my machine in both master and v5.4.0 with Debug configuration, as well as the SlicerFreeSurfer extension master with Debug configuration. On these builds, I cannot reproduce the error and the aparc+aseg.mgz dataset imports successfully.

As a workaround, you could try to build Slicer and SlicerFreeSurfer yourself (

I’m tagging here some of the developers of 3D Slicer and SlicerFreeSurfer, maybe there is something else we can try to get to the bottom of the problem: @Sunderlandkyl, @lassoan, @jcfr, @pieper

Hmm, that’s very strange that the factory build would be throwing an exception but a local build would not. It might have to do with the system library versions or perhaps an compiler or optimization issues. You could look at any memory allocation code in the FreeSurfer extension to see if there is any faulty logic, perhaps to do with byte swapping or something that could lead to a crash. Since you have a debug build you could step through the loading process and see what each allocation is doing and see if any of the logic looks questionable.