[ITK-users] Segmentation fault when trying to generate a BSpline transform from a set of matching landmarks
Nicholas Tustison
ntustison at gmail.com
Wed Nov 4 11:54:37 EST 2015
Hi all,
The problem, I’m guessing, is exactly as Carlos points out—
The direction cosines are not identity and the LandmarkBased
TransformInitializer isn’t handling it properly. The B-spline
filter operates in the parametric domain and so it has no sense of
the physical orientation.
if you take a look at this filter
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx
you can see how I go between domains. Particularly, take a look
at the following code sections:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L159-L171
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L253-L255
I can probably take a look at the initializer to propose a fix but I’m
leaving tomorrow on vacation for a week and a half and won’t be
able to get to it until afterwards.
Nick
> On Nov 4, 2015, at 8:44 AM, Carlos Henrique Villa Pinto <chvillap at gmail.com> wrote:
>
> Hi Matt,
>
> I installed the most recent version of ITK from Git master, wrote a SSCCE code and tried again.
> There is no segmentation fault anymore (good!), but now the program terminates after throwing the following exception:
>
> terminate called after throwing an instance of 'itk::ExceptionObject'
> what(): /home/carlos/workspace/libraries/ITK/src/Modules/Core/Common/src/itkMultiThreader.cxx:417:
> itk::ERROR: MultiThreader(0x1757290): Exception occurred during SingleMethodExecute
> /usr/local/include/ITK-4.9/itkBSplineScatteredDataPointSetToImageFilter.hxx:621:
> itk::ERROR: PointSetToImageFilter(0x1761130): The reparameterized point component -0.15748 is outside the corresponding parametric domain of [0, 2).
>
> I still don't know why this is happening, but it seems to me that it has to do with the image orientation... because my short example works fine when the direction matrices of the fixed/moving images have positive values only. If they have any negative value, however, the exception above is thrown (segmentation fault in previous ITK versions).
>
> I attached my SSCCE code for anyone who wants to take a look. You can use it to manually define values for the direction matrix and see what happens. No input data is needed.
>
> Please let me know if you find out anything.
>
> Thanks!
> []s
>
> 2015-11-02 14:10 GMT-02:00 Matt McCormick <matt.mccormick at kitware.com <mailto:matt.mccormick at kitware.com>>:
> Hi Carlos,
>
> There have been some improvements to the
> LandmarkBasedTransformInitializer recently, so could you please try
> with Git master [1]?
>
> If the issue remains, could you please share a short, self-contained,
> compilable example?
>
> Thanks,
> Matt
>
> [1] http://www.itk.org/Wiki/ITK/Git <http://www.itk.org/Wiki/ITK/Git>
>
> [2] http://www.sscce.org/ <http://www.sscce.org/>
>
> On Thu, Oct 29, 2015 at 9:12 AM, Carlos Henrique Villa Pinto
> <chvillap at gmail.com <mailto:chvillap at gmail.com>> wrote:
> > Hi, everyone.
> >
> > I have two sets of landmark points, detected from two different 3D MR
> > images, and I'm trying to estimate a nonlinear mapping between the pairs of
> > matching landmarks. I already have the matchings, I just need to generate a
> > BSpline transform from them. The LandmarkBasedTransformInitializer class
> > seems perfect for that, but when I call its InitializeTransform() method
> > (after setting all the required input parameters), the result is a
> > segmentation fault.
> >
> > I'm using ITK 4.8.0. I checked the source code and made some tests, but the
> > only thing that I could find out is that the problem happens in the
> > GenerateData() method of the BSplineScatteredDataPointSetToImageFilter
> > class, when the SingleMethodExecute() method is called by the
> > ThreadGenerator object. In such version of ITK, that happens in line 314 of
> > the file BSplineScatteredDataPointSetToImageFilter.hxx. I couldn't go
> > further because I have no clue of what exactly is being called by the
> > ThreaderCallback in that class.
> >
> > Does anyone have any clue about what sort of things could cause a
> > segmentation fault in the BSplineScatteredDataPointSetToImageFilter class?
> > Could that be a bug, maybe?
> >
> > I don't know if this information is relevant, but my images have both LPI
> > orientation, origin = (-127.5, -127.5, -127.5) and spacing = 2 x 2 x 2 mm.
> > And I'm using the SetReferenceImage() method of the
> > LandmarkBasedTransformInitializer class to define the parametric domain of
> > the BSpline transform.
> >
> > I can provide some pieces of code and more information about my data if
> > needed.
> >
> > Thanks in advance!
> >
> > []s
> >
> > --
> > Carlos Henrique Villa Pinto
> > Graduate Student in Computer Science
> > Federal University of São Carlos - Brazil
> > XCS
> >
> > _____________________________________
> > Powered by www.kitware.com <http://www.kitware.com/>
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php <http://www.kitware.com/products/protraining.php>
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ <http://www.itk.org/Wiki/ITK_FAQ>
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/insight-users <http://public.kitware.com/mailman/listinfo/insight-users>
> >
>
>
>
> --
> Carlos Henrique Villa Pinto
> Graduate Student in Computer Science
> Federal University of São Carlos - Brazil
> XCS
> <Example.zip>_____________________________________
> 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://www.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-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20151104/e782766f/attachment.html>
More information about the Insight-users
mailing list