<div dir="ltr">Hi all, hi Luis,<div><br></div><div>while I tried to put together a minimal example, I noticed that I had forgot to call Update() before printing the size of the output image.</div><div>Now I understood that I have to do a manual resizing of the output image to get a more reasonable visual result representing the real image spacing. (Of course image spacing is just meta data, but I hadn't realized that before)<br>
Everything works fine for me now!</div><div>Thanks for your help!</div><div><br></div><div>Simon</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-09 21:32 GMT+01:00 Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Simon,<div><br></div><div>I'm looking at the code of the filter and there are <br>not many ways for it to generate unit spacing.</div>
<div><br></div><div>Output image spacing is computed in line 195:</div>
<div><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L195" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L195</a><br>

</div><div><br></div><div>Something else is going on with your code...</div><div><br></div><div>Could you reduce it to a minimal .cxx that displays</div><div>this behavior, and share it in the list ?</div><div><br></div>
<div>
In that way we will able to attempt to replicate the problem </div><div><br></div><div><br></div><div>    Thanks</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>       Luis</div><div><br>
</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Sat, Mar 8, 2014 at 8:42 PM, Simon Wimmer <span dir="ltr"><<a href="mailto:wimmersimon@gmail.com" target="_blank">wimmersimon@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hi all,<div><br></div><div>as a follow up, I just checked the spacings in the original image and the extracted slice.</div><div><br></div><div>reader->GetOutput()->GetSpacing()</div><div>gives</div><div>


<a href="tel:%5B0.747159" value="+49747159" target="_blank">[0.747159</a>, <a href="tel:0.747159" value="+49747159" target="_blank">0.747159</a>, 6].</div><div><br></div><div>But</div><div>filter->GetOutput()->GetSpacing()</div>
<div>gives</div><div>[1, 1],</div><div>which explains the "loss of spacing information" I observed.</div>

<div>I guess if the spacing was preserved the <span style="font-size:12.727272033691406px;font-family:arial,sans-serif">filter-></span><span style="font-size:12.727272033691406px;font-family:arial,sans-serif">SetDirectionCollapseToIndentit</span><span style="font-size:12.727272033691406px;font-family:arial,sans-serif">y() setting would give me the desired slice images.</span></div>


<div>Any tips on how I could track down the problem here?</div><div><br></div><div><br></div><div>Simon</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-08 22:10 GMT+01:00 Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span>:<div>

<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Simon,<div class="gmail_extra"><br><div class="gmail_quote"><div>On Sat, Mar 8, 2014 at 3:56 PM, Simon Wimmer <span dir="ltr"><<a href="mailto:wimmersimon@gmail.com" target="_blank">wimmersimon@gmail.com</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"><div dir="ltr"><div><br></div><div>My direction matrix is simply the identity.</div>



<div>So I would guess that in this case <span style="font-size:12.666666984558105px;font-family:arial,sans-serif">filter-></span><span style="font-size:12.666666984558105px;font-family:arial,sans-serif">SetDirectionCollapseToIndentit</span><span style="font-size:12.666666984558105px;font-family:arial,sans-serif">y() and </span><span style="font-size:12.666666984558105px;font-family:arial,sans-serif">filter-></span><span style="font-size:12.666666984558105px;font-family:arial,sans-serif">SetDirectionCollapseToSubmatrix</span><span style="font-size:12.666666984558105px;font-family:arial,sans-serif">() should do the same?</span></div>




<div><br></div></div></blockquote><div><br></div></div><div>It should...yes... I think.</div><div><br></div><div>mm, maybe we need to take a closer look at the way the Submatrix is being composed:</div><div><br></div><div>


<a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L223" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L223</a><br>



</div><div><br></div><div><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L188" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L188</a><br>



</div><div><div><br></div><div><br></div><div> <br></div><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">


<div dir="ltr">
<div></div><div>Taking out <span style="font-family:arial,sans-serif;font-size:12.727272033691406px"> </span><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">InPlaceOn() sounds reasonable.</span></div>



</div></blockquote><div><br></div></div><div>OK</div><div><div> </div><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">



<div dir="ltr">
<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">Regarding the spacing issue my intuition would have been that the extraction of course destroys the information for the projection direction,</span><br>



</div>
<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">but should preserve it for the other ones. Is that correct?</span></div></div></blockquote><div><br></div></div><div>Yes, that's correct.</div>



<div><br></div><div>So, if the initial 3D image had spacing values</div><div><br></div><div>        1.7,  2.9,   3.1</div><div><br></div><div>in X, Y, Z respectively,</div><div><br></div><div><br></div><div>and you collapse Z,</div>



<div>you should end up with a 2D image with spacing values</div><div><br></div><div>         1.7,   2.9</div><div><br></div><div>in X and Y respectively.</div><div><br></div><div><br></div><div>  HTH</div><span><font color="#888888"><div>


<br></div><div>
<br></div><div>      Luis</div><div> </div></font></span></div></div></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>