[Insight-users] Re: memory saving

Luis Ibanez luis . ibanez at kitware . com
Mon, 16 Jun 2003 14:58:42 -0400


Hi Tim,

Yeap, for that size of data you probably need to
delete intermediate memory as the pipeline progresses.

This is easily done by the filters themselves if you
invoke on them the method

          filter->ReleaseDataFlagOn();

This will make that when the 'next' filter in the pipeline
is done with its input, this filter will free the memory
of its own output.

That should help a lot...

If after enabling this flag you still have memory restrictions
you may want to consider doing the preprocessing in a fully
separate program. This actually have the advantage that you
fine tune the parameters of the Speed image generation prior
to executing the ShapeDetection filter.

In general, once you have a nice speed image, the level sets
should run nicely.

I actually would consider to break this in three pieces:

1) Smoothing + GaussDerivative + Sigmoid ==> SpeedImage
2) SpeedImage + seed points ==> FastMarcing ==> InitialLevelSet
3) InitialLevelSet + SpeedImage ==> ShapeDetection ==> FinalLevelSet

Each one of these three steps has enough parameters so that
you can have fun tunning them for a while  :-).

It is certainly not worth to attempt to run (2) until the output
of (1) is perfectioned. Same thing goes for (3) after (2).

Running the intermediate steps will help you with the parameter
tunning. Once you find a good combination of parameters for you
type of image, you would be ready for putting all the pieces
back together in a single application.



Regards,



    Luis


------------------
Tim Rudge wrote:
> Thanks Luis, I have tried release mode and it is much quicker... but i 
> think i still need to get it quicker as my data is ~500^3. Plus i have 
> memory problems. I think this is because I set up the pipeline and then 
> run the whole thing - so is each filter producing a seperate image as a 
> result?, i.e. 
> input[Image]->smoothing->[Image]->Gaussderivative->[Image]->sigmoid->[Image
> ]->fastmarching->[Image]->Levelsets->[Image]. Thats 6 images of the same 
> size as the input, right? So is it ok to do each stage seperately 
> deleting results when they are not needed?
> 
> Tim
> 
> --On 16 June 2003 11:49 -0400 Luis Ibanez <luis . ibanez at kitware . com> wrote:
> 
>>
>> Hi Tim,
>>
>> All ITK filters will be much quicker in Release mode.
>>
>> When you compile for Debug mode, the code that is
>> intended to be inlined is just compiled as regular
>> functions. Debug mode, doesn't take advantage of
>> all what templates are supposed to contribute in
>> run-time performance.
>>
>> Filters like the MedianImageFilter in a 5x5x5
>> neighborhood will run 10 to 15 times faster when
>> compiled for Release.
>>
>> So, yeap: Please rebuild your application for Release,
>> that should make a huge difference.
>>
>> Note that you must recompile ITK itself for release,
>> as well as any other third party library you may be
>> using in your applications. (e.g. VTK, FLTK...).
>> Mixing compilation modes will result in link problems
>> and run-time instability.
>>
>> If after compiling for release you still find the
>> execution time to be too long, there are a couple
>> of things that can be done for improving performance.
>> For example doing multiresolution in the level set,
>> and improving the initializatoin.
>>
>> Please let us know what you find
>>
>>
>> Regards,
>>
>>
>>     Luis
>>
>>
>> -----------------
>> Tim Rudge wrote:
>>
>>> Hi,
>>>
>>> Im using itkShapeDetectionLevelSetFilter and it seems to be v. slow in
>>> debug mode (to the point where im having to resample from 500^3 to 50^3
>>> to get reasonable comp. times of 1-2 mins for the whole pipeline). Will
>>> this be much quicker in release mode or am i doing s/thing wrong? This
>>> is on a dual 600MHz 2Gb winXP m/c.
>>>
>>> Tim
>>>
>>> Tim Rudge
>>> ---------
>>> Cellular Development Lab
>>> Dept. Plant Sciences
>>> Cambridge University
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at www . itk . org
>>> http://www . itk . org/mailman/listinfo/insight-users
>>>
>>
>>
>>
> 
> 
> 
> Tim Rudge
> ---------
> Cellular Development Lab
> Dept. Plant Sciences
> Cambridge University
> _______________________________________________
> Insight-users mailing list
> Insight-users at www . itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>