[Insight-users] reusing Filters

marquis2 at etu.unige.ch marquis2 at etu.unige.ch
Thu Apr 21 06:35:08 EDT 2005


hi,

is it ok to reuse a filter many times or does it have to be instanciated once
per use ? the docs suggests the first but I have a SIGABRT with a
BinnaryThresholdImageFilter< ImageType, ImageType >
(with ImageType = short, 2) for every _second_ image I want to filter:

Program received signal SIGABRT, Aborted.
[Switching to Thread 16384 (LWP 12578)]
0x4096cb71 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0  0x4096cb71 in kill () from /lib/i686/libc.so.6
#1  0x4080bcf1 in pthread_kill () from /lib/i686/libpthread.so.0
#2  0x4080c00b in raise () from /lib/i686/libpthread.so.0
#3  0x4096c904 in raise () from /lib/i686/libc.so.6
#4  0x4096de8c in abort () from /lib/i686/libc.so.6
#5  0x40910305 in __cxxabiv1::__terminate(void (*)()) () from
/usr/lib/libstdc++.so.5
#6  0x40910342 in std::terminate() () from /usr/lib/libstdc++.so.5
#7  0x409104c2 in __cxa_throw () from /usr/lib/libstdc++.so.5
#8  0x081c9fe2 in itk::DataObject::PropagateRequestedRegion() ()
#9  0x081d964a in itk::ProcessObject::PropagateRequestedRegion(itk::DataObject*)
()
#10 0x081c9e7f in itk::DataObject::PropagateRequestedRegion() ()
#11 0x081c9cb5 in itk::DataObject::Update() ()

code is:

thresholdFilter->SetInput(image);
thresholdFilter->SetLowerThreshold( threshold );
thresholdFilter->SetUpperThreshold( itk::NumericTraits< PixelType >::max());
thresholdFilter->SetOutsideValue( 0 ) ;
thresholdFilter->SetInsideValue( white );
thresholdFilter->Update();

is there other "cleaning"
I should make between each use so that it does not crash on the second?

My code works fine with ::New() before each use.

TIA for any help!
Samuel








More information about the Insight-users mailing list