Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hello, So, I've got a tvscl image that I've done some analysis on. With the where function I've found some places I want to highlight in that image by overlaying those areas with some color. I've managed to do something close with the tv function but it changes the color of the original tvscl image and the highlighted area is a barely distinguishable (washed out red color). Does anyone have any ideas on how to do this. I'm not contouring or anything special, just found significant area in an image and want to highlighted so I can point and say "there is where there is a significant amount of X". Thanks
jtmcahill@gmail.com writes: > Great! Thanks! I had to download your library to get some of the > functions of tvlct to work but it works great. Now, I might be > pushing my luck here, but each data area has a range of values as > well. Basically, I modeled a multispectral image array and the areas > I'm highlighting have results of my modeling. If I want to, can I > overlay a false colored tvscl image in a similar manner? I don't understand the question, but I'm sure the answer is "yes", you can do whatever you like with IDL. :-) I don't know what "overlay a false colored tvscl image in a similar manner" means in the context of the discussion so far. Can you elaborate? Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
On Jan 25, 8:52 am, David Fanning <n...@dfanning.com> wrote: > jtmcah...@gmail.com writes: >> Great! Thanks! I had to download your library to get some of the >> functions of tvlct to work but it works great. Now, I might be >> pushing my luck here, but each data area has a range of values as >> well. Basically, I modeled a multispectral image array and the areas >> I'm highlighting have results of my modeling. If I want to, can I >> overlay a false colored tvscl image in a similar manner? > > I don't understand the question, but I'm sure the answer > is "yes", you can do whatever you like with IDL. :-) > > I don't know what "overlay a false colored tvscl image > in a similar manner" means in the context of the discussion > so far. Can you elaborate? > > Cheers, > > David > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming:http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.") Ok, let's see if I can explain this more clearly. First, I display the original image in tvscl. Then, I've got a second array that I've determined the % of a given mineral per pixel (say from 0 to 1 or 0 to 100 either way you want to look at it). I can tvscl the % mineralogy no problem in a window on its own (colored or grey scale). But what I'd like to do is to overlay the original image that is tvscl, with another tvscl (which is the % mineralogy) without effecting the original image. So, it is similar to highlighting the area of the image that fit my criteria (like above), but now I'd like it to visually show the areas with a higher and lower % of that mineral as well. The first image would be grey scale, the second overlayed image probably in color. You may think that the entire image would be colored, but no. Because I've already picked out pixels that fit another geochemical criteria first. So, I only have ~20% of the original image to cover. If I display the second image alone, the observer has no context for what they are looking at. But, if I over lay it on the first image, that will provide the context. That's what I'm shooting for. Mahalo, Josh
jtmcahill@gmail.com writes: > Ok, let's see if I can explain this more clearly. First, I display > the original image in tvscl. If you are really using TVSCL to display your image, I think you are already in trouble or you will be in trouble soon. If colors matter to you, forget you ever heard anything about TVSCL. Learn how to use TV and BYTSCL, including *all* the BYTSCL keywords. You will be undermining a lot of the work we are doing here if you use TVSCL. (And if you *really* want to work in IDL, get TVIMAGE or IMGDISP from one of the usual places on the Internet. You don't want to be using TV either. :-) > Then, I've got a second array that I've > determined the % of a given mineral per pixel (say from 0 to 1 or 0 to > 100 either way you want to look at it). I can tvscl the % mineralogy > no problem in a window on its own (colored or grey scale). But what > I'd like to do is to overlay the original image that is tvscl, with > another tvscl (which is the % mineralogy) without effecting the > original image. So, it is similar to highlighting the area of the > image that fit my criteria (like above), but now I'd like it to > visually show the areas with a higher and lower % of that mineral as > well. The first image would be grey scale, the second overlayed image > probably in color. You may think that the entire image would be > colored, but no. Because I've already picked out pixels that fit > another geochemical criteria first. So, I only have ~20% of the > original image to cover. If I display the second image alone, the > observer has no context for what they are looking at. But, if I over > lay it on the first image, that will provide the context. That's what > I'm shooting for. Have a look at this article, I think this describes what you are after: http://www.dfanning.com/color_tips/color_overlay.html Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning wrote: > jtmcahill@gmail.com writes: > >> Ok, let's see if I can explain this more clearly. First, I display >> the original image in tvscl. > > If you are really using TVSCL to display your image, I think > you are already in trouble or you will be in trouble soon. > If colors matter to you, forget you ever heard anything about > TVSCL. Learn how to use TV and BYTSCL, including *all* the BYTSCL > keywords. You will be undermining a lot of the work we are doing > here if you use TVSCL. > > (And if you *really* want to work in IDL, get TVIMAGE or IMGDISP > from one of the usual places on the Internet. You don't want to > be using TV either. :-) > >> Then, I've got a second array that I've >> determined the % of a given mineral per pixel (say from 0 to 1 or 0 to >> 100 either way you want to look at it). I can tvscl the % mineralogy >> no problem in a window on its own (colored or grey scale). But what >> I'd like to do is to overlay the original image that is tvscl, with >> another tvscl (which is the % mineralogy) without effecting the >> original image. So, it is similar to highlighting the area of the >> image that fit my criteria (like above), but now I'd like it to >> visually show the areas with a higher and lower % of that mineral as >> well. The first image would be grey scale, the second overlayed image >> probably in color. You may think that the entire image would be >> colored, but no. Because I've already picked out pixels that fit >> another geochemical criteria first. So, I only have ~20% of the >> original image to cover. If I display the second image alone, the >> observer has no context for what they are looking at. But, if I over >> lay it on the first image, that will provide the context. That's what >> I'm shooting for. > > Have a look at this article, I think this describes what you are > after: > > http://www.dfanning.com/color_tips/color_overlay.html Hi, In this case, I'd argue for a different approach. Assuming that the OP has two images im1 (with color scale 1) and im2 (with color scale 2) and a ROI, such that the goal is to have a plot of im1 (with colors 1) outside the ROI and im2 (with colors 2) inside the ROI, the he could proceed in the following way: 1) convert im1 + color scale 1 to a true color image (call it im1true) 2) convert im2 + color scale 2 to a true color image (im2true) 3) substitute pixels of im1true inside roi with corresponding values from im2true 4) device,/decomposed 4) tv,im1true,/true That should not be too hard to implement... here's an example (not polished nor optimized, just a hint) ;example ;create 2 images im1=dist(256,256) im2=rebin(findgen(256),256,256) ;define ROI ind=array_indices(im1,where(im1 GT 100)) ;black-white is col scale for im1 loadct,0 tvlct,r,g,b,/get im1truecol=im2truecol(im1,r,g,b);convert to true color ;red temp scale for im 2 loadct,3 tvlct,r,g,b,/get im2truecol=im2truecol(im2,r,g,b);convert to true color ;assign roi pixel from 2 to 1 FOR i=0L,n_elements(ind)/2-1 DO BEGIN im1truecol[ind[0,i],ind[1,i],*]=im2truecol[ind[0,i],ind[1,i] ,*] ENDFOR device,decomposed=1 tv,im1truecol,true=3 using the function (again, this is a bit rough and is not polished) FUNCTION im2truecol,im,r,g,b s=size(im) sx=s[1] sy=s[2] n=n_elements(r) maxim=max(im) minim=min(im) im=(im-min(im))/(max(im)-min(im))*n im3col=[[[reform(r[reform(im,sx*sy)],sx,sy)]], $ [[reform(g[reform(im,sx*sy)],sx,sy)]], $ [[reform(b[reform(im,sx*sy)],sx,sy)]]] return,im3col end Ciao, Paolo > > Cheers, > > David > -- > David Fanning, Ph.D. > Fanning Software Consulting, Inc. > Coyote's Guide to IDL Programming: http://www.dfanning.com/ > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
> Ok, let's see if I can explain this more clearly. First, I display > the original image in tvscl. Then, I've got a second array that I've > determined the % of a given mineral per pixel (say from 0 to 1 or 0 to > 100 either way you want to look at it). I can tvscl the % mineralogy > no problem in a window on its own (colored or grey scale). if you want to do it in direct graphics with color tables... ; load background and overlay colors (change ncolors as needed) loadct, 0, ncolors=128 loadct, ???, bottom=128, ncolors=128 ; or use tvlct ; bytscale accordingly back = bytscl(orig, top=127) over = bytscl(minerals, top=127)+128 ; make a binary mask of what you want to show mask = (minerals gt val1 * minerals lt val2) + (minerals gt val3) ; display tv, back*(1-mask) + over*mask if you need transparency better look at object graphics cheers
> mask = (minerals gt val1 * minerals lt val2) + (minerals gt val3) sorry, you will probably want to do mask = (minerals gt val1) * (minerals lt val2) + (minerals gt val3)