<div dir="ltr">DICOM data is often signed after the slope/intercept in applied. Try setting the type to short rather than unsigned short.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 9:48 AM, Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Do you have the code to share so that it can be easily reproduced?<br>
<br>
<br>
Thanks,<br>
Brad<br>
<div class="HOEnZb"><div class="h5"><br>
On Aug 12, 2013, at 9:33 AM, Constantine Zakkaroff &lt;<a href="mailto:mnkz@leeds.ac.uk">mnkz@leeds.ac.uk</a>&gt; wrote:<br>
<br>
&gt; Hello ALL,<br>
&gt;<br>
&gt; I&#39;m wondering if anyone can explain what&#39;s going on with the changing image intensities in a read-write-read round-trip. I think it&#39;s a bug, but the <a href="http://issues.itk.org" target="_blank">issues.itk.org</a> is unresponsive at the moment. Another bug? ;)<br>

&gt;<br>
&gt; Anyhow, the strange thing is that the results for the round trip read-write-read test are very different for ITK 3.20 and ITK 4.4.1.<br>
&gt;<br>
&gt; I use to StatisticsImageFilter to examine the intensity values. Here&#39;s what happens, when I simply read a DICOM image, print stats, save the image and read it again, followed by printing the stats:<br>
&gt;<br>
&gt; ITK Version: 3.20<br>
&gt; Stats for original file:<br>
&gt; Min: 0, Max: 2474, Mean: 169.236, Sigma: 256.719, Variance: 65904.7, Sum: 1.40371e+007<br>
&gt; Stats for saved file:<br>
&gt; Min: 0, Max: 2471, Mean: 167.132, Sigma: 256.125, Variance: 65600.1, Sum: 1.38626e+007<br>
&gt;<br>
&gt; ITK Version: 4.4<br>
&gt; Stats for original file:<br>
&gt; Min: 0, Max: 2474, Mean: 169.236, Sigma: 256.719, Variance: 65904.7, Sum: 1.40371e+007<br>
&gt; Stats for saved file:<br>
&gt; Min: 0, Max: 7446, Mean: 509.114, Sigma: 772.59, Variance: 596895, Sum: 4.22279e+007<br>
&gt;<br>
&gt; In both cases the code is identical. Just compiled against different versions of ITK. The images are read and written as itk::Image&lt;unsigned short, 3&gt;, with no processing, no changes to any aspect of the images.<br>

&gt;<br>
&gt; So, ITK 3.20 introduces a small change, which I&#39;m pretty sure shouldn&#39;t be there. But in ITK 4.4.1 the scale of intensities changes three-fold.<br>
&gt;<br>
&gt; I&#39;d not be surprised by a change of this magnitude if I was photocopying those images, but not when using digital software and hardware. :^) Is there something I&#39;m not understanding here?<br>
&gt;<br>
&gt; None of this happens with read(DICOM)-write(MHD)-read(MHD), where the original and round-trip values are identical:<br>
&gt; Stats for saved file: file0.mhd<br>
&gt; Min: 0, Max: 2474, Mean: 169.236, Sigma: 256.719, Variance: 65904.7, Sum: 1.40371e+007<br>
&gt;<br>
&gt; Many thanks,<br>
&gt; Constantine<br>
&gt;<br>
&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
_____________________________________<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://www.kitware.com/products/protraining.php" target="_blank">http://www.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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>