<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">The problem, I’m guessing, is exactly as Carlos points out—</div><div class="">The direction cosines are not identity and the LandmarkBased</div><div class="">TransformInitializer isn’t handling it properly.  The B-spline </div><div class="">filter operates in the parametric domain and so it has no sense of </div><div class="">the physical orientation.  </div><div class=""><br class=""></div><div class="">if you take a look at this filter</div><div class=""><br class=""></div><div class=""><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx</a></div><div class=""><br class=""></div><div class="">you can see how I go between domains.  Particularly, take a look</div><div class="">at the following code sections:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L159-L171" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L159-L171</a></div><div class=""><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L253-L255" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx#L253-L255</a></div><div class=""><br class=""></div><div class="">I can probably take a look at the initializer to propose a fix but I’m</div><div class="">leaving tomorrow on vacation for a week and a half and won’t be</div><div class="">able to get to it until afterwards.</div><div class=""><br class=""></div><div class="">Nick</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 4, 2015, at 8:44 AM, Carlos Henrique Villa Pinto <<a href="mailto:chvillap@gmail.com" class="">chvillap@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Hi Matt,<div class=""><br class=""></div><div class="">I installed the most recent version of ITK from Git master, wrote a SSCCE code and tried again.</div><div class="">There is no segmentation fault anymore (good!), but now the program terminates after throwing the following exception:</div><div class=""><br class=""></div><div class=""><div class="">terminate called after throwing an instance of 'itk::ExceptionObject'</div><div class="">  what():  /home/carlos/workspace/libraries/ITK/src/Modules/Core/Common/src/itkMultiThreader.cxx:417:</div><div class="">itk::ERROR: MultiThreader(0x1757290): Exception occurred during SingleMethodExecute</div><div class="">/usr/local/include/ITK-4.9/itkBSplineScatteredDataPointSetToImageFilter.hxx:621:</div><div class="">itk::ERROR: PointSetToImageFilter(0x1761130): The reparameterized point component -0.15748 is outside the corresponding parametric domain of [0, 2).</div><div class=""><br class=""></div></div><div class="">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).</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Please let me know if you find out anything.</div><div class=""><br class=""></div><div class="">Thanks!<br class=""></div><div class="">[]s<br class=""></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">2015-11-02 14:10 GMT-02:00 Matt McCormick<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:matt.mccormick@kitware.com" target="_blank" class="">matt.mccormick@kitware.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Hi Carlos,<br class=""><br class="">There have been some improvements to the<br class="">LandmarkBasedTransformInitializer recently, so could you please try<br class="">with Git master [1]?<br class=""><br class="">If the issue remains, could you please share a short, self-contained,<br class="">compilable example?<br class=""><br class="">Thanks,<br class="">Matt<br class=""><br class="">[1]<span class="Apple-converted-space"> </span><a href="http://www.itk.org/Wiki/ITK/Git" rel="noreferrer" target="_blank" class="">http://www.itk.org/Wiki/ITK/Git</a><br class=""><br class="">[2]<span class="Apple-converted-space"> </span><a href="http://www.sscce.org/" rel="noreferrer" target="_blank" class="">http://www.sscce.org/</a><br class=""><div class=""><div class="h5"><br class="">On Thu, Oct 29, 2015 at 9:12 AM, Carlos Henrique Villa Pinto<br class=""><<a href="mailto:chvillap@gmail.com" class="">chvillap@gmail.com</a>> wrote:<br class="">> Hi, everyone.<br class="">><br class="">> I have two sets of landmark points, detected from two different 3D MR<br class="">> images, and I'm trying to estimate a nonlinear mapping between the pairs of<br class="">> matching landmarks. I already have the matchings, I just need to generate a<br class="">> BSpline transform from them. The LandmarkBasedTransformInitializer class<br class="">> seems perfect for that, but when I call its InitializeTransform() method<br class="">> (after setting all the required input parameters), the result is a<br class="">> segmentation fault.<br class="">><br class="">> I'm using ITK 4.8.0. I checked the source code and made some tests, but the<br class="">> only thing that I could find out is that the problem happens in the<br class="">> GenerateData() method of the BSplineScatteredDataPointSetToImageFilter<br class="">> class, when the SingleMethodExecute() method is called by the<br class="">> ThreadGenerator object. In such version of ITK, that happens in line 314 of<br class="">> the file BSplineScatteredDataPointSetToImageFilter.hxx. I couldn't go<br class="">> further because I have no clue of what exactly is being called by the<br class="">> ThreaderCallback in that class.<br class="">><br class="">> Does anyone have any clue about what sort of things could cause a<br class="">> segmentation fault in the BSplineScatteredDataPointSetToImageFilter class?<br class="">> Could that be a bug, maybe?<br class="">><br class="">> I don't know if this information is relevant, but my images have both LPI<br class="">> orientation, origin = (-127.5, -127.5, -127.5) and spacing = 2 x 2 x 2 mm.<br class="">> And I'm using the SetReferenceImage() method of the<br class="">> LandmarkBasedTransformInitializer class to define the parametric domain of<br class="">> the BSpline transform.<br class="">><br class="">> I can provide some pieces of code and more information about my data if<br class="">> needed.<br class="">><br class="">> Thanks in advance!<br class="">><br class="">> []s<br class="">><br class="">> --<br class="">> Carlos Henrique Villa Pinto<br class="">> Graduate Student in Computer Science<br class="">> Federal University of São Carlos - Brazil<br class="">> XCS<br class="">><br class=""></div></div>> _____________________________________<br class="">> Powered by<span class="Apple-converted-space"> </span><a href="http://www.kitware.com/" rel="noreferrer" target="_blank" class="">www.kitware.com</a><br class="">><br class="">> Visit other Kitware open-source projects at<br class="">><span class="Apple-converted-space"> </span><a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank" class="">http://www.kitware.com/opensource/opensource.html</a><br class="">><br class="">> Kitware offers ITK Training Courses, for more information visit:<br class="">><span class="Apple-converted-space"> </span><a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank" class="">http://www.kitware.com/products/protraining.php</a><br class="">><br class="">> Please keep messages on-topic and check the ITK FAQ at:<br class="">><span class="Apple-converted-space"> </span><a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank" class="">http://www.itk.org/Wiki/ITK_FAQ</a><br class="">><br class="">> Follow this link to subscribe/unsubscribe:<br class="">><span class="Apple-converted-space"> </span><a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank" class="">http://public.kitware.com/mailman/listinfo/insight-users</a><br class="">><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature"><div dir="ltr" class="">Carlos Henrique Villa Pinto<div class="">Graduate Student in Computer Science</div><div class="">Federal University of São Carlos - Brazil</div><div class="">XCS</div></div></div></div><span id="cid:93842905-1F7F-4E26-B72A-C6A8ABE2E508"><Example.zip></span><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_____________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Visit other Kitware open-source projects at</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Kitware offers ITK Training Courses, for more information visit:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="http://www.kitware.com/products/protraining.php" class="">http://www.kitware.com/products/protraining.php</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Please keep messages on-topic and check the ITK FAQ at:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="http://www.itk.org/Wiki/ITK_FAQ" class="">http://www.itk.org/Wiki/ITK_FAQ</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Follow this link to subscribe/unsubscribe:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="http://public.kitware.com/mailman/listinfo/insight-users" class="">http://public.kitware.com/mailman/listinfo/insight-users</a></span></div></blockquote></div><br class=""></div></body></html>