[Rtk-users] Input and output image buffer

Simon Rit simon.rit at creatis.insa-lyon.fr
Thu Dec 4 09:42:11 CET 2014


Hi,
Maybe we should explain that on the wiki, we'll prepare a page. In the
meantime, a quick answer. InPlaceImageFilter modifies the first input (#0).
Backprojection updates a volume from projection images, so the first input
is the same as the output, the volume. Forward projection updates
projection images from a volume so the first input is the same as the
output, the projections. I do not see how you could modify this, could you
give an example of why you would do that?
Yes, you can get the buffer pointer to the second input with
filt->GetInput(1)->GetBufferPointer().
For the second part, I don't know what is the problem but if you could play
with buffer pointers, I would try to avoid this if I were you because you
then lose the pipeline capabilities of ITK filters.
I hope this helps,
Simon

On Wed, Dec 3, 2014 at 5:33 PM, ghostcz <ghostcz at hotmail.com> wrote:

>   Hi Simon,
>
> Yes, it solved the problem.
> There are some more related questions. Filters like backprojectionFilter
> have more than one input. As it is an InPlaceFilter, it will overwrite the
> input. But which input will be updated? From the existing filters, it seems
> it is the input( 0 ). Is this defined somewhere? Can I change this? If I
> query the buffer of input(1), will I get the correct address?
> Another one: if I pass an ITK image pointer to a function instead of
> defining this image as an input, will I run into the same problem? Does it
> have an impact on speed and ram consumption?
> Thank you!
>
> Best regards,
> Louie
>
>  *From:* Simon Rit <simon.rit at creatis.insa-lyon.fr>
> *Sent:* Wednesday, December 03, 2014 9:31 AM
> *To:* louie L <ghostcz at hotmail.com>
> *Cc:* rtk-users at public.kitware.com
> *Subject:* Re: [Rtk-users] Input and output image buffer
>
>   Hi Louie,
> What you do is correct and what you obtain is expected.
> BackProjectionImageFilter inherits from InPlaceImageFilter.
> InPlaceImageFilter overwrites the input by default. If you don't want this
> behavior, you can simply call InPlaceOff
> <http://www.itk.org/Doxygen/html/classitk_1_1InPlaceImageFilter.html#a8d759f2bdeaf360a54524d87c5fc4d14>
> before updating. Then , the buffers will be indeed pointing to different
> memory spaces.
> Hope this helps,
> Simon
>
> On Tue, Dec 2, 2014 at 10:21 PM, louie L <ghostcz at hotmail.com> wrote:
>
>> Dear RTK users and developers,
>>
>> I am writing a backprojection filter whose superclass is
>> ImageToImageFilter. After allocating the output, I called
>> this->GetInput()->GetBufferPointer() and
>> this->GetOutput()->GetBufferPointer().
>> to get the address of the images in memory. However the two functions
>> above return the same value. Why? If this is not the correct way to get the
>> address of the input image, how can I get that address?
>> Thank you.
>>
>> Best regards,
>> Louie
>>
>>
>> _______________________________________________
>> Rtk-users mailing list
>> Rtk-users at public.kitware.com
>> http://public.kitware.com/mailman/listinfo/rtk-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20141204/62528688/attachment.htm>


More information about the Rtk-users mailing list