<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New",serif;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Courier;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello Manuel,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you for sharing your use case!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">With the recent change to the ImageFileReader below when an ImageIO reports negative space, it is applied to the Direction cosine matrix so that the physical location of the pixel remains the same. I believe reading and processing images
 in ITK should work properly for your applications after the negative spacing is applied to the Direction cosine matrix.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">However, logic may need to be added to writing images with file formats that don’t support the direction cosine matrix but do support negative spacing.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Have you encountered any specific problems with these changes?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Brad<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Manuel Grizonnet <manuel.grizonnet@cnes.fr><br>
<b>Date: </b>Thursday, July 27, 2017 at 9:03 AM<br>
<b>To: </b>"insight-developers@itk.org" <insight-developers@itk.org><br>
<b>Cc: </b>"otb-developers@googlegroups.com" <otb-developers@googlegroups.com><br>
<b>Subject: </b>Re: [ITK-dev] [ITK] Probelms with recent "Image spacing must be positive" change...<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<p style="margin-left:.5in">Hi all,<o:p></o:p></p>
<p style="margin-left:.5in">I'm part of the remote sensing library orfeo toolbox  team which used (a lot) ITK internally.  Following this discussion, I would like to add that in case of OTB, the strict sign checking of image spacing will have probably major
 impact for us as we're used to deal with images with negative spacing. <o:p></o:p></p>
<p style="margin-left:.5in">An example of remote sensing images with negative spacing is the well known Geotiff format (TIFF file with embedded georeferencing information). You can find in the geotiff specification [1]:<o:p></o:p></p>
<p style="margin-left:.5in"><i>"simple reversals of orientation between raster and model space (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must
 honor this sign-reversal convention."</i><o:p></o:p></p>
