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

Home » Public Forums » archive » zoom at widgets
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
zoom at widgets [message #92357] Sat, 28 November 2015 05:43 Go to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
I have 2 draw widgets. The first - it's full image (draw_widget) and second zoom_widget.

For draw_widget i turn on button events and motion events

draw_widget=WIDGET_DRAW(draw_base,XSIZE=1440,YSIZE=720,/MOTI ON_EVENTS,$
/BUTTON_EVENTS,X_SCROLL_SIZE=720,Y_SCROLL_SIZE=360,EVENT_PRO = "doMove")

state={pImage:PTR_NEW(image),$ ;pointer to image
langCat:oLangCat, $ ;langcat
workDir:workDir,$ ;dir for save
localDir:local_dir,$ ;dir current
draw:draw_widget,$ ;full image will be here
imageLoaded:0,$ ;is image loaded ?
label:label_value,$ ;label
zoom:zoom_draw, $ ; zoom widget
...
}

I suggest need to do the following

1. get X,Y
2. get Window ID
3. use TVRD(my region)
4. CONGRID OR REBIN
5. get and set Window ID for zoom widget
6. use TVSCL to do output in zoom widget

here is fragment of code

PRO doMove,event
WIDGET_CONTROL,event.top,GET_UVALUE=pState
x=event.x
y=event.y
...
;if mouse button was pressed
IF (event.press EQ 1) THEN BEGIN
CATCH
IF ((*pState).imageLoaded NE 0) THEN BEGIN
data=*(*pState).pImage ;get image
WIDGET_CONTROL,(*pState).draw,GET_VALUE=id ;get ID
WSET,id ;set ID
zoom_data=TVRD(x-20,y-20,10,10) ; read current graphics
zoom_data=CONGRID(zoom_data,360,360,/interp) ; what is better congrid or rebin ?
WIDGET_CONTROL,(*pstate).zoom,GET_VALUE=id ;get ID zoom
WSET,id ; set zoom current
TVSCL,zoom_data ;output
ENDIF
ENDIF
END

it's don't worked as well. it's don't showing zoom at all regions of full image
And zoom images not like original image

Thanks
Re: zoom at widgets [message #92358 is a reply to message #92357] Sat, 28 November 2015 10:29 Go to previous messageGo to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
i did some changes. It's works

IF ((*pState).imageLoaded NE 0) THEN BEGIN
data=*(*pState).pImage
zoom_data=data[x-4:x+4,y-4:y+4]
help,zoom_data
WIDGET_CONTROL,(*pState).draw,GET_VALUE=id
WSET,id
zoom_data=REBIN(zoom_data,360,360,/SAMPLE)
WIDGET_CONTROL,(*pstate).zoom,GET_VALUE=id
WSET,id
TVSCL,zoom_data
ENDIF
ENDIF

but zoomed images still not like original. Zoomed image pixels are changing own intensivity. Why ?
Re: zoom at widgets [message #92359 is a reply to message #92358] Sat, 28 November 2015 15:37 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Saturday, November 28, 2015 at 6:30:04 PM UTC, skymaxwell wrote:
> i did some changes. It's works
>
> IF ((*pState).imageLoaded NE 0) THEN BEGIN
> data=*(*pState).pImage
> zoom_data=data[x-4:x+4,y-4:y+4]
> help,zoom_data
> WIDGET_CONTROL,(*pState).draw,GET_VALUE=id
> WSET,id
> zoom_data=REBIN(zoom_data,360,360,/SAMPLE)
> WIDGET_CONTROL,(*pstate).zoom,GET_VALUE=id
> WSET,id
> TVSCL,zoom_data
> ENDIF
> ENDIF
>
> but zoomed images still not like original. Zoomed image pixels are changing own intensivity. Why ?

Hi,
the intensities you display are adapted (rescaled) between 0 and 255 using the tvscl command. In other words, what tvscl does is this:
tv, bytscl(zoom_data)

If you want the scaling to be the same in the two images, you have to find out what scaling you have in the first image and apply this to the zoomed image.
See http://www.exelisvis.com/docs/BYTSCL.html for more information.

If you don't use any scaling in the fist image (that means you simply use tvscl), then you can substitute your tvscl command in the zoom data display with this:
mn=min(data, max=mx)
tv, bytscl(zoom_data, max=mx, min=mn)

I hope it helps.

Cheers,
Helder
Re: zoom at widgets [message #92364 is a reply to message #92359] Tue, 01 December 2015 01:26 Go to previous messageGo to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
Thank you. I fixed it.

Now faced with another question -
How get geocoordinates from full image to zoom?

For zoom widget I have geocoordinates of center point only (latitude and longitude). How to use geocoordinates for central point to get geocoordinates for all zoomed region

Guess I need use CONVERT_COORDS function, but how to do it by correct way ?

If i did so, as shown below i've got coordinates [-180;-90] [180;90]


PRO doMoveZoom,event
WIDGET_CONTROL,event.top,GET_UVALUE=pState
x=event.x
y=event.y
print,"Coordinates in zoom widget =",x,y

IF ((*pState).zoomLoaded NE 0) THEN BEGIN
data=*(*pState).pzoomImage
;geocoordinates central pixel
zoom_coords=*(*pState).zoom_coords
value=data[x,y]
print,"Coordinates in zoom widget=",x,y,value," Central geo_point=",zoom_coords
; How to use geocoordinates for central point
;to get geocoordinates for all zoomed region ?
D = CONVERT_COORD(x,y,/DEVICE,/TO_DATA)
ENDIF
...

Thanks
Re: zoom at widgets [message #92367 is a reply to message #92357] Wed, 02 December 2015 07:57 Go to previous message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
I solved it
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem discovered in bandpass_filter.pro
Next Topic: ROI of 3D volumes (multiple 2D slices)

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

Current Time: Wed Oct 08 11:27:25 PDT 2025

Total time taken to generate the page: 0.00400 seconds