<div dir="ltr">Hi Bradly,<div><br></div><div>Thank you for your comments. And, I am sorry about lack of my previous explanation.</div><div><br></div><div>I would like to share my observation about that part.</div><div>I made debug messages to figure out why the run-time crash was happened on the previous code as the following:<br></div><div><br></div><div><div>-------------------------------------------------------</div><div>2310: upperBound[i]    ::2147483647</div><div>2310: lowerBound[i]    ::-2147483648</div><div>2310: size[i]                 ::36</div><div>2310: MAX (signed int).::2147483647</div></div><div><br></div><div><div>1/1 Test #2310: itkSampleToHistogramFilterTest3 ...***Exception: Illegal  0.45 sec</div></div><div>-------------------------------------------------------</div><div><br></div><div>----------------<br></div><div><span style="font-size:12.8px">    if ( size[i] > 0 )</span><br style="font-size:12.8px"><span style="font-size:12.8px">       {</span><br style="font-size:12.8px"><span style="font-size:12.8px">-      interval = static_cast<float>( upperBound[i] - lowerBound[i] )</span><br style="font-size:12.8px"><span style="font-size:12.8px">-        / static_cast< MeasurementType >( size[i] );</span><br style="font-size:12.8px"><span style="font-size:12.8px">+      interval = (static_cast<float>( upperBound[i] ) - static_cast<float>(lowerBound[</span><span style="font-size:12.8px">i] ))</span><br style="font-size:12.8px"><span style="font-size:12.8px">+        / static_cast< float >( size[i] );</span><br></div><div><span style="font-size:12.8px">---------------</span></div><div><br></div><div>From the above debug messages and the previous code (see the above code snippet), the value of the numerator exceeded the max value of  the assigned data type (signed int). And, the Clang compiler (3.0) generated a run-time crash on the case.</div><div><br></div><div><br></div><div>If you have any question or comment, please let me know.</div><div><br></div><div>Thanks,</div><div><br></div><div>Hyun Jae</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 11:02 AM, Bradly Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello,<div><br></div><div>Just to follow up.</div><div><br></div><div>Your code seems to correct a long long time bug. That has had a work around [1] for at least one usage.</div><div><br></div><div>The truncation of the “size” variable to the MeasurementType, can easily result in a divide by zero when the number of bins is NumericTraints<MeasurementType>::max() + 1.</div><div><br></div><div>It may need to be noted in the release notes, that histogram calculations may change due to this correction, which can change the bounds of histograms.</div><div><br></div><div>Good job tracking down the problem.</div><div><br></div><div>Brad</div><div><br></div><div><br></div><div>[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/commit/4011c5d85e77387f59cadc0b12b79fdaa3251339" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/commit/4011c5d85e77387f59cadc0b12b79fdaa3251339</a></div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Jan 19, 2016, at 9:09 AM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>> wrote:</div><br><div>
<div style="word-wrap:break-word">Hello Hyun,<div><br></div><div>From you description, I don’t understand what was the cause of the crass nor how this fixed the problem. Why was it the wrong type?</div><div><br></div><div><br></div><div>Brad</div><div><br></div><div><br><div><blockquote type="cite"><div>On Jan 18, 2016, at 12:20 PM, Hyun Jae Kang <<a href="mailto:hyunjae.kang@kitware.com" target="_blank">hyunjae.kang@kitware.com</a>> wrote:</div><br><div><div dir="ltr">Hi Bradley,<div><br></div><div>Thank you for your comments on the code. The lines you mentioned in <span style="font-size:12.8px">itkHistogram.hxx generated the run-time crash on Mac OSX 10.6 with clang compiler (3.0).</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">When I found this error, I checked the data type of the local variable ( float </span><span style="font-size:12.8px">interval ) and I put "float" in the lines to avoid the run-time error.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">This is why I chose "float" as the data type of data-casting.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">If I did something wrong, please let me know. I will fix it.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Hyun Jae </span></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 18, 2016 at 12:00 PM,  <span dir="ltr"><<a href="mailto:insight-developers-request@itk.org" target="_blank">insight-developers-request@itk.org</a>></span> wrote:<br><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">Send Insight-developers mailing list submissions to<br>
        <a href="mailto:insight-developers@itk.org" target="_blank">insight-developers@itk.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:insight-developers-request@itk.org" target="_blank">insight-developers-request@itk.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:insight-developers-owner@itk.org" target="_blank">insight-developers-owner@itk.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Insight-developers digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: [ITK]  Itk release branch demons registration<br>
      (Bradley Lowekamp)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 17 Jan 2016 18:13:44 -0500<br>
