[Insight-users] forcing pipeline to update
Karthik Krishnan
Karthik.Krishnan at kitware.com
Wed Jun 29 09:54:12 EDT 2005
Jakub Bican wrote:
>
> Hi Karthik,
>
> imagine, that you need 10 copies of the image rotated by increasing
> angle and fourier transformed.
>
> Create resample filter, put in it appropriate rigid transform and
> interpolator, set the filter's input to your image (reader) and set up
> desired output parameters (spacing, origin, size). Create a fft filter
> and connect it to the output of the resample filter.
>
> Now start a loop - in each step, set the new angle to the transform,
> update the pipeline and grab its output into your array.
>
> In this case - setting a new angle to the transform does not force
> resample filter to recompute its output - because its parameters were
> not changed anyway and its output is still "valid". But the
> transformation inside the filter changed and re-computing leads to
> differently rotated image.
>
> May-be, resample filter should check whether the transform was
> modified, but i don't know if it is even possible in the current ITK.
>
The resample filter takes the transform as an input using SetConstObject
macro. If any ivars of the transform are changed the modified time of
the resample filter will change. You can try
resampleFilter->Print(std::cout) to see that the modified time indeed
changes. This should cause the pipeline to update on its own. You do not
need to change the resample filter parameters to do that. Can you post a
minimal compiling example to show that the pipeline does not update
correctly ?
Thanks
karthik
> Regards,
> Jakub
>
>
> Karthik Krishnan napsal(a):
>
>> I cannot comprehend your problem. Why do you want the pipeline to
>> update if none of the parameters have changed ?
>>
>>
>> Jakub Bican wrote:
>>
>>>
>>> Hello,
>>>
>>> i have a short pipeline - two filters: ResampleImageFilter followed
>>> by FFTWRealToComplexConjugateImageFilter.
>>>
>>> I am using it to compute different transforms of the same data:
>>>
>>> 1) connect the pipeline, set input to the resample filter
>>> 2) loop:
>>> A) change the transform in resample filter according to the loop
>>> variable i
>>> B) set up the output parameters of resmaple filter
>>> (origin,spacing,size)
>>> C) UpdateLargestPossibleRegion() of resample filter
>>> D) UpdateLargestPossibleRegion() of fourier filter
>>> E) store the transformed data and disconnect it:
>>> transformedData[i] = fourierFilter->GetOutput();
>>> transformedData[i]->DisconnectPipeline();
>>> 3) end loop
>>>
>>> * step C is neccessary due to some bug in fourier filter that i
>>> reported some weeks ago (otherwise fourier filter fails)
>>> * step B is not usually neccessary - but sometimes i use different
>>> parameters for each transformed version
>>>
>>> The problem is, that if the parameters of the resample filter do not
>>> change in step B, then step C does not process anything and
>>> immediately terminates without having updated resample filter's output.
>>>
>>> I suppose this behavior is expectable, because resample filter has
>>> no reason to update its output ("input and any parameters else than
>>> something inside of the transform did not change"), but i need to
>>> force it to compute.
>>>
>> Do you mean that the transform parameters have changed and your
>> pipeline is not updating ???? Why do you need to force it to
>> re-compute ?
>>
>>> The only solution i thought of is resetting and reconnecting the
>>> pipeline, but i don't like it very much. Please, if anyone knows any
>>> clear solution how to force the filter or pipeline to update even if
>>> it is up-to-date, let me know.
>>>
>>> Thank you very much in advance.
>>>
>>> Cheers,
>>> Jakub
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list