[Insight-users] Gradient time issues
N.E. Mackenzie Mackay
9nem at qlink.queensu.ca
Fri Oct 29 12:37:37 EDT 2004
Hey James,
I just did the changes you suggested. The registration seems to be
running but very differently. The results are much worse. ( If you
like I can send you an ouput of the derivative at each iteration using
the CentralDifferenceImageFunction and using the
GradientRecursiveGaussianImageFilter.
What I was hoping for is to get the same results pixel by pixel as the
GradientRecursiveGaussianImageFilter.
Right now I replaced the
m_GradientImage->GetPixel( mappedIndex );
to
m_FixedImageGradientCalculator->EvaluateAtIndex( mappedIndex )
(m_FixedImageGradientCalculator is a object of the
CentralDifferenceImageFunction)
Is there a way that I could manipulate that value to gave me the same
value as "m_GradientImage->GetPixel( mappedIndex );"?
I don't mind doing some lazy calculations at runtime. There is no way
it would be slower then pre-processing.
Just to give you an idea: My image is 640 X 480 X 5 = 1,536,000 pixels
. I only use about 50 pixels per iteration. So I would need about
1,536,000 / 50 = 30,720 iterations to have the same slow down as the
pre- processing. This is just an estimate.
Oh, and yes the time improvements as of now are great. Much much
faster, just not the same result :P
Thanks again,
Neilson
On Oct 28, 2004, at 4:04 PM, Miller, James V (Research) wrote:
> Neilson,
>
> If you just want to try this out, comment out the code in
> itkImageToImageMetric that actually calculates the gradient.
>
> Then in the metric that you using, look for the code that uses the
> gradient
> value. For instance, in the MeanSquaresImageToImageMetric, there is a
> line
> of code that says:
>
> m_GradientImage->GetPixel( mappedIndex );
>
> Replace this line with a line of code that uses a
> CentralDifferenceImageFunction. The DemonsRegistrationFunction uses
> this
> function to compute gradients on a point by point basis. You can look
> at
> the DemonsRegistrationFunction to see how to use the
> CentralDifferenceImageFunction.
>
> Let us know the speed test results. If it looks promising, we might
> want to
> add a "lazy" gradient calculation to the metrics.
>
> Jim
>
>
>
> -----Original Message-----
> From: N.E. Mackenzie Mackay [mailto:9nem at qlink.queensu.ca]
> Sent: Thursday, October 28, 2004 12:30 PM
> To: 'insight-users at itk.org'
> Subject: [Insight-users] Gradient time issues
>
>
> Hi,
>
> I am having some time issues with my current registration method.
> Not
> in the registration it self but with the pre processing.
>
> The Gradient Recursive Gaussian Image filter seems to be taking
> quite
> a long time to pre-calculate a gradient field. As of now my
> registration method only needs a few pixels from my image at a time.
> (About 5% of the total number of pixels) I want to see if calculating
> the gradient on the fly would produce faster results. The only problem
> is I am not sure of how to do this.
>
> Ideally I would like a method that would accept a index or pixel
> location in the image and return a gradient value.
>
> e.g. gradientValue = gradientCalculator->GetGradient(
> pixelLocation
> );
>
> This is very similar to how I use the out out of the
> GradientRecursiveGaussianImageFilter. The only difference is I don't
> want the preprocessing because it take much to long.
>
> Thank you,
> Neilson
>
> _______________________________________________
> 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