From: Bradley Lowekamp <<a href="mailto:brad@lowekamp.net" target="_blank">brad@lowekamp.net</a>><br>
To: Bradley Lowekamp <<a href="mailto:brad@lowekamp.net" target="_blank">brad@lowekamp.net</a>><br>
Cc: ITK <<a href="mailto:insight-developers@itk.org" target="_blank">insight-developers@itk.org</a>><br>
Subject: Re: [ITK-dev] [ITK]  Itk release branch demons registration<br>
Message-ID: <<a href="mailto:63AE857C-91FE-4B80-B31B-921A6CDAD2C6@lowekamp.net" target="_blank">63AE857C-91FE-4B80-B31B-921A6CDAD2C6@lowekamp.net</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Just to follow up my git bisect narrowed the change down to this:<br>
commit 0fd462a3226e84bdce77b68830903b3888dab244<br>
Author: Hyun Jae Kang <<a href="mailto:hyunjae.kang@kitware.com" target="_blank">hyunjae.kang@kitware.com</a>><br>
Date:   Thu Dec 31 10:56:25 2015 -0500<br>
<br>
    BUG: Fixed the runtime crash of ITKStatisticsTestDriver tests on OSX 10.6<br>
<br>
    - Fixed the runtime crash of the following ITKStatisticsTestDriver's tests on<br>
      OSX 10.6 ( clang 3.0 )  by modifying the itkHistogram's Initialize function<br>
      to handle a data value out of range of a specific data type with<br>
      type-casting operator.<br>
<br>
      - itkSampleToHistogramFilterTest3 (ILLEGAL)<br>
      - itkSampleToHistogramFilterTest7 (ILLEGAL)<br>
<br>
    - These crash were reported at the following page:<br>
      <a href="https://open.cdash.org/viewTest.php?onlyfailed&buildid=4170483" rel="noreferrer" target="_blank">https://open.cdash.org/viewTest.php?onlyfailed&buildid=4170483</a><br>
<br>
    Change-Id: I2063912edee79422d88125ffd5f7513c31a9e98c<br>
