Hi,
I need to calculate total counts inside a defined ROI in the multyframed
image im256=IntArr(256,256,30). I define ROI in the first frame
im256(*,*,0). Q is a subscript. Then I am trying to to calculate total
counts inside ROI for every image. It starts fine for the first frame
and gives the error on the second cycle:
% Subscript range values must be >= 0, < size: IM256.
% Execution halted at: DISPLXE_DEFR 381
/export/home/rsi/idl_5.2/myfiles/DisplXe.pro
% WIDGET_PROCESS_EVENTS
% $MAIN$
What does it mean? Why subscript Q works fine for the first frame and
stops on the second?
Below I placed the problem event handler:
;****************************************************
Pro DisplXe_DEFR, event
widget_Control, event.top, Get_UValue=info, /No_Copy
im=IntArr(64,64,30)
FOR k=0, 29 DO BEGIN
im[*,*,k]=(*info.image)[*,*,4*k]+(*info.image)[*,*,4*k+1]+(* info.image)[*,*,4
*k+2]+(*info.image)[*,*,4*k+3] ENDFOR
new_base=Widget_Base(Title=info.pname+' Define ROI ',
Group_leader=event.top)
draw20ID=Widget_Draw(new_base, Xsize=256, YSize=256, /BUTTON,
/MOTION);Create a draw widget
;that will return both button and motion events
Widget_Control, new_base, /Realize
Widget_Control, draw20ID, Get_Value=wid
wset,wid;
; rebin 20 sec slices to 256x256
im256=IntArr(256,256,30)
FOR j=0, 29 DO BEGIN
im256=rebin (im[*,*,j],256,256)
ENDFOR
TVScl, im256(*,*,0)
; define ROI
Q=CW_DEFROI(draw20ID)
help, Q
; array for counts
cnts=LonArr(30)
; to find TOTAL counts inside ROI in every image !!!!!!!!! gives the
;error on the second pass (k=1)
FOR k=0, 29 DO BEGIN
tmp=im256(*,*,k)
cnts[k]= TOTAL(tmp(Q))
ENDFOR
PRINT, cnts
plot, cnts
widget_Control, event.top, Set_UValue=info, /No_Copy
END
;*********************************************************** *******
Thanks in advance,
Leonid Syrkin
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
|