[ITK-dev] Problem with itkPCAShapeSignedDistanceFunction in multithreaded environment when using a 'dense' solver
Yves Frederix
yves.frederix+itk at gmail.com
Mon Aug 18 10:30:36 EDT 2014
Hi all,
I am writing you with a crash I encountered while experimenting with
the GeodesicActiveContour image filter with shape guidance. Although
I did not find the root cause of the problem, I did implement a small
change which might be a useful contribution.
Currently, the GeodesicActiveContourShapePriorLevelSetImageFilter is
based on a SparseField solver. For my application, this was not very
suitable and I implemented a version of this image filter based on a
dense solver. After doing this, however, I consistently experienced a
crash in the algorithm when more than one thread was used. After some
debugging, I tracked down the problem to
itkPCAShapeSignedDistanceFunction, which contains a smart pointer
member variable which caused the crash in the multithreaded run. In
particular, it seemed to me that the reference counting somehow got
confused, and things went wrong.
I did not feel comfortable enough to dig deeper into the root cause of
the problem, but I did do a simple fix to the
itkPCAShapeSignedDistanceFunction code that avoids the problem, which
I would like to share (see attach). Basically, I replaced the
problematic reference counting member variable by a raw pointer, so
that during iteration no reference counting takes place. In this
particular case, I think that this change does not impose any risks as
there is no issue with ownership or life time management.
I am unsure if this mailing list is the best or correct medium to
report this, so if not, please point me to the right direction. If
somebody would be interested in looking at the root cause of this
issue, I should be able to provide some code to reproduce the crash.
Just let me know.
Best regards,
Yves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix.patch
Type: application/octet-stream
Size: 2277 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20140818/baed5118/attachment.obj>
More information about the Insight-developers
mailing list