[slicer-users] bad allocation error in FastMarchingSegmentation module

Andriy Fedorov fedorov at bwh.harvard.edu
Wed May 19 15:57:26 EDT 2010


I doubt the error is caused by a memory leak.

What is the range of intensities that you have in your input image,
and what are the dimensions in voxel space?

The code allocates quite a lot of memory (my fault, this is not
described in the documentation). The function that caused the failure
in your case attempts to allocate something like

17*dX*dY*dZ + 20*(max_intensity-min_intensity) bytes (if you use 32-bit system)

where dX dY dZ are the dimensions of the input image in voxel space.

So, depending on what is the size of your image, you may run out of
memory, which would cause the problem you describe. Chances of this
happening depend on the size of the image, scalar type, scalar range,
OS you use, whether you use 32- or 64- bit system, and how much memory
you already have in use. You did not give any details of your setup,
so it's hard to pin-point the problem.

There are several approaches to resolve this, without looking at your setup:

1) you can use CropVolume module
to extract a smaller VOI around the structure you are trying to
segment (use resample constant 1.0). This will reduce dimensions of
the input image.

2) you can rescale the intensities of your image to a smaller range

3) you can do both 1) and 2)

Unfortunately, there is no module in Slicer to do (2). I can add this
module, if (1) does not work for you.

Please let us know if this helps you at all.

Also, if your data is anonymized,and you can share it, please share it
with me, and I could try to give you more specific help.


On Wed, May 19, 2010 at 15:10, אלעד <e.dabool at gmail.com> wrote:
> hello all,
> I have a problem with the FastMarchingSegmentation module,
> when i use it after loading Slicer with a volume and some input the module
> works great.
> but if i try to use it again, i receive a bad allocation error. i guess
> there is a memory leak in this module.
> can someone tell us what can be done, this module is very important for our
> work.
> Thank you,
> Elad Dabool
> the error we received:
> ERROR: In ..\KWWidgets\vtkKWTkUtilities.
> cxx, line 230
> vtkSlicerApplication (0BD9AF90):
>     Script:
> FastMarchingSegmentationProcessGUIEvents vtkObj5152 vtkObj5265 10000
>     Returned Error on line 1:
> Uncaught exception: bad allocation
> Stack trace:
> Uncaught exception: bad allocation
>     while executing
> "$fmFilter init [expr [lindex $dim 1] + 1] [expr [lindex $dim 3] + 1]  [expr
> [lindex $dim 5] + 1] $depth $dx $dy $dz"
>     (procedure "FastMarchingSegmentationInitializeFilter" line 29)
>     invoked from within
> "FastMarchingSegmentationInitializeFilter $this"
>     (procedure "FastMarchingSegmentationProcessGUIEvents" line 43)
>     invoked from within
> "FastMarchingSegmentationProcessGUIEvents vtkObj5152 vtkObj5265 10000"
> _______________________________________________
> slicer-users mailing list
> slicer-users at bwh.harvard.edu
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to slicer-users-request at massmail.spl.harvard.edu
> with unsubscribe as the subject

More information about the slicer-users mailing list