<br>
diff --git a/Modules/Numerics/Statistics/include/itkHistogram.hxx b/Modules/Numerics/Statistics/include/itkHistogram.hxx<br>
index 380b8d0..d11d788 100644<br>
--- a/Modules/Numerics/Statistics/include/itkHistogram.hxx<br>
+++ b/Modules/Numerics/Statistics/include/itkHistogram.hxx<br>
@@ -248,8 +248,8 @@ Histogram< TMeasurement, TFrequencyContainer ><br>
     {<br>
     if ( size[i] > 0 )<br>
       {<br>
-      interval = static_cast<float>( upperBound[i] - lowerBound[i] )<br>
-        / static_cast< MeasurementType >( size[i] );<br>
+      interval = (static_cast<float>( upperBound[i] ) - static_cast<float>(lowerBound[i] ))<br>
+        / static_cast< float >( size[i] );<br>
<br>
<br>
Here is the failing example [1], which uses the HistogramMatching filter.<br>
<br>
I am not sure why float was choose at the type here. Are results being truncated now? When there was temporary double computation going on?<br>
<br>
 It needs more investigation, as it?s changing the results of some filters? not sure how significant yet.<br>
<br>
Brad<br>
<br>
<br>
<br>
<br>
[1] <a href="https://github.com/SimpleITK/SimpleITK/blob/master/Examples/DemonsRegistration1.py#L41" rel="noreferrer" target="_blank">https://github.com/SimpleITK/SimpleITK/blob/master/Examples/DemonsRegistration1.py#L41</a><br>
> On Jan 16, 2016, at 2:58 PM, Bradley Lowekamp <<a href="mailto:brad@lowekamp.net" target="_blank">brad@lowekamp.net</a>> wrote:<br>
><br>
> Thanks. I'll run a git bisect tonight to try to figure it out.<br>
><br>
>> On Jan 16, 2016, at 12:57 PM, Matt McCormick <<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> Nothing comes to mind.<br>
>><br>
>> Here is the log for v4.9rc03..release:<br>
>><br>
>> Bill Hoffman (3):<br>
>>     COMP: fix 64 bit build warnings with windows auto-export on.<br>
>>     COMP: work around for VS 2015 optimizer bug causing test failures.<br>
>>     COMP: work around for VS 2015 optimizer bug causing test failures.<br>
>><br>
>> Bradley Lowekamp (1):<br>
>>     BUG: Fix precision with accumulation and scaling in AdaptiveHistogram<br>
>><br>
>> Davis Vigneault (1):<br>
>>     COMP: Include itkMacro.h in itkTestingMacros.h<br>
>><br>
>> Hans Johnson (2):<br>
>>     COMP: BSD command lines do not have --version<br>
>>     COMP: Respect CMAKE_CXX_STANDARD during config<br>
>><br>
>> Hyun Jae Kang (12):<br>
>>     COMP: Fixed the compiler error of ITKCommon2TestDriver on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of vnl_test_complex on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of itkTimeProbeTest2<br>
>>     BUG: Fixed the runtime crash of VideoSourceTest on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of ITKReviewTestDriver on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of ITKFastMarchingTestDriver's<br>
>> tests on OSX 10.6<br>
>>     COMP: Fixed the data conversion warning messages of itkResourceProbe<br>
>>     BUG: Fixed the runtime crash of ITKStatisticsTestDriver tests on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of itkBinaryShapeOpeningImageFilterTest1<br>
>>     BUG: Fixed the runtime crash of test_pow_log on OSX 10.6<br>
>>     BUG: Fixed the runtime crash of vnl_test_numeric_traits<br>
>>     BUG: Exclude a test code of ITKLabelMapTestDriver on OSX 10.6<br>
>><br>
>> Isaiah Norton (1):<br>
>>     COMP: fix build with -std=c++11 when ITK/VXL initially configured without<br>
>><br>
>> Matthew McCormick (6):<br>
>>     BUG: Do not perform dynamic_cast in CompositeIOTransformIOHelper.<br>
>>     COMP: Do not set property on itkhdf5 with ITK_USE_SYSTEM_HDF5.<br>
>>     DOC: Update the location of the GNUPlot Software Guide scripts.<br>
>>     DOC: Update the Software Guide repo location in Examples/README.txt.<br>
>>     COMP: Add export specification for itk::ResourceProbe.<br>
>>     COMP: Require NO_MODULE with DCMTK find_package.<br>
>><br>
>> Michka Popoff (2):<br>
>>     ENH: Allow Python 3 wrapping for Glue and Review Modules with VTK 7<br>
>>     COMP: Re-enable review module for python 3 and older VTK's<br>
>><br>
>> Sean McBride (1):<br>
>>     DOC: Update some woefully out-of-date GDCM comments, and typos<br>
>><br>
>> Seun Odutola (1):<br>
>>     BUG: Improved itkAnalyzeImageIO to handle case insensitive extensions<br>
>><br>
>> HTH,<br>
>> Matt<br>
>><br>
>>> On Sat, Jan 16, 2016 at 12:18 PM, Bradley Lowekamp <<a href="mailto:brad@lowekamp.net" target="_blank">brad@lowekamp.net</a>> wrote:<br>
>>> I just updated SimpleITK to the release branch yesterday and there are some changes in the result of the demons registration. I'm not going to get a chance to look at it until Monday. The only change potentially related I know of is the rounding related numeric traits, but that does not seem likely to me.<br>
>>><br>
>>> Any ideas why the Demons Registration would have changed fro rc3?<br>
>>><br>
>>>> On Jan 16, 2016, at 12:13 PM, Bradley Lowekamp <<a href="mailto:brad@lowekamp.net" target="_blank">brad@lowekamp.net</a>> wrote:<br>
>>>><br>
>>>> Hello,<br>
>>>><br>
>>>> I updated SimpleITK<br>
>>>> _______________________________________________<br>
>>>> Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>>>><br>
>>>> Visit other Kitware open-source projects at<br>
>>>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>><br>
>>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>>> <a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/protraining.php</a><br>
>>>><br>
>>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>>><br>
>>>> Follow this link to subscribe/unsubscribe:<br>
>>>> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
>>> _______________________________________________<br>
>>> Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>> <a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/protraining.php</a><br>
>>><br>
>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
> <a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://public.kitware.com/pipermail/insight-developers/attachments/20160117/188815c1/attachment-0001.html" rel="noreferrer" target="_blank">http://public.kitware.com/pipermail/insight-developers/attachments/20160117/188815c1/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
Insight-developers mailing list<br>
<a href="mailto:Insight-developers@itk.org" target="_blank">Insight-developers@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Insight-developers Digest, Vol 141, Issue 10<br>
***************************************************<br>
</blockquote></div><br></div></div></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>