[ITK Community] Fwd: Problems with slice extraction from a 3D image for directions different from z
Luis Ibanez
luis.ibanez at kitware.com
Mon Mar 10 17:09:43 EDT 2014
Simon,
Excellent !
Thanks for letting us know.
Luis
On Mon, Mar 10, 2014 at 7:11 AM, Simon Wimmer <wimmersimon at gmail.com> wrote:
> Hi all, hi Luis,
>
> 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.
> 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)
> Everything works fine for me now!
> Thanks for your help!
>
> Simon
>
>
> 2014-03-09 21:32 GMT+01:00 Luis Ibanez <luis.ibanez at kitware.com>:
>
> Simon,
>>
>> I'm looking at the code of the filter and there are
>> not many ways for it to generate unit spacing.
>>
>> Output image spacing is computed in line 195:
>>
>> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L195
>>
>> Something else is going on with your code...
>>
>> Could you reduce it to a minimal .cxx that displays
>> this behavior, and share it in the list ?
>>
>> In that way we will able to attempt to replicate the problem
>>
>>
>> Thanks
>>
>>
>> Luis
>>
>>
>>
>> On Sat, Mar 8, 2014 at 8:42 PM, Simon Wimmer <wimmersimon at gmail.com>wrote:
>>
>>> Hi all,
>>>
>>> as a follow up, I just checked the spacings in the original image and
>>> the extracted slice.
>>>
>>> reader->GetOutput()->GetSpacing()
>>> gives
>>> [0.747159, 0.747159, 6].
>>>
>>> But
>>> filter->GetOutput()->GetSpacing()
>>> gives
>>> [1, 1],
>>> which explains the "loss of spacing information" I observed.
>>> I guess if the spacing was preserved the filter->
>>> SetDirectionCollapseToIndentity() setting would give me the desired
>>> slice images.
>>> Any tips on how I could track down the problem here?
>>>
>>>
>>> Simon
>>>
>>>
>>> 2014-03-08 22:10 GMT+01:00 Luis Ibanez <luis.ibanez at kitware.com>:
>>>
>>> Hi Simon,
>>>>
>>>> On Sat, Mar 8, 2014 at 3:56 PM, Simon Wimmer <wimmersimon at gmail.com>wrote:
>>>>
>>>>>
>>>>> My direction matrix is simply the identity.
>>>>> So I would guess that in this case filter->
>>>>> SetDirectionCollapseToIndentity() and filter->
>>>>> SetDirectionCollapseToSubmatrix() should do the same?
>>>>>
>>>>>
>>>> It should...yes... I think.
>>>>
>>>> mm, maybe we need to take a closer look at the way the Submatrix is
>>>> being composed:
>>>>
>>>>
>>>> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L223
>>>>
>>>>
>>>> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkExtractImageFilter.hxx#L188
>>>>
>>>>
>>>>
>>>>
>>>>> Taking out InPlaceOn() sounds reasonable.
>>>>>
>>>>
>>>> OK
>>>>
>>>>
>>>>> Regarding the spacing issue my intuition would have been that the
>>>>> extraction of course destroys the information for the projection direction,
>>>>> but should preserve it for the other ones. Is that correct?
>>>>>
>>>>
>>>> Yes, that's correct.
>>>>
>>>> So, if the initial 3D image had spacing values
>>>>
>>>> 1.7, 2.9, 3.1
>>>>
>>>> in X, Y, Z respectively,
>>>>
>>>>
>>>> and you collapse Z,
>>>> you should end up with a 2D image with spacing values
>>>>
>>>> 1.7, 2.9
>>>>
>>>> in X and Y respectively.
>>>>
>>>>
>>>> HTH
>>>>
>>>>
>>>> Luis
>>>>
>>>>
>>>
>>>
>>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140310/4044993f/attachment-0002.html>
More information about the Community
mailing list