[ITK] [ITK-users] FW: ExtractImageFilter.Update() inside loop works until 24th iteration

D'Isidoro Fabio fisidoro at ethz.ch
Mon Jan 2 12:23:35 EST 2017


No, I did not know this option. I just coded this way:

Filter1.Update()
Output1 = Filter1.GetOutput()
Filter2.SetInput(Output1)
Filter2.Update()
Output2 = Filter2.GetOutput()

Instead of

Filter2.SetInput( Filter1.GetOutput() )
Filter2.Update()

Fabio

From: Francois Budin [mailto:francois.budin at kitware.com]
Sent: Montag, 2. Januar 2017 17:59
To: D'Isidoro Fabio <fisidoro at ethz.ch>
Cc: insight-users at itk.org
Subject: Re: [ITK-users] FW: ExtractImageFilter.Update() inside loop works until 24th iteration

Hello Fabio,
When you say "avoid connecting its components with SetInput(GetOutput())", do you mean that you used the method "DisconnectPipeline()"?
Francois

On Sun, Jan 1, 2017 at 5:40 PM, D'Isidoro Fabio <fisidoro at ethz.ch<mailto:fisidoro at ethz.ch>> wrote:
Update: generalizing the problem, I figured out that any time the final filter is updated inside a loop, after a certain number of iterations the Update() does not work anymore and filter.GetOutput() returns always the same image as the last working iteration. I guess it’s a memory issue. This issue happens no matter what the final filter of the pipeline is (I tried with ResampleImageFilter, Writer, ExtractImageFilter), and even when using the filter.InPlaceOn() when possible. This issue happens even if I split the pipeline and avoid connecting its components with SetInput( GetOutput() ).

Are filters of a pipeline not supposed to be used in a loop (where, in my case, the given transform changes at any loop)?

I guess the issue formulated this way is a common issue.

Thank you for your help.

Fabio.

From: D'Isidoro Fabio
Sent: Sonntag, 1. Januar 2017 19:48
To: insight-users at itk.org<mailto:insight-users at itk.org>
Subject: ExtractImageFilter.Update() inside loop works until 24th iteration

Hallo,

I work with ITK Python. I need to explore the domain of an image metric (like in MeanSquaresImageMetric1.cxx) for 2D/3D registration (using RayCastInterpolator). Since the metric works only between 2D/2D or 3D/3D images, I need to convert the generated DRR (SizeX, SizeY, 1) into a 2D image (SizeX, SizeY) with ExtractImageFilter, before metric evaluation. I then pass to the metric the converted 2D DRR as moving image and the 2D fixed image for similarity metric evaluation (with IdentityTransform, and NearestNeighbourInterpolator set for the metric). Metric evaluation is done in a loop within a range of the domain for the transform parameters. For each iteration of the loop (that is, different transforms used for generation of the DRR) the ExtractImageFilter is updated with Update().

The code runs but mysteriously stops working properly at the 24th iteration of the loop for the domain range. After the 24th iteration I figured no new DRR is generated and the metric value keeps constant at the value of the 24th iteration. I tried with input 3D volumes of different sizes and with different ranges for the transform parameters, but the code stops generating new DRRs always after the 24th iteration.

The important parts of the code are:

interpolatorRayCast = itk.RayCastInterpolateImageFunction[MovingImageType, ScalarType].New()
filterRayCast = itk.ResampleImageFilter[MovingImageType, MovingImageType].New()
filterRedim = itk.ExtractImageFilter[MovingImageType, FixedImageType].New()
…
filterRayCast.SetInput( movingImageReader.GetOutput() )
filterRayCast.SetInterpolator( interpolatorRayCast )
…
filterRedim.SetInput(filterRayCast.GetOutput())
…
for dx in translation_range_x:
    for dy in translation_range_y:
        for dz in translation_range_z:
…
transformDRR.SetParameters( transform_parameters )

                               filterRedim.Update()

             value = metric.GetValue()


I believe the pipeline might not be set properly, but I don’t know where.

In attachment you find the code and the required inputs.

Any help would be highly appreciated, thank you!

Fabio.

_____________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170102/579e4ff0/attachment-0001.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list