<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi there,
<div><br>
</div>
<div>I am upgrading from ITK 3.20 to 4.3.2 and noticed that in 4.3.2 a histogram with 64 bins (0-63), spanned by the image values 0-255 mapped the value 255 to bin 64, which was subsequently missed. This worked in 3.20, resolving to bin 63.</div>
<div><br>
</div>
<div>Comparing the code of itkHistogram.txx in 3.20, I see in method:</div>
<div>::GetIndex(const MeasurementVectorType & measurement,IndexType & index ) const</div>
<div><br>
</div>
<div>code that does:</div>
<div><br>
</div>
<div>
<div> if (tempMeasurement >= m_Max[dim][end])</div>
<div> {</div>
<div> // one of measurement is below the minimum</div>
<div> // its ok if we extend the bins to infinity.. not ok if we don't</div>
<div> <b> //Need to include the last endpoint in the last bin.</b></div>
<div> if(!m_ClipBinsAtEnds || <b>tempMeasurement == m_Max[dim][end]</b>)</div>
<div> {</div>
<div> index[dim] = (long) m_Size[dim]-1;</div>
<div> continue;</div>
<div> }</div>
</div>
<div><br>
</div>
<div>whereas in version 4.3.2 I see:</div>
<div><br>
</div>
<div>
<pre style="margin-top: 0px; margin-bottom: 0px; ">
<pre style="margin-top: 0px; margin-bottom: 0px; "><!--StartFragment--><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#c0c0c0;"> </span>tempMeasurement<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span>m_Max[dim][end]<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">one</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">measurement</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">is</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">above</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">maximum</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">its</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">ok</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">if</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">extend</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">bins</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">infinity..</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">not</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">ok</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">if</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">don't</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#c0c0c0;"> </span>!m_ClipBinsAtEnds<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span>index[dim]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>(IndexValueType)m_Size[dim]<span style=" color:#c0c0c0;"> </span>-<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">continue</span>;<!--EndFragment--></pre><div><br></div><div><br></div><div><font face="Arial"><span style="font-size: 12px;">So, it looks to me like version 4.3.2 is missing the condition where if a value is exactly equal to the upper bound then it is included. Then I went to JIRA and found:</span></font></div><div><a href="https://issues.itk.org/jira/browse/ITK-2266" style="font-size: 12px;"><font face="Arial">https://issues.itk.org/jira/browse/ITK-2266</font></a></div><div><font face="Arial"><span style="font-size: 12px;"><br></span></font></div><div><font face="Arial"><span style="font-size: 12px;">which suggests that this was a bug at one point, but was fixed in 3.20.</span></font></div><div><font face="Arial"><span style="font-size: 12px;"><br></span></font></div><div><font face="Arial"><span style="font-size: 12px;">So, did I miss a link somewhere? Can someone advise me please?</span></font></div><div><font face="Arial"><span style="font-size: 12px;">Has the spec changed such that the upper bound is no longer meant to be inclusive in version 4+?</span></font></div><div><font face="Arial"><span style="font-size: 12px;"><br></span></font></div><div><font face="Arial"><span style="font-size: 12px;">Thanks</span></font></div><div><font face="Arial"><span style="font-size: 12px;"><br></span></font></div><div><font face="Arial"><span style="font-size: 12px;">Matt</span></font></div><div><br></div></pre>
</div>
<div>
<div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">------------------------------------------------------</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Matt Clarkson Ph.D.</span></div>
<div style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">CMIC Software Manager<br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Senior Research Associate</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><a href="mailto:m.clarkson@ucl.ac.uk">m.clarkson@ucl.ac.uk</a></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Skype: drmattclarkson</span></div>
<div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Centre For Medical Image Computing</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><a href="http://cmic.cs.ucl.ac.uk/">http://cmic.cs.ucl.ac.uk/staff/matt_clarkson/</a></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Tel: 020 7679 0257</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Fax: 020 7679 0255</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "> </span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Room: 2.21 Malet Place Engineering Building</span></div>
<div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Dementia Research Centre</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><a href="http://dementia.ion.ucl.ac.uk/">http://dementia.ion.ucl.ac.uk/</a></span><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-size: 13px; "><br>
</span></font><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Fax: 020 7676 2066</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br>
</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">------------------------------------------------------</span></div>
<div style="font-family: Helvetica; font-size: medium; "><br>
</div>
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</span><br class="Apple-interchange-newline">
</div>
<br>
</div>
</body>
</html>