[ITK] Not making updates helps performance
Francois Budin
francois.budin at kitware.com
Fri May 12 15:23:30 EDT 2017
Hello Nirvedh,
It is difficult to know exactly why your predecessor used the "Update"
calls without having the entire code (and being able to read his mind :p).
My guess, because he is disconnecting the pipelines, is that he wanted to
either process the images manually after (maybe using an iterator) or that
this is done in a loop that does more things. Or maybe he wanted to make
sure that everything executed well up to that point.
The reason why not forcing the update calls can make the processing faster
is because your pipeline may not need to process all of the data.
Let's take a simple example:
If I create a pipeline that 1) reads an image, 2) performs some filtering
filter over the image, 3) extract one slice of the filtered result, 4) save
the extracted slice, the pipeline really need to perform the filtering only
on the slice that is being extracted (and maybe a neighboring region).
Calling Update after 2) (depending how you set up the processing region)
would filter the entire image. So in this example, it is better to not call
Update().
As I said before, there are situations were calling Update() is necessary,
but otherwise it may very well slow down your processing.
Hopes this helps,
Francois
On Fri, May 12, 2017 at 2:01 PM, Nirvedh Meshram <nmeshram at wisc.edu> wrote:
> Hi all,
>
>
> I am looking at a ITK code written by a predecessor in my lab group. This
> code is used for image registration and the snippet of this looks as shown
> below.
>
>
> m_FixedImage->Update();
> m_MovingImage->Update();
> m_FixedImage->DisconnectPipeline();
> m_MovingImage->DisconnectPipeline();
>
> // do image registration
>
> However, if I comment the first two lines. I still get the exact same
> results but I end up saving 30 seconds.
>
> If I comment all lines I get an error saying I tried to access some region
> which was of size [0,0]
>
> I was hoping someone could give me insight into what exactly is going on
> here.
> I understand updates matter to make sure your pipeline executes. But both
> these images are inputs to downstream filters then why had my predecessor
> chosen to do these updates separately here and why do I still get correct
> results without the updates.
> Why is it important to disconnect these pipelines here before continuing
> the registration?
>
> Thank you,
> Nirvedh
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170512/1ce29d08/attachment.html>
More information about the Community
mailing list