[Insight-developers] Addressing Failures of ResampleImageFilter9Test

Tom Vercauteren tom.vercauteren at m4x.org
Tue Aug 18 08:47:44 EDT 2009


Hi Brad,

See comments below.

On Tue, Aug 18, 2009 at 14:24, Bradley Lowekamp<blowekamp at mail.nih.gov> wrote:
> Hello,
>
>        I can't help but notice that this test uses
> VECTORResampleImageFilter. There is a significant difference between the
> vector implementation and the regular scalar implementation. Even the
> original Resample filter was more optimizes, and in some cases just used
> integer math to perform the interpolation. This looks like a case where
> having the difference implementations may be costly.
>
> Perhaps the Vector resample filter could be written with an set of element
> adaptor calling the scalar rescaler? .... I am not sure how the output would
> work.
>
> Yea, I know it's late for that suggestion before the release. I am also not
> sure if there would be a performance hit. It is just a shame that so have
> double implementations.

Agreed. This is what drove me to make the (scalar) linear interpolator
also work with vector images. However there is a quite some work to be
done before we can get rid of all "Vector" filters and functions.
Also, it will most likely require using some partial template
specialization which is currently not possible. Maybe we should try
and make it happen in ITK 4 as I proposed (with some more details)
here:

    http://www.itk.org/Wiki/ITK_Release_4.0#Image_Registration


Tom

>
> Brad
>
> On Aug 18, 2009, at 7:44 AM, Tom Vercauteren wrote:
>
>> Hi Bill,
>>
>> sse2 can indeed change numerical precision, for example if the sse fpu
>> is used. However, it is possible to use sse2 functions without
>> switching to the sse fpu (see the -mfpmath and -msse2 options of gcc).
>> In our case, there is nothing with the VNL_CONFIG_ENABLE_SSE2_ROUNDING
>> option that forces the fpu to be the sse one.
>>
>> My point was rather that the current failing test is not very
>> meaningful since it relies on invalid assumptions on floating point
>> computations. No matter what FPU is used, there is no guarantee that
>> 0.4 + 6*0.35 provides a portable answer.
>>
>> This numerical precision topic will be even more complicated by the
>> fact that extended precision (i.e. doubles are internally represented
>> as 80 bits and not 64,
>> http://en.wikipedia.org/wiki/Extended_precision) should also be taken
>> into account.
>>
>> Tom
>>
>> On Tue, Aug 18, 2009 at 12:54, Bill Lorensen<bill.lorensen at gmail.com>
>> wrote:
>>>
>>> Tom,
>>>
>>> I think we are both correct. It is a precision issue, but I think sse2
>>> affects precision. At least that's what I can gather from :
>>> http://en.wikipedia.org/wiki/SSE2
>>>
>>> Bill
>>>
>>> On Tue, Aug 18, 2009 at 5:21 AM, Tom
>>> Vercauteren<tom.vercauteren at gmail.com> wrote:
>>>>
>>>> Hi Bill,
>>>>
>>>> Further testing seems to support the fact that this is not a sse2
>>>> rounding issue but rather a numerical precision one that cannot be
>>>> avoided.
>>>>
>>>> To be more specific, in "real math" we should have
>>>>   0.4 + 6*0.35 == 2.5
>>>> with floating point arithmetic, on some systems, we might have
>>>>   0.4 + 6*0.35 == 2.5
>>>> whereas on others the same operation might lead to
>>>>   0.4 + 6*0.35 < 2.5
>>>>
>>>> It appears that the test is failing because of exactly that. The
>>>> origin is 0.4 the spacing is 0.35, the first pixel that shows a
>>>> difference is the 6th one and further failing pixels are located every
>>>> 20 pixels (note that 20*0.35=7 is the first integer value we can get).
>>>>
>>>> I would vote for making the comparison less stringent. Thoughts?
>>>>
>>>> Tom
>>>>
>>>> P.S. The attached small test case illustrate the numerical precision
>>>> "issue" above and shows that this is apparently unrelated to sse2
>>>> rounding.
>>>>
>>>>
>>>> On Tue, Aug 18, 2009 at 09:17, Tom
>>>> Vercauteren<tom.vercauteren at gmail.com> wrote:
>>>>>
>>>>> Hi Bill,
>>>>>
>>>>> Thanks for investigating this. VNL_CONFIG_ENABLE_SSE2_ROUNDING is
>>>>> meant to have no effect (except speed) on the results. If it has, it's
>>>>> a bug.
>>>>>
>>>>> I'll try and get some time to look into this issue.
>>>>>
>>>>> Tom
>>>>>
>>>>> On Mon, Aug 17, 2009 at 19:51, Bill Lorensen<bill.lorensen at gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Luis,
>>>>>>
>>>>>> I believe I found the partition. I checked most (not all)
>>>>>> CMakeLists.txt files (in the itkSystemInformationTest output) for
>>>>>> passing and failing platforms.
>>>>>>
>>>>>> Here is what I concluded:
>>>>>>
>>>>>> Platforms that are failing have a common cmake variable set:
>>>>>> //Enable Streaming SIMD Extensions 2 implementation of rounding
>>>>>> // (hardware dependant).
>>>>>> VNL_CONFIG_ENABLE_SSE2_ROUNDING:BOOL=ON
>>>>>>
>>>>>> those that are passing have one of two conditions:
>>>>>>
>>>>>> 1) ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY:BOOL=OFF
>>>>>> or
>>>>>> 2) VNL_CONFIG_ENABLE_SSE2_ROUNDING:BOOL=OFF
>>>>>>
>>>>>> Should we expect the same results regardless of the SSE2 setting? If
>>>>>> not, then we can check in another baseline. If the results should be
>>>>>> the same, we have some work to do.
>>>>>>
>>>>>> Bill
>>>>>>
>>>>>>
>>>>>> On Sun, Aug 16, 2009 at 12:30 PM, Luis Ibanez<luis.ibanez at kitware.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> FYI:
>>>>>>>
>>>>>>> The test  "ResampleImageFilter9Test":
>>>>>>>
>>>>>>> Has been failing since we enabled the flag
>>>>>>>
>>>>>>> ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY
>>>>>>>
>>>>>>> What seems to be special about this test is that it runs
>>>>>>> on an image of RGBPixels, and therefore, it uses:
>>>>>>>
>>>>>>> itk::VectorResampleImageFilter  and
>>>>>>> itk::VectorNearestNeighborInterpolateImageFunction
>>>>>>>
>>>>>>> What is curious, is that is passes on some machines and fails
>>>>>>> on others, and it doesn't seem to be a clear partition between
>>>>>>> the two groups, (see this link):
>>>>>>>
>>>>>>> http://www.cdash.org/CDash/testSummary.php?project=2&name=ResampleImageFilter9Test&date=2009-08-16
>>>>>>>
>>>>>>>
>>>>>>> We will be following on this during the week....
>>>>>>>
>>>>>>>
>>>>>>> Any suggestions/hints are welcome...
>>>>>>>
>>>>>>>
>>>>>>>     Thanks
>>>>>>>
>>>>>>>
>>>>>>>         Luis
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.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
>>>>>>
>>>>>> 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
>>
>> 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