[Insight-developers] N3/itkBSplineScatteredDataPointSetToImageFilter problems

Matthew McCormick (thewtex) matt at mmmccormick.com
Sun Dec 12 02:07:41 EST 2010


Hi Nick and Richard,

I  found a fix that seems to work for me.  And it side-steps the scorn
of undergrad CS professors ;-).  I changed the multiplier from a
double to a integer, which probably avoids some funky binary floating
point issues.

The patch is here:
http://review.source.kitware.com/#change,554

Thanks,
Matt

On Tue, Nov 30, 2010 at 9:48 AM, Nicholas Tustison <ntustison at gmail.com> wrote:
> That would be fine or we could just set it internally to 0.0001 (or something similar) as described earlier which would probably work for most, if not all platforms and applications without a problem.  I just have ignore the voice of my undergrad CS professor in my head yelling "No magic numbers!"
>
> Nick
>
>
> On Nov 30, 2010, at 10:44 AM, Matthew McCormick (thewtex) wrote:
>
>> Thanks for the information, Nick.
>>
>> I was actually getting this error yesterday too in another context.
>> It only happened with a certain combination of image dimensions and
>> number of control points.
>>
>> Maybe the BSplineEpsilon could be made a parameter of the
>> itkBSplineScatteredDataPointSetToImageFilter?
>>
>> Regards,
>> Matt
>>
>> On Tue, Nov 30, 2010 at 4:56 AM, Nicholas Tustison <ntustison at gmail.com> wrote:
>>> Hi Richard,
>>>
>>> First, are you using the class itkN4MRIBiasFieldCorrectionImageFIlter or itkN3MRIBiasFieldCorrectionImageFIlter?  If it's the latter, how many levels are you using?  Either way, the error that is being thrown occurs when the B-spline object (in this case the scalar bias field estimate) is evaluated at the boundary maximum.  I tried to account for this in the code by generating a use-specific epsilon value which doesn't always work.  A quick fix would be to go to line 267 (after the following code)
>>>
>>>  while ( static_cast< RealType >( maximumNumberOfSpans ) ==
>>>          static_cast< RealType >( maximumNumberOfSpans ) - this->m_BSplineEpsilon )
>>>    {
>>>    this->m_BSplineEpsilon *= 10.0;
>>>    }
>>>
>>> and add
>>>
>>>  this->m_BSplineEpsilon = 0.0001;
>>>
>>> I didn't put that in the code as it was a bit inelegant but perhaps it's time I revisited that.
>>>
>>> However, having said all that, with your specific error, it would seem that you're using a mesh size of 21 in at least one dimension which is probably too high for a typical bias correction scenario.  Also, I would switch over to N4 if you haven't already done so as, in my experience, it works much better.
>>>
>>> Nick
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Nov 30, 2010, at 5:40 AM, Richard Beare wrote:
>>>
>>>> Hi,
>>>> I'm using the N3 bias correction contribution to Insight Journal and
>>>> having problems when setting the number of control points to 6. The N3
>>>> filter uses itkBSplineScatteredDataPointSetToImageFilter. The error
>>>> message when debug is turned on is:
>>>>
>>>> itk::ExceptionObject (0x20e9210)
>>>> Location: "void itk::MultiThreader::SingleMethodExecute()"
>>>> File: /home/richardb/Build/InsightToolkit-3.20.0/Code/Common/itkMultiThreader.cxx
>>>> Line: 475
>>>> Description: itk::ERROR: MultiThreader(0x342b8f0): Exception occurred
>>>> during SingleMethodExecute
>>>> /usr/local/ITK/ITK-3.20_static/include/InsightToolkit/Review/itkBSplineScatteredDataPointSetToImageFilter.txx:530:
>>>> itk::ERROR: PointSetToImageFilter(0x20e1b20): The reparameterized
>>>> point component 24 is outside the corresponding parametric domain of
>>>> [0, 24].
>>>>
>>>>
>>>> The default setting of 4 control points works, as does 8. Is there a
>>>> requirement for number of control points being a power of 2? If not,
>>>> then it appears that there must be some sort of rounding error in how
>>>> the bounds are figured out. I hope to submit a more detailed report
>>>> soon, but thought I'd check to see whether this problem is familiar to
>>>> anyone.
>>>>
>>>> Thanks
>>>> _______________________________________________
>>>> 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.html
>>>>
>>>> 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://www.itk.org/mailman/listinfo/insight-developers
>>>
>>> _______________________________________________
>>> 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.html
>>>
>>> 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://www.itk.org/mailman/listinfo/insight-developers
>>>
>
>


More information about the Insight-developers mailing list