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

Home » Public Forums » archive » Convol with Kernel Dependency Of the Radius to the Middle
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Convol with Kernel Dependency Of the Radius to the Middle [message #27765 is a reply to message #27457] Wed, 31 October 2001 07:09 Go to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
Hi Kay,

I was wondering about a radial-proportioned linear combination of two
gaussian smoothings, one for the edge and one for the middle - however the
intermediate values are not a good approximation :(
I'm afraid I think you will have to code it from scratch, probably with 6
for loops(!).Convolutions are easy, just for loops. - I think I'd go
straight to coding it as a callable C routine, as then you wont have to
worry about the many loops, I would also not bother computing a kernel as it
will change too often, instead create a lookup table for your gaussian's
exponents.
e.g. : gauss_exp(sig = s, x = x) = GAUSS_LUT_100[100*(x*x)/(2*s*s)]

a simple IDL-convolve algorithm is given below, youll have to modify it to
include the radial bit
good luck,
Martin

function eg_convol3d, array, kern, debug=debug
; a simple convolution routine

if keyword_set(debug) then t0 = systime(1)
b = array*0.
sa = size(array)
sk = size(kern)

; note: ignoring edges
for k = sk(3)-1, sa(3)-1 do begin
for j = sk(2)-1, sa(2)-1 do begin
for i = sk(1)-1, sa(1)-1 do begin

v = 0
for n = 0, sk(3)-1 do begin
for m = 0, sk(2)-1 do begin
for l = 0, sk(1)-1 do begin
v = v + array[i-l, j-m, k-n]*kern[l, m, n]
endfor
endfor
endfor

b[i-sk(1)/2,j-sk(2)/2,k-sk(3)/2] = v

endfor
endfor
endfor

if keyword_set(debug) then print, "convol completed in ", systime(1) - t0,
" sec
return, b

end


"Kay" <bente@uni-wuppertal.de> wrote in message
news:e143e8bc.0110310114.3cbb5c53@posting.google.com...
> Hi,
>> I assume you mean that the function that describes the 3d kernel depends
on
>> the radial (cartesian) distance of the image voxel from a point in the
>> image:
>> *pseudo formula alert!*
>> Image'(x,y,z) = Image [convolved_with] Kernel(R(x,y,z))
>> where R(x,y,z) = sqrt((X-Xo)^2+(Y-Yo)^2 + (Z-Zo)^2))
>
> Thats right.
>
>> If so, I guess the question is, what is the dependency of the kernel on
R?
>> If linear then maybe the radial aspect of the kernel is separable
>
> My Proffessor had the "nice" idea, that a PET image, has a better
> resolution in the middle of the picture than on the edge for each
> slice. To simulate this he wants that the Kernel has a dependency of x
> & y (not z!) in that form that the FWHM (Full Width Half Max) of a 3D
> Gaussian Kernel increases linear with the distance from the middle.
>
> Thats a bit too much for my "weak" knowledge of IDL, I solved it in
> that form, that i convol the whole stuff 10 times and then copy
> several "barrels" together to the whole picture. It looks ok, but it�s
> not as smooth as it should be.
>
> I think I have to write a complete new convol function :-((
> smile
>
> thanks for the answer.
>
> Kay
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: gif license
Next Topic: IDL Pricing

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

Current Time: Mon Oct 27 05:39:49 PDT 2025

Total time taken to generate the page: 0.03548 seconds