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

Home » Public Forums » archive » Re: Image overlapping
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Image overlapping [message #55754] Fri, 07 September 2007 09:08
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Fri, 07 Sep 2007 07:26:55 -0700, Mike <Michael.Miller5@gmail.com>
wrote:

> Alpha blending can easily be extended to more than two images. The
> only requirements are that all the alphas be positive and that they
> are normalized so their sum is one. I've experimented with this a bit
> for medical imaging data and found that it often just results in
> confusing pictures. I think it is used fairly often for combining
> microscopy images using multiple filters. I'll append an example.

You're right, it tends to give confusing pictures. However several
overlap pictures with different alpha's (so different compounds get
highlighted) will be usefull. Thanks for your help!
Re: Image overlapping [message #55759 is a reply to message #55754] Fri, 07 September 2007 07:26 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On Sep 7, 4:54 am, Wox <nom...@hotmail.com> wrote:
> I was actually looking at something like alpha blending, but
> then for more then two images. Any ideas? Remark: the
> distributions are just 2D arrays (i.e. no RGB)

Alpha blending can easily be extended to more than two images. The
only requirements are that all the alphas be positive and that they
are normalized so their sum is one. I've experimented with this a bit
for medical imaging data and found that it often just results in
confusing pictures. I think it is used fairly often for combining
microscopy images using multiple filters. I'll append an example.

Mike


alpha [0.33, 0.33, 0.33]

;; Make sure alpha is normalized:
alpha = alpha/total(alpha)

;; Some sample images:
files = filepath(['mr_brain.dcm', 'mr_knee.dcm', 'mr_abdomen.dcm'],
subdirectory=['examples','data'])

Nx = 256
Ny = 256
Nimages = 3

R = bytarr(Nx,Ny)
G = bytarr(Nx,Ny)
B = bytarr(Nx,Ny)

color_tables = [1,3,8]

for i = 0, Nimages-1 do begin
;; Load the ith color table and get the RGB values:
loadct, color_tables[i]
tvlct, Ri, Gi, Bi, /get

;; Load the ith image and byte scale it:
image = read_image(files[i])
scaled = bytscl(image)

;; Display the ith image
tv, scaled, i

;; Add the RGB values for the ith image, weighted by the ith alpha:
R = R + alpha[i]*Ri[scaled]
G = G + alpha[i]*Gi[scaled]
B = B + alpha[i]*Bi[scaled]

endfor

;; Display the result
tvscl,[[[R]],[[G]],[[B]]], Nimages, true=3
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Canceling or clearing TIMER events
Next Topic: Re: Canceling or clearing TIMER events

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

Current Time: Wed Oct 08 18:59:15 PDT 2025

Total time taken to generate the page: 0.00566 seconds