<p style="margin-left:.5in">So we do have to handle images   with negative spacing in OTB...<o:p></o:p></p>
<p style="margin-left:.5in">We also understand the point in ITK as we've also already faced issue with filters that assume positive spacing. See for instance this issue and discussion with Matt on JIRA:<o:p></o:p></p>
<p style="margin-left:.5in"><a href="https://issues.itk.org/jira/browse/ITK-3314">https://issues.itk.org/jira/browse/ITK-3314</a><o:p></o:p></p>
<p style="margin-left:.5in">I don't have yet a clear idea on how to handle this properly but wanted to join the discussion. I've added otb-dev mailing list developer to the discussion as there are probably other otb developers interested by the discussion.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Regards,<o:p></o:p></p>
<p style="margin-left:.5in">Manuel<o:p></o:p></p>
<p style="margin-left:.5in"><a href="http://geotiff.maptools.org/spec/geotiff2.6.html">[1] http://geotiff.maptools.org/spec/geotiff2.6.html</a><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">Le 21/07/2017 à 19:31, Lowekamp, Bradley (NIH/NLM/LHC) [C] a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre style="margin-left:.5in">Sean,<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">The other patch related to this change is the following:<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in"><a href="https://github.com/InsightSoftwareConsortium/ITK/commit/d447f0452bb5ea92a555e630d05b57da535bd3a9">https://github.com/InsightSoftwareConsortium/ITK/commit/d447f0452bb5ea92a555e630d05b57da535bd3a9</a><o:p></o:p></pre>
<pre style="margin-left:.5in">ENH: Explicitly warn and deprecate negative pixel spacing.<o:p></o:p></pre>
<pre style="margin-left:.5in">The DICOM standard explicitly disallows negative pixel spacing:<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_10.7.html#sect_10.7.1.3">http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_10.7.html#sect_10.7.1.3</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Additionally, it is fundamentally unnatural to have negative space or<o:p></o:p></pre>
<pre style="margin-left:.5in">"size" of an object. The negative is a directional information which<o:p></o:p></pre>
<pre style="margin-left:.5in">should be contained in the direction cosine matrix not the spacing<o:p></o:p></pre>
<pre style="margin-left:.5in">attribute.<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Change-Id: I1519faee14f48d2eecc08e100562f820eb6aa6ef<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Are you proposing a flag in the  ImageFileReader class? What bout the Series reader? Will it be placed in the MetaData dictionary?<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre style="margin-left:.5in">What do you think about adding an API so that it can be known if/which axes were flipped?<o:p></o:p></pre>
</blockquote>
<pre style="margin-left:.5in">The wording is going to tricky. Some file formats native coordinates are LPS ( ITK ) while others are RAS, so there may be some “flipping” already done during reading in ImageIO classes.<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">As the ImageFileReader is doing the conversion and not the ImageIO, would it suffices to just query ImageIO::GetSpacing to see if it’s changed?<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Brad<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">On 7/21/17, 12:35 PM, "Sean McBride" <a href="mailto:sean@rogue-research.com"><sean@rogue-research.com></a> wrote:<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">    On Fri, 2 Jun 2017 16:18:37 -0400, Sean McBride said:<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    >7501479a970694b0dd4a8c4bbf7cbcc033fe059c is the first bad commit<o:p></o:p></pre>
<pre style="margin-left:.5in">    >commit 7501479a970694b0dd4a8c4bbf7cbcc033fe059c<o:p></o:p></pre>
<pre style="margin-left:.5in">    >Author: Francois Budin <a href="mailto:francois.budin@gmail.com"><francois.budin@gmail.com></a><o:p></o:p></pre>
<pre style="margin-left:.5in">    >Date:   Mon Oct 31 17:04:05 2016 -0400<o:p></o:p></pre>
<pre style="margin-left:.5in">    ><o:p></o:p></pre>
<pre style="margin-left:.5in">    >    ENH: Image spacing must be positive<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    <o:p></o:p></pre>
<pre style="margin-left:.5in">    >    Image spacing must have values greater than 0. Negative<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    values could create issues with filters that assume that they<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    are positive.<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    When an image is loaded, if its spacing is negative, its absolute<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    value is kept, and the image direction along each axis with a<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    negative spacing is flipped.<o:p></o:p></pre>
<pre style="margin-left:.5in">    >    <o:p></o:p></pre>
<pre style="margin-left:.5in">    >    Change-Id: Id81d61b7fd3f60df2b38e30e540664dba6264996<o:p></o:p></pre>
<pre style="margin-left:.5in">    ><o:p></o:p></pre>
<pre style="margin-left:.5in">    >Which is here:<o:p></o:p></pre>
<pre style="margin-left:.5in">    ><a href="http://review.source.kitware.com/#/c/21685/"><http://review.source.kitware.com/#/c/21685/></a><o:p></o:p></pre>
<pre style="margin-left:.5in">    ><o:p></o:p></pre>
<pre style="margin-left:.5in">    >Looks like this shipped in 4.11 (we are using 4.10.1).<o:p></o:p></pre>
<pre style="margin-left:.5in">    ><o:p></o:p></pre>
<pre style="margin-left:.5in">    >Our test case is an Analyze 7.5 file with negative spacing.  I'll dig<o:p></o:p></pre>
<pre style="margin-left:.5in">    >into it next week...<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    François, Matt,<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    So this change is causing us backwards-compatibility problems.<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    What do you think about adding an API so that it can be known if/which axes were flipped?  As it is now, the flipping newly performed by ITK cannot be detected.  If such a change is acceptable, I can make a patch...<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    (Our app used to warn users that files with negative spacing are problematic, but now we have no means to generate this warning, unless I'm missing something.)<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Thanks,<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Sean<o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    _______________________________________________<o:p></o:p></pre>
<pre style="margin-left:.5in">    Powered by <a href="http://www.kitware.com">www.kitware.com</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Visit other Kitware open-source projects at<o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Kitware offers ITK Training Courses, for more information visit:<o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="http://kitware.com/products/protraining.php">http://kitware.com/products/protraining.php</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Please keep messages on-topic and check the ITK FAQ at:<o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in">    Follow this link to subscribe/unsubscribe:<o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="http://public.kitware.com/mailman/listinfo/insight-developers">http://public.kitware.com/mailman/listinfo/insight-developers</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    _______________________________________________<o:p></o:p></pre>
<pre style="margin-left:.5in">    Community mailing list<o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="mailto:Community@itk.org">Community@itk.org</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <a href="http://public.kitware.com/mailman/listinfo/community">http://public.kitware.com/mailman/listinfo/community</a><o:p></o:p></pre>
<pre style="margin-left:.5in">    <o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">_______________________________________________<o:p></o:p></pre>
<pre style="margin-left:.5in">Powered by <a href="http://www.kitware.com">www.kitware.com</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Visit other Kitware open-source projects at<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Kitware offers ITK Training Courses, for more information visit:<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="http://kitware.com/products/protraining.php">http://kitware.com/products/protraining.php</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Please keep messages on-topic and check the ITK FAQ at:<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
<pre style="margin-left:.5in">Follow this link to subscribe/unsubscribe:<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="http://public.kitware.com/mailman/listinfo/insight-developers">http://public.kitware.com/mailman/listinfo/insight-developers</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<o:p></o:p></p>
<pre style="margin-left:.5in">-- <o:p></o:p></pre>
<pre style="margin-left:.5in">Manuel GRIZONNET<o:p></o:p></pre>
<pre style="margin-left:.5in"><o:p> </o:p></pre>
</div>
</body>
</html>