comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Convolution
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Convolution [message #26609] Tue, 11 September 2001 05:22 Go to previous message
Kay Bente is currently offline  Kay Bente
Messages: 9
Registered: September 2001
Junior Member
Hi

I have to convolute a 256x256x128 Floating Point array with a 3D Gaussian
Kernel of ~ 30x30x30, this lasts round about 45Minutes. So my question is,
if there is any way how i can speed this up. I tried to separate this in
each dimension with a 1D Kernel, but I don�t know if I have done this
correct (cause the procedure hangs up after a few loops)

I know that the Convolution of two functions is a Multiplication in Fourier
Space, but how can I do this with discrete arrays, do I have to enlarge my
kernel to the size of the array i want to smooth? If so, the creation of the
kernel with the dimensions of my array nearly lasts as long as the normal
convolution :-(

So i would be very happy about any hints!!

This is how I tried it
FUNCTION Gauss3D, mat, n, s
;n = Size Of Array
;s = Sigma

;Gauss Kernel is completely circularly symmetric operator
;=> Convol in each dimension with a 1D Kernel

;Create Kernel
a = DindGen(n)-(n/2)
print,a
kernel = Exp(-(Temporary(a))^2/(2.*s^2))/(Sqrt(2.*!PI)*s)

tstart=SysTime(1)
s=Size(mat,/Dimensions)

mat2=FltArr(s(0),s(1),s(2))


;Convol in X,Y
FOR i=0, s(2) DO BEGIN
buffer=mat(*,*,i)
buffer1=Convol(buffer,kernel,Total(kernel))
buffer1=Convol(buffer1,Rotate(kernel,1),Total(kernel))
mat2(*,*,i)=Temporary(buffer1)
ENDFOR

;Convol in Z
FOR i=0, s(1) DO BEGIN
buffer=mat2(*,i,*)
buffer1=Convol(buffer,kernel,Total(kernel))
mat2(*,i,*)=Temporary(buffer)
ENDFOR
Return, mat2
END


---
Posted via news://freenews.netfront.net
Complaints to news@netfront.net
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to export programmatically a volume with IVOLUME to images
Next Topic: Re: Least square fitting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 05:18:32 PDT 2025

Total time taken to generate the page: 0.55977 seconds