[ITK] [ITK-dev] Problem with itkPCAShapeSignedDistanceFunction in multithreaded environment when using a 'dense' solver
Matt McCormick
matt.mccormick at kitware.com
Mon Aug 25 23:31:16 EDT 2014
Hi Yves,
Yes, your comments are very welcome. Thank you for discussing this
issue with the list!
Regarding the issue described and the patch, I think it is a good
start. As you not, the smart pointers are not very effective from an
efficiency perspect, and it would be fine to replace them by raw
pointer since there is no issue with ownership or life time
management. However, the thread-safety is still an issue. Digging
into the code, it looks like the m_Selectors member in
PCAShapeSignedDistanceFunction can be removed altogether. Please
review this patch:
http://review.source.kitware.com/#/c/16824/
Thanks,
Matt
On Mon, Aug 18, 2014 at 10:30 AM, Yves Frederix
<yves.frederix+itk at gmail.com> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers
More information about the Community
mailing list