This page was created by the IDL library routine
mk_html_help
. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? mk_html_help
at the IDL command line prompt.
Last modified: 13.07.2004
(See /IDL/pro_src/RODENA/pro/rod/add_c_file.pro)
(See /IDL/pro_src/RODENA/pro/rod/b2fl.pro)
(See /IDL/pro_src/RODENA/pro/rod/cimg.pro)
(See /IDL/pro_src/RODENA/pro/rod/cir_cursor.pro)
(See /IDL/pro_src/RODENA/pro/rod/cw_hist.pro)
(See /IDL/pro_src/RODENA/pro/rod/cw_ortho.pro)
(See /IDL/pro_src/RODENA/pro/rod/dev_test.pro)
(See /IDL/pro_src/RODENA/pro/rod/dil.pro)
(See /IDL/pro_src/RODENA/pro/rod/dilate_32.pro)
(See /IDL/pro_src/RODENA/pro/rod/disp_tlb.pro)
(See /IDL/pro_src/RODENA/pro/rod/distpn.pro)
(See /IDL/pro_src/RODENA/pro/rod/dtp_head.pro)
(See /IDL/pro_src/RODENA/pro/rod/dtp_invert.pro)
(See /IDL/pro_src/RODENA/pro/rod/dtp_show.pro)
(See /IDL/pro_src/RODENA/pro/rod/dtp_test.pro)
(See /IDL/pro_src/RODENA/pro/rod/d_thr.pro)
(See /IDL/pro_src/RODENA/pro/rod/d_thr_n.pro)
(See /IDL/pro_src/RODENA/pro/rod/edit.pro)
(See /IDL/pro_src/RODENA/pro/rod/ell_cursor.pro)
(See /IDL/pro_src/RODENA/pro/rod/ero.pro)
(See /IDL/pro_src/RODENA/pro/rod/erode_32.pro)
(See /IDL/pro_src/RODENA/pro/rod/extinction.pro)
(See /IDL/pro_src/RODENA/pro/rod/extr_name.pro)
(See /IDL/pro_src/RODENA/pro/rod/fer.pro)
(See /IDL/pro_src/RODENA/pro/rod/fill.pro)
(See /IDL/pro_src/RODENA/pro/rod/fill_sel.pro)
(See /IDL/pro_src/RODENA/pro/rod/find_first.pro)
(See /IDL/pro_src/RODENA/pro/rod/gen_mask.pro)
(See /IDL/pro_src/RODENA/pro/rod/gen_schw.pro)
(See /IDL/pro_src/RODENA/pro/rod/get_devices.pro)
(See /IDL/pro_src/RODENA/pro/rod/get_num.pro)
(See /IDL/pro_src/RODENA/pro/rod/get_project.pro)
(See /IDL/pro_src/RODENA/pro/rod/get_specimen.pro)
(See /IDL/pro_src/RODENA/pro/rod/g_thr.pro)
(See /IDL/pro_src/RODENA/pro/rod/histo_list.pro)
(See /IDL/pro_src/RODENA/pro/rod/hist_plot.pro)
(See /IDL/pro_src/RODENA/pro/rod/int.pro)
(See /IDL/pro_src/RODENA/pro/rod/int_d_thr.pro)
(See /IDL/pro_src/RODENA/pro/rod/i_cdtp.pro)
(See /IDL/pro_src/RODENA/pro/rod/label_sw.pro)
(See /IDL/pro_src/RODENA/pro/rod/lin_cursor.pro)
(See /IDL/pro_src/RODENA/pro/rod/list_tiff.pro)
(See /IDL/pro_src/RODENA/pro/rod/m0m1m2.pro)
(See /IDL/pro_src/RODENA/pro/rod/make_name.pro)
(See /IDL/pro_src/RODENA/pro/rod/mask_util.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_and.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_bord.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_bord_d.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_centre.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_dil_n.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_dist.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_ero_n.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_fill.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_fill_s.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_or.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_ouv_n.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_rand.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_sele.pro)
(See /IDL/pro_src/RODENA/pro/rod/mm_top_hat.pro)
(See /IDL/pro_src/RODENA/pro/rod/msk.pro)
(See /IDL/pro_src/RODENA/pro/rod/ns_mult.pro)
(See /IDL/pro_src/RODENA/pro/rod/ns_padd.pro)
(See /IDL/pro_src/RODENA/pro/rod/n_schw.pro)
(See /IDL/pro_src/RODENA/pro/rod/ouv.pro)
(See /IDL/pro_src/RODENA/pro/rod/p2a.pro)
(See /IDL/pro_src/RODENA/pro/rod/parse_fn.pro)
(See /IDL/pro_src/RODENA/pro/rod/pic2cel.pro)
(See /IDL/pro_src/RODENA/pro/rod/plot_h.pro)
(See /IDL/pro_src/RODENA/pro/rod/histo_list.pro)
(See /IDL/pro_src/RODENA/pro/rod/pro_update.pro)
(See /IDL/pro_src/RODENA/pro/rod/rand.pro)
(See /IDL/pro_src/RODENA/pro/rod/rand_loe.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_dtp.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_ima.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_pic.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_pic_record.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_raw.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_seq.pro)
(See /IDL/pro_src/RODENA/pro/rod/read_s_ascii.pro)
(See /IDL/pro_src/RODENA/pro/rod/tiff_read.pro)
(See /IDL/pro_src/RODENA/pro/rod/rice.pro)
(See /IDL/pro_src/RODENA/pro/rod/select.pro)
(See /IDL/pro_src/RODENA/pro/rod/shad_per.pro)
(See /IDL/pro_src/RODENA/pro/rod/shad_vor.pro)
(See /IDL/pro_src/RODENA/pro/rod/sp_clab.pro)
(See /IDL/pro_src/RODENA/pro/rod/sp_runl.pro)
(See /IDL/pro_src/RODENA/pro/rod/stegm.pro)
(See /IDL/pro_src/RODENA/pro/rod/stretch.pro)
(See /IDL/pro_src/RODENA/pro/rod/s_thr.pro)
(See /IDL/pro_src/RODENA/pro/rod/test_pic.pro)
(See /IDL/pro_src/RODENA/pro/rod/tm_wshe1.pro)
(See /IDL/pro_src/RODENA/pro/rod/tm_wshe2.pro)
(See /IDL/pro_src/RODENA/pro/rod/typeof.pro)
(See /IDL/pro_src/RODENA/pro/rod/update_dtp.pro)
(See /IDL/pro_src/RODENA/pro/rod/update_pic.pro)
(See /IDL/pro_src/RODENA/pro/rod/watershed.pro)
(See /IDL/pro_src/RODENA/pro/rod/write_dtp.pro)
(See /IDL/pro_src/RODENA/pro/rod/write_pic.pro)
(See /IDL/pro_src/RODENA/pro/rod/write_pic_record.pro)
(See /IDL/pro_src/RODENA/pro/rod/write_ppm.pro)
(See /IDL/pro_src/RODENA/pro/rod/write_s_ascii.pro)
(See /IDL/pro_src/RODENA/pro/rod/xthresh.pro)
(See /IDL/pro_src/RODENA/pro/rod/zeiss.pro)
(See /IDL/pro_src/RODENA/pro/rod/zerleg.pro)
(See /IDL/pro_src/RODENA/pro/rod/zerleg_n.pro)
List of Routines
Routine Descriptions
ADD_C_FILE
[Next Routine]
[List of Routines]
NAME:
ADD_C_FILE
pro add_c_file,ina,ona,ADD=add,HINTEN=hinten
a=read_s_ascii(ina)
if n_params() lt 2 then ona=ina
sa=size(a)
if sa(0) eq 0 then begin
a=[a]
sa=size(a)
endif
if not keyword_set(hinten) then for i=0,sa(1)-1 do a(i)=add+a(i) $
else for i=0,sa(1)-1 do a(i)=a(i)+add
write_s_ascii,ona,a
end
B2FL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
B2FL
function b2fl,f
return,float(f)/255.0
end
CIMG
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
CIMG
pro cimg,name,VERBOSE=verb,MASK=mask, MAX_IMAGE_SIZE=maxsi, $
WAIT=wait,NUMBER=numb,OVER_READ=star,SELECTOR=sele, $
V0=verb0,V2=verb2
Display of Vancouver IMG files
name: IMG Filename
VERBOSE Listing of header info
V2 Listing of mask header info
V0 Listing of images found (short)
MASK Display of mask
MAX_IMAGE_SIZE Border reservation (def. 40)
WAIT Wait for keyboard input befor next page
NUMBER Display image number
OVER_READ Offset of image number
SELECTOR Selection criterion ('*','1',...)
CIR_CURSOR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
CIR_CURSOR
PURPOSE:
Emulate the operation of a variable-sized circle cursor (also known as
a "marquee" selector).
CATEGORY:
Interactive graphics.
CALLING SEQUENCE:
CIR_CURSOR, x0, y0, rad [, INIT = init] [, FIXED_SIZE = fixed_size]
INPUTS:
No required input parameters.
OPTIONAL INPUT PARAMETERS:
x0, y0, rad give the initial location (x0, y0) and
radius of the circle if the keyword INIT is set. Otherwise, the
circle is initially drawn in the center of the screen.
KEYWORD PARAMETERS:
INIT: If this keyword is set, x0, y0, rad contain the initial
parameters for the circle.
FIXED_SIZE: If this keyword is set, rad contain the initial
size of the circle. This size may not be changed by the user.
MESSAGE: If this keyword is set, print a short message describing
operation of the cursor
OUTPUTS:
x0: X value of lower left corner of box.
y0: Y value of lower left corner of box.
rad: radius of circle in pixels.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A circle is drawn in the currently active window. It is erased
on exit.
RESTRICTIONS:
Works only with window system drivers.
PROCEDURE:
The graphics function is set to 6 for eXclusive OR. This
allows the circle to be drawn and erased without disturbing the
contents of the window.
Operation is as follows:
Left mouse button: Move the circle by dragging.
Middle mouse button: Resize the circle by dragging.
Right mouse button: Exit this procedure, returning the
current circle parameters.
MODIFICATION HISTORY:
DMS, April, 1990.
DMS, April, 1992. Made dragging more intutitive.
June, 1993 - Bill Thompson
prevented the box from having a negative size.
Rodenacker, Jan 1997 Move from BOX_... to CIR_...
CW_HIST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
CW_HIST
PURPOSE:
This function generates a compound widget for threshold
detection in an 1-dim array. A widget base holding a draw
widget sensitive for mouse clicks is build and the widget id
is returned.
CATEGORY:
Widgets.
CALLING SEQUENCE:
result = CW_HIST( parent )
INPUTS:
none
OPTIONAL INPUTS:
none
KEYWORD PARAMETERS:
DATA: data array for display with typically positive values,
e.g. a frequency distribution
INDEX: Index values array for ordinate, must have the same size
like DATA, otherwise default is used.
(default=lindgen(n_elements(DATA)))
LOWER_VALUE: lower threshold initial value (default=0)
UPPER_VALUE: upper threshold initial value
(default=INDEX(n_elements(DATA)-1))
MAXIMUM: maximum to be displayed (default=max(DATA))
XSIZE: x size of draw widget (default=300)
YSIZE: y size of draw widget (default=200)
TITLE: Title in plot (default='CW_HIST')
COLOR: Plot color
PSYM: Plot symbol (default=0)
UVALUE: User value of widget (default='CW_HIST')
GROUP: Parent widget
OUTPUTS:
This function returns the widget id
OPTIONAL OUTPUTS:
none
COMMON BLOCKS:
none
SIDE EFFECTS:
none
RESTRICTIONS:
only for widget capable graphic devices
PROCEDURE:
After realizing the widget lower value, displayed by a thin
line and the upper value, displayed by a thick line can be
dragged with left button.
The line next to the cursor is selected.
The middle button allows to rescale the display by setting
the maximum value. Inside the plot reduces, above the plot
increases by a factor of 1.1 the maximum value
The function CW_HIST_GET_VALUE( result ) returns the actual
values as a two element array
The function CW_HIST_SET_VALUE allows to set several
values.
CALL: cw_hist_set_value, id, value, DATA=h, INDEX=i, $
COLOR=col, PSYM=psym, TITLE=tit
where value corresponds to [LOWER_VALUE, UPPER_VALUE], DATA,
INDEX, COLOR, PSYM, TITLE of the initial call of CW_HIST.
All motion events are swallowed, only button events are sent
to the next event handler.
EXAMPLE:
Event handler prints the actual valuesby releasing right button
pro xhist_event, event
if event.release eq 4 then begin
thr = cw_hist_get_value(widget_info(event.top,/child))
print,thr
endif
end
Example procedure generating widget hierarchy
pro xhist, _extra=opt
base = widget_base()
hist = cw_hist(base, _extra=opt)
widget_control, base, /realize
xmanager, 'xhist', base
end
Procedure call of example
xhist, data=long(sin(findgen(720)/180.*!pi)*200), $
index=lindgen(720)/2
MODIFICATION HISTORY:
Written by: K. Rodenacker, 8. Jun. 97.
CW_ORTHO
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
CW_ortho
PURPOSE:
This compound widget displays three images: the orthogonal views
from a given volume.
The user may select the section coordinates and display the appropriate
sections by button LEFT. Other buttons send events accompanied by coordinates
to the parent widget.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_ORTHO(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
FRAME: If set, a frame will be drawn around the widget. The
default is FRAME=0 (no frame).
RETAIN: Controls the setting for backing store for both windows.
If backing store is provided, a window which was obscured
will be redrawn when it becomes exposed. Set RETAIN=0 for
no backing store. Set RETAIN=1 to "request backing store
from server" (this is the default). Set RETAIN=2 for IDL
to provide backing store.
UVALUE: The user value for the widget.
VOLUME: Data set to be displayed
Sizes of volume will overwrite size parameters
TRACK: Continuous tracking by pressed button
XSIZE: The width of the window (in pixels) for the original image.
The default is 128.
YSIZE: The height of the window (in pixels) for the original image.
The default is 128.
ZSIZE: The depth of the window (in pixels) for the original image.
The default is 16.
X_CURRENT:Current hair cross position x (default xsize/2)
Y_CURRENT:Current hair cross position y (default ysize/2)
Z_CURRENT:Current hair cross position z (default zsize/2)
IDS: A variable, which contains a structure with the widget id's
{XY: XY drawable widget id,
XZ: XZ drawable widget id,
ZY: ZY drawable widget id}
OUTPUTS:
The ID of the created widget is returned.
SIDE EFFECTS:
PROCEDURE:
WIDGET_CONTROL, id, SET_VALUE=value can be used to change the
original volume displayed by the widget
as far as the sizes are unchanged.
The value may not be set until the widget has been
realized.
WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current
data.
MODIFICATION HISTORY:
April 12, 1997, K.Rodenacker -
Fri Jul 11 10:08:21 1997, Karsten Rodenacker
<iliad@janus.gsf.de>
DEV_TEST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DEV_TEST
PURPOSE:
Test for existing device
Only VMS
CATEGORY:
Input/Output
CALLING SEQUENCE:
Result = DEV_TEST( Device_name)
INPUTS:
Device_name: Name of device
OUTPUTS:
Result is 0 if device not existant or not mounted
Device_name contains the logical volume name
SIDE EFFECTS:
The DCL Procedure $1$dia1:[iliad.idl.rod]dev_test.com is used
MODIFICATION HISTORY:
Written by: K.Rodenacker 22.10.94
Last modified: 09.11.94
DIL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DIL
function dil,x,STERN=ste
if not keyword_set(ste) then st_e=[[1,1,1],[1,1,1],[1,1,1]] $
else st_e=[[0,1,0],[1,1,1],[0,1,0]]
return,dilate(x,st_e,/gr)
end
DILATE_32
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DILATE_32
function dilate_32,x,ste
xx=long(x)
sx=size(xx)
y=lonarr(sx(1),sx(2))
meth=[0B,0B,1B,1B,1B,1B,1B,1B,1B,1B]
iste=0l
for i=0,8 do iste=iste+ishft(ste(i),8-i)
case !version.os of
'vms': i=call_external('rod_share','stegm_l',xx,y,0,sx(2),sx(1), $
iste,iste,3,0,0, value=meth, $
default=filepath('rod_share.exe', $
root=!idl_basiss,subd=['rod',!version.os]))
'IRIX': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
iste,iste,3,0,0, value=meth)
'hp-ux': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
iste,iste,3,0,0, value=meth)
'Win32':i=call_external(filepath('rod_shar.dll', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
iste,iste,3,0,0, value=meth)
else:message,'STEGM_L not implemented on '+!version.os
endcase
return,y
end
DISP_TLB
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DISP_TLB
pro disp_tlb,tlb,modu,SUBDIRECTORY=subd,LIST=list
fname='_'+modu+'_.xxx'
if not keyword_set(subd) then subd='user_contrib'+'.'+tlb
if not keyword_set(list) $
then spawn,'lib/text/extract='+modu+ $
'/out='+fname+' $1$dia1:[idl.'+subd+']'+tlb $
else spawn,'lib/text/list='+fname+' $1$dia1:[idl.'+subd+']'+tlb
xdisplayfile,fname
spawn,'del/nolog '+fname+'.*'
end
DISTPN
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DISTPN
function distpn,bild
s=size(bild)
if s(0) ne 2 then message,'no image'
case s(3) of
1:begin
bbild=mm_bord((bild ne 0b)*255b)
name='distpn_b'
end
2:begin
bbild=mm_bord(long(bild ne 0b)*('7fffffff'XL))
name='distpn_l'
end
3:begin
bbild=mm_bord(bild*('7fffffff'XL))
name='distpn_l'
end
else: message,'image type not supported'
endcase
meth=[0B,1B,1B]
case !version.os of
'vms': i=call_external('rod_share',name,bbild,s(2),s(1), $
value=meth, $
default=filepath('rod_share.exe', $
root=!idl_basiss,subd=['rod',!version.os]))
'IRIX': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
name,bbild,s(2),s(1), $
value=meth)
'hp-ux': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
name,bbild,s(2),s(1), $
value=meth)
'Win32':i=call_external(filepath('rod_shar.dll', $
root=!idl_basiss,subd=['rod',!version.os]), $
name,bbild,s(2),s(1), $
value=meth)
else:message,name+' not implemented on '+!version.os
endcase
return,bbild
end
DTP_HEAD
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DTP_HEAD
pro dtp_head,wildnam,FULL=full
dtp_head zur Ausgabe von Bildkoepfen
f=findfile(wildnam,co=nf)
if nf gt 0 then begin
for i=0,nf-1 do begin
b=read_dtp(f(i),kopf=ko)
if keyword_set(full) then case full of
1:print,ko
2:print,strcompress(strmid(ko,80,165))+' ',strmid(ko,47,2)
3:print,strcompress(strmid(ko,80,165))+' ',strmid(ko,2,10)
else:print,strmid(ko,0,80)
endcase else print,strmid(ko,0,80)
endfor
endif
end
DTP_INVERT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DTP_INVERT
pro dtp_invert,inb,outb,DISPLAY=disp,THR_C=thr_c,THR_I=thr_i,KEY=key
b=read_dtp(inb,kopf=ko)
c=255B - b
nko=byte(ko)
if not (keyword_set(thr_c) and keyword_set(thr_i)) then begin
tc=255-long(strmid(ko,74,3))
ti=255-long(strmid(ko,77,3))
endif else begin
tc=thr_c
ti=thr_i
endelse
if keyword_set(key) then nko(16)=byte(key) else nko(16)=nko(16)-1
nko(74:76)=byte(strtrim(string(tc,format='(i3.3)'),2))
nko(77:79)=byte(strtrim(string(ti,format='(i3.3)'),2))
if keyword_set(disp) then begin
tv,b,0,0 & tv,c,128,0 & tvscl,b gt byte(255-ti),0,128 & tvscl,c lt byte(ti),128,128
endif
print,string(nko(0:79))
ko=string(nko)
write_dtp,outb,c,kopf=ko
end
DTP_SHOW
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DTP_SHOW
pro dtp_show,wildnam,SIZE=siz,VERBOSE=verb,MASK=mask, $
NOFIND=nofil,TITLE=title,_extra=ext
dtp_show zur Ausgabe von Bildern mit SLIDE_IMAGE
Options fuer SLIDE_IMAGE werden uebergeben !
if not keyword_set(siz) then siz=128
if keyword_set(nofil) then begin
f=wildnam & sf=size(f) & if sf(0) eq 0 then nf=1 else nf=sf(1)
wildnam='NAME_ARRAY'
endif else f=findfile(wildnam,co=nf)
if not keyword_set(title) then title=wildnam
if keyword_set(verb) then print,'Under ',wildnam,':',nf,' files found'
if keyword_set(mask) then begin
loadct,38,file='idl_dir:[000000]colors2.tbl' & stretch,16,255
endif
if nf gt 0 then begin
dim=ceil(sqrt(nf))
a=bytarr(dim*siz,dim*siz)
for i=0,nf-1 do begin
kx=(i mod dim)*siz
ky=(i/dim)*siz
b=read_dtp(f(i))
sb=size(b)
if keyword_set(mask) then b=(b/2B+(b and 1B)*128B)
if sb(1) ne siz or sb(2) ne siz then b=congrid(b,siz,siz)
a(kx:kx+siz-1,ky:ky+siz-1)=b
if keyword_set(verb) and kx eq 0 then print,ky,f(i)
endfor
slide_image,a,_extra=ext,title=title
endif
end
DTP_TEST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
DTP_TEST
function dtp_test,nam
dtp_test prueft dtp-Bilder
b=read_dtp(nam)
sb0=size(where(b eq 0))
return,sb0(0)
end
D_THR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
D_THR
PURPOSE:
CATEGORY:
Image processing
CALLING SEQUENCE:
Result = D_THR( Bild, Pegs, Para, Erge, INVERT=invert)
INPUTS:
Bild: Image
Pegs: Start threshold
Para: Parameter (defaults are taken if value = -1.)
para(0)=IPEGS para(1)=FFMAX(25) para(2)=FAKFF(0.5)
para(3)=FAKFL(0) para(4)=FAKFD(10) para(5)=IFLM(25)
para(6)=IERW(16) para(7)=MITX(64) para(8)=MITY(64)
Erge: Results = 0 No threshold found
KEYWORD PARAMETERS:
INVERT: The image is NOT inverted befor processing
OUTPUTS:
Result: Found threshold (no threshold found = 0)
Erge: Result vector
erge(0)=Flaeche (Muss > IFLM sein)
erge(1)=minimal X-Koordinate
erge(2)=maximal X-Koordinate
erge(3)=minimal Y-Koordinate
erge(4)=maximal Y-Koordinate
erge(5)=Kontureintrittspunkt (bei min. Y-K.)
erge(6)=X-Koordinate dunkelster Punkt
erge(7)=Y-Koordinate dunkelster Punkt
erge(8)=Betrag des dunkeltsten Punktes
erge(9)=Gefundene Schwelle
erge(10)=?
SIDE EFFECTS:
The external $1$dia1:[iliad.idl.rod.for]ipegel_d is called
Defaulted values of para are replaced
RESTRICTIONS:
Image size must be 128x128
PROCEDURE:
With the Dresden program a threshold is estimated
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
D_THR_N
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
D_THR_N
PURPOSE:
CATEGORY:
Image processing
CALLING SEQUENCE:
Result = D_THR_N( Bild, Para, Erge, INVERT=invert)
INPUTS:
Bild: Image
Para: Parameter (defaults are taken if value = -1.)
para(0)=(PEGS) para(1)=FFMAX(25) para(2)=FAKFF(0.5)
para(3)=FAKFL(0) para(4)=FAKFD(10) para(5)=IFLM(25)
para(6)=IERW(16) para(7)=MITX(64) para(8)=MITY(64)
Erge: Results = 0 No threshold found
KEYWORD PARAMETERS:
INVERT: The image is NOT inverted befor processing
OUTPUTS:
Result: Found threshold (no threshold found = 0)
Erge: Result vector
erge(0)=Kontureintrittspunkt x
erge(1)=Kontureintrittspunkt y
erge(2)=IOD
erge(3)=Schwelle
erge(4)=Untergrund
SIDE EFFECTS:
The external $1$dia1:[iliad.idl.rod.cc]my_share is called
Defaulted values of para (-1) are replaced
RESTRICTIONS:
none
PROCEDURE:
With the Dresden program a threshold is estimated
MODIFICATION HISTORY:
Written by: K. Rodenacker, 07, Feb 1996
EDIT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
EDIT
pro edit,file,START=start
if n_elements(file) eq 0 then begin
bad_par: message,"Usage: EDIT, 'filename'"
endif
s=size(file)
if (s(0) ne 0) or (s(1) ne 7) then goto,bad_par
comm='TPU '+file
if keyword_set(start) then ist='('+start+')' $
else ist='(1,1)'
comm=comm+' /START='+ist
status=call_external('tpushr','tpu$tpu',comm)
spawn,'exit '+string(status)
return
end
ELL_CURSOR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
ELL_CURSOR
PURPOSE:
Emulate the operation of a variable-sized ellipse cursor (also known as
a "marquee" selector).
CATEGORY:
Interactive graphics.
CALLING SEQUENCE:
ELL_CURSOR, x0, y0, ra, rb, ang [, INIT = init] [, FIXED_SIZE = fixed_size]
INPUTS:
No required input parameters.
OPTIONAL INPUT PARAMETERS:
x0, y0, ra, rb, ang give the initial location (x0, y0) and
radii and orientation of the ellipse if the keyword INIT is set.
Otherwise, the
ellipse is initially drawn in the center of the screen.
KEYWORD PARAMETERS:
INIT: If this keyword is set, x0, y0, ra, rb, ang contain the initial
parameters for the ellipse.
FIXED_SIZE: If this keyword is set, ra, rb, ang contain the initial
parameters of the ellipse. They may not be changed by the user.
MESSAGE: If this keyword is set, print a short message describing
operation of the cursor
OUTPUTS:
x0: X value of lower left corner of box.
y0: Y value of lower left corner of box.
ra: radius of ellipse in pixels.
rb: radius of ellipse in pixels.
ang: angle of orientation [-180, 180]
COMMON BLOCKS:
None.
SIDE EFFECTS:
A ellipse is drawn in the currently active window. It is erased
on exit.
RESTRICTIONS:
Works only with window system drivers.
PROCEDURE:
The graphics function is set to 6 for eXclusive OR. This
allows the ellipse to be drawn and erased without disturbing the
contents of the window.
Operation is as follows:
Left mouse button: Move the ellipse by dragging.
Middle mouse button: Resize the ellipse by dragging.
Right mouse button: Exit this procedure, returning the
current ellipse parameters.
MODIFICATION HISTORY:
DMS, April, 1990.
DMS, April, 1992. Made dragging more intutitive.
June, 1993 - Bill Thompson
prevented the box from having a negative size.
Rodenacker, Jan 1997 Move from BOX_... to ELL_...
ERO
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
ERO
function ero,x,STERN=ste
if not keyword_set(ste) then st_e=[[1,1,1],[1,1,1],[1,1,1]] $
else st_e=[[0,1,0],[1,1,1],[0,1,0]]
return,erode(x,st_e,/gr)
end
ERODE_32
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
ERODE_32
function erode_32,x,ste
xx=long(x)
sx=size(xx)
y=lonarr(sx(1),sx(2))
meth=[0B,0B,1B,1B,1B,1B,1B,1B,1B,1B]
iste=0l
for i=0,8 do iste=iste+ishft(ste(i),8-i)
case !version.os of
'vms': i=call_external('rod_share','stegm_l',xx,y,0,sx(2),sx(1), $
0,iste,3,0,0, value=meth, $
default=filepath('rod_share.exe', $
root=!idl_basiss,subd=['rod',!version.os]))
'hp-ux': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
0,iste,3,0,0, value=meth)
'IRIX': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
0,iste,3,0,0, value=meth)
'Win32':i=call_external(filepath('rod_shar.dll', $
root=!idl_basiss,subd=['rod',!version.os]), $
'stegm_l',xx,y,0,sx(2),sx(1), $
0,iste,3,0,0, value=meth)
else:message,'STEGM_L not implemented on '+!version.os
endcase
return,y
end
EXTINCTION
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
EXTINCTION
PURPOSE:
Compute the extinction values of array
CATEGORY:
G1- Simple calculations on image data.
CALLING SEQUENCE:
Result = EXTINCTION, Array[, Ww[,Sw[,Fak]]],
MIN=mxk, SMOOTH=Smo, MODE=Md
INPUTS:
Array: The data array. Array may be any type except string.
Optional INPUTS:
Ww: White value, default=240
Sw: Black value, default=6
Fak: Stretching factor, default=-150
KEYWORDS:
NO_MOD: if set the pure transformation is returned
without any offset calculation
MIN: Variable for returning the offset
MODE: Type of offset estimation
=0 offset = mode(extinction)
>1 offset = fractile(extinction)
SMOOTH: Size of smooth window for mode estimation,
only for MODE=0
OUTPUTS:
EXTINCTION returns the extinction array
The result is byte
PROCEDURE:
ext = byte((Fak*alog10((Array-Sw)/Ww) - offset) < 255.)
on_error,2 ;return to caller if error
np=n_params()
if np lt 4 then fak=-150.
if np lt 3 then sw=6.
if np lt 2 then ww=240.
fsw=float(sw) & ffak=float(fak) & fww=float(ww) & array=arr
nl=where(array le sw) & snl=size(nl)
if snl(0) eq 1 then array(nl)=byte(sw)+1B
e=byte(ffak*alog10((float(array)-fsw)/fww) > 0.0 < 255.0)
mxk=0
if not keyword_set(No_mod) then begin
h=histogram(e)
if keyword_set(smo) then h=smooth(h,smo)
if not keyword_set(md) then mx=max(h,mxk) $
else begin
mxk=min(e)
a=h(mxk)
while a lt md do begin
mxk=mxk+1
a=a+h(mxk)
endwhile
endelse
e=byte((e-mxk) > 0.0 < 255.0)
endif
return,e
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
MODIFICATION HISTORY:
Rodenacker July 1993.
EXTR_NAME
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
extr_name
CALLING SEQUENCE:
Result = extr_name( Name)
PROCEDURE:
Extracts from a file name the name without extension (last dotted part)
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
function extr_name,full_name,PREFIX=pre,EXTENSION=ext
if !version.arch eq 'vax' then i=rstrpos(full_name,']') $
else i=rstrpos(full_name,'/')
j=rstrpos(full_name,'.')
if j le (i+1) then j=strlen(full_name)
name=strmid(full_name,i+1,j-i-1)
pre=strmid(full_name,0,i+1)
if !version.arch eq 'vax' then k=rstrpos(full_name,';') $
else k=strlen(full_name)
ext=strmid(full_name,j+1,k-j-1)
return,name
end
FER
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
FER
function fer,x,STERN=ste
if not keyword_set(ste) then st_e=[[1,1,1],[1,1,1],[1,1,1]] $
else st_e=[[0,1,0],[1,1,1],[0,1,0]]
return,erode(dilate(x,st_e,/gr),st_e,/gr)
end
FILL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
FILL
function fill,x
sx=size(x)
if sx(0) ne 2 then return,x
if total(x) eq 0l then return,x
ix=x ne 0
e=x
e(*,*)=0
n=where(x eq 0,cn)
if cn eq 0 then return,x
kx=n(0) mod sx(1)
ky=n(0) / sx(1)
a=search2d(ix,kx,ky,0,0)
e(a)=1
e=e xor (1 - ix)
e=e or x
case sx(3) of
1: return,byte(e)
2: return,int(e)
3: return,long(e)
4: return,float(e)
else: return,e
endcase
end
FILL_SEL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
FILL_SEL
function fill_sel,x,kx,ky
sx=size(x)
if sx(0) ne 2 then return,x
if total(x) eq 0. then return,x
xx=x ne 0
a=search2d(xx,kx,ky,1,1)
if (size(a))(0) eq 1 then begin
ix=bytarr(sx(1),sx(2)) & ix(a)=1 & ix=1b-ix
l=label_region(ix)
ix=x or (l gt 1)
return,ix
endif else return,xx
end
FIND_FIRST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
FIND_FIRST
Find the first element ne 0
for the last dimension an initial value can be given
to reduce search time
function find_first,a,init
if n_params() eq 1 then init=0
sa=size(a)
case sa(0) of
1: begin
w=where(a(init:*),cw)
if cw eq 0 then return,-1 $
else return,[init+w(0)]
end
2: begin
w=where(a(*,init:*),cw)
if cw eq 0 then return,-1 $
else return,[w(0) mod sa(1),init+w(0)/sa(1)]
end
3: begin
while total(a(*,*,init)) eq 0.0 do $
if init eq sa(3)-1 then return,-1 $
else init=init+1
return,[find_first(a(*,*,init)),init]
end
else:return,-1
endcase
end
GEN_MASK
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
GEN_MASK
PURPOSE:
Generation of an image mask less or equal thr connected
at coordinate kx,ky
The result is filled and morphologically closed
CATEGORY:
CALLING SEQUENCE:
Result = GEN_MASK( Bild, Thr, Kx, Ky)
INPUTS:
Bild: Image
Thr: Threshold
Kx: x-Coordinate (if kx<=0 default=center)
Ky: y-Coordinate (if ky<=0 default=center)
OUTPUTS:
Result:Byte (logical) image
PROCEDURE:
EXAMPLE:
F = GEN_MASK(...)
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
GEN_SCHW
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
gen_schw
pro gen_schw,prae,na,param,head,feat,anf,_extra=disp,NEW=new
anz=get_num(na,prae,new=new)-1
bild=read_dtp(na)
if anf lt anz then ifeat=fltarr(256) else ifeat=feat(anz)
n_schw,na,bild,param,ifeat,_extra=disp,erg_ch=erg_ch
ifeat(0)=float(anz+1)
feat(anz) = ifeat
ihead=lonarr(256) & ihead(*)=head(0)
if ihead(0) le anz then begin
ihead(0)=anz+1
head(0) = ihead
end
print,erg_ch,na,byte(feat(1,anz))
end
GET_DEVICES
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
GET_DEVICES
PURPOSE:
Get all available devices and return them in a string array
CATEGORY:
Utilities
CALLING SEQUENCE:
devices = get_devices()
OUTPUTS:
Returnes a string array.
If there was no device found or not an applicable os_family
[''] is returned.
RESTRICTIONS:
Only for Windows, OpenVMS and unix machines
vms: Result of 'show device d' is interpreted
unix: Result of 'df -P' is interpreted
Windows:External routine DIREXIST used, written from PMW,
found in news
MODIFICATION HISTORY:
Wed Jul 16 11:35:35 1997, Karsten Rodenacker
<iliad@janus.gsf.de>
GET_NUM
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
get_num
CALLING SEQUENCE:
Result = get_num( Name[, Prefix][, /NEW])
PROCEDURE:
Extracts from a number from a file name
If /NEW is specified no prefix is used
EXAMPLE:
print,get_num('[iliad.iidl]tra005.cel','tra') results in 5
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
function get_num,na,pr,NEW=new
if !version.os ne 'vms' then sel='/' else sel=']'
if n_params() lt 2 then begin
i=rstrpos(na,'.')
if i eq -1 then anz=long(strmid(na,strlen(na)-3,strlen(na))) $
else anz=long(strmid(na,i-3,i-1))
endif else if not keyword_set(new) then $
anz=long(strmid(na,rstrpos(na,sel)+1+strlen(pr),3)) $
else anz=long(strmid(na,rstrpos(na,sel)+1,3))
return,anz
end
GET_PROJECT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
get_project
function get_project,name, RELATION=rel, APPENDIX=app, $
RESULT=ot, VERBOSE=verbose
if not keyword_set(rel) then rel='='
if not keyword_set(app) then app=''
com1='sql SELECT PNUM,PNAME FROM PROJECT'
if n_params() ne 0 then begin
com2=' WHERE (PNAME '+rel+' "'+strupcase(name)+'")'
endif else com2=''
if !version.os_family eq 'vms' then $
com=com1+com2+" "+app+";" $
else com="rsh nviss '"+com1+com2+" "+app+";'"
if keyword_set(verbose) then print,com
spawn,com,t,count=st
if !version.os_family eq 'vms' then offs=1 else offs=2
if st gt 0 then begin
if keyword_set(verbose) then for i=0,st-1 do print,t(i)
l=str_sep(t(st-offs),' ')
anz=long(l(0))
if anz eq 0 then ot=0 else ot=t(st-offs-anz:st-3)
return,anz
endif else return,0
end
GET_SPECIMEN
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
get_specimen
function get_specimen,name, sname, RELATION=rel, SRELATION=srel, $
APPENDIX=app, RESULT=ot, VERBOSE=verbose
if not keyword_set(rel) then rel='='
if not keyword_set(srel) then srel='='
if not keyword_set(app) then app=''
com1='sql SELECT SPECIMEN.PNUM,SPECIMEN.SNUM,SPECIMEN.SNAME,SPECIMEN.VOLUME FROM SPECIMEN,PROJECT'
if n_params() gt 0 then begin
com2=' WHERE PROJECT.PNUM = SPECIMEN.PNUM and (PROJECT.PNAME '+rel+' "'+ $
strupcase(name)+'" and SPECIMEN.VOLUME STARTING WITH "ISS" '
if n_params() gt 1 then $
com2=com2+' and SPECIMEN.SNAME '+srel+' "'+strupcase(sname)+'")'
endif else com2=''
if !version.os_family eq 'vms' then $
com=com1+com2+" "+app+";" $
else com='rsh nviss '+"'"+com1+com2+" "+app+";'"
if keyword_set(verbose) then print,com
spawn,com,t,count=st
if !version.os_family eq 'vms' then offs=1 else offs=2
if st gt 0 then begin
if keyword_set(verbose) then for i=0,st-1 do print,t(i)
l=str_sep(t(st-offs),' ')
anz=long(l(0))
if anz eq 0 then ot=0 else ot=t(st-offs-anz:st-offs-1)
return,anz
endif else return,0
end
G_THR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
G_THR
PURPOSE:
Calculation of an adequate simple threshold
using GAUSSFIT for modelling the distribution
CATEGORY:
Image processing
CALLING SEQUENCE:
thr = G_THR(Hist, Faksd,
DISPLAY=display, SMOOTH=smooth)
INPUTS:
Hist: Frequency histogram
Faksd: Factor of Gauss-width
KEYWORD PARAMETERS:
DISPLAY: Draw thresholds and histogram
SMOOTH: Smooth size of Histogram (default=5)
OUTPUTS:
Result is a float array M according GAUSSFIT with two thresholds
OPTIONAL OUTPUTS:
Display of histogram and results
PROCEDURE:
MODIFICATION HISTORY:
Written by: K. Rodenacker, 23.06.95
function g_thr,h,faksd,display=disp,smooth=smooth
h0=h
if not keyword_set(smooth) then smooth=0
if smooth gt 2 then hs=smooth(h0,smooth) else hs=h0
hs((size(h0))(1)-1)=0
x=findgen((size(hs))(1))
yf=gaussfit(x,hs,ga)
thr=ga(1)-faksd*ga(2)
thr2=-ga(4)/(2.*ga(5)) ; Abbleitung des quadratischen Termes
if keyword_set(disp) then begin
cred=thecolor('red') & cgreen=thecolor('green') & cblue=thecolor('blue')
plot,x,hs,psym=10
oplot,x,yf,col=cred
oplot,[thr,thr],[0,2.*yf(thr)],col=cred
oplot,[thr2,thr2],[0,yf(thr2)],col=cblue
end
return,[float(thr),float(thr2),ga]
end
HISTO_LIST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
histo_list
HIST_PLOT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
hist_plot
pro hist_plot,h,kx,ky,m,xsize=xs,ysize=ys,_extra=x
pos=!p.region
dx=127 & dy=127
if keyword_set(xs) then dx=xs
if keyword_set(ys) then dy=ys
!p.region=[kx,ky,kx+dx,ky+dy]
g=findgen(n_elements(h))
plot,g,h,xstyle=5,ystyle=4,/device,/noerase,psym=10
if n_params() gt 3 then $
oplot,g,deriv(gaussint((g-m(1))/m(2)))*m(0),_extra=x
!p.region=pos
end
INT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
INT
function int,n
return,long(n)
end
INT_D_THR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
INT_D_THR
Interactive segmentation of mouse selected objects
with Meyer Program ISOLIEREN_1
function int_d_thr,a0,WIN_SIZE=win_size,IFLMAX=iflmax,$
WINDOW=win_nr
Result: Label image
WIN_SIZE Subwindow size/2
IFLMAX minimum Area
if not keyword_set(win_nr) then win_nr=0
if not keyword_set(win_size) then win_size=0
if not keyword_set(iflmax) then iflmax=0
a=a0
si=size(a)
wset,win_nr
tvlct,255,0,0,0
curs_1=132
curs_2=20
erase
tv,a
erw=0
b=a & b(*,*)=0
c=fix(a) & c(*,*)=0
if win_size eq 0 then win_size=max(si(1:2))
device,cursor_standard=curs_1
cursor,x,y,/dev,/down
lab=0
while !err ne 4 do begin
l=x-win_size > 0 & r=x+win_size-1 < si(1)-1
u=y-win_size > 0 & o=y+win_size-1 < si(2)-1
para=replicate(-1.,9)
if iflmax gt 0 then para(5)=iflmax
if erw gt 0 then para(6)=erw
para(7)=x-l & para(8)=y-u
suba=a(l:r,u:o)
thr=d_thr_n(suba,para,erg,/inv)
if thr gt 0 then begin
device,cursor_standard=curs_2
m0=suba lt byte(thr)
m1=select(m0,fix(erg(0)),fix(erg(1)))
m2=fill_sel(m1,fix(erg(0)),fix(erg(1)))
b(l:r,u:o)=b(l:r,u:o) or m2
a(l:r,u:o)=a(l:r,u:o)*(1b-b(l:r,u:o))
lab=lab+1
c(l:r,u:o)=c(l:r,u:o)*(1b-m2) + m2*lab
device,cursor_standard=curs_1
endif
tv,a(l:r,u:o),l,u
cursor,x,y,/dev,/down
endwhile
device,cursor_standard=34
return,c
end
I_CDTP
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
I_CDTP
PURPOSE:
Displays DTP-Image files
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
I_CDTP, name_arr, Pos, Drawable
INPUTS:
Name_arr:Image file name array
Pos: Number of next displayed image file in Name_arr
Drawable:window number
OUTPUTS:
Pos: New actual Number of image file in Name_arr
KEYWORDS:
MASK: Bitplane 0 is displayed with exor and mask
SMASK: extension.plane
Bitplane plane from dtp-file.extension is displayed
with exor and mask
ZOOM: Zoom size, default is 1
ORDER: Reverse display order (see TV)
NONAME: No name printing in the display
KX: X Start position for the next image inside the Window
KY: Y Start position for the next image inside the Window
MODIFICATION HISTORY:
Written by: K. Rodenacker, 10.10.95.
Modified by: K. Rodenacker, 08.11.95.
LABEL_SW
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
label_sw
PURPOSE:
Estimation of centroid coordinates from label image
CATEGORY:
Image processing
CALLING SEQUENCE:
Result = label_sw(Label_image, VERTICAL=vert)
INPUTS:
Label_image = Labeled image (integer/byte/long)
KEYWORD PARAMETERS:
VERTICAL = true / false (def.)
OUTPUTS:
Vector of coordinates in x-direction (def.)
in y-direction (/VERTICAL)
MODIFICATION HISTORY:
Written by: K. Rodenacker, 08, Feb 1994.
LIN_CURSOR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
LIN_CURSOR
PURPOSE:
Emulate the operation of a variable-sized line cursor (also known as
a "marquee" selector).
CATEGORY:
Interactive graphics.
CALLING SEQUENCE:
LIN_CURSOR, x0, y0, ra, ang [, INIT = init] [, FIXED_SIZE = fixed_size]
INPUTS:
No required input parameters.
OPTIONAL INPUT PARAMETERS:
x0, y0, ra, ang give the initial location (x0, y0) and
length (ra) and orientation of the line if the keyword INIT is set.
Otherwise, the
line is initially drawn in the center of the screen.
KEYWORD PARAMETERS:
INIT: If this keyword is set, x0, y0, ra, ang contain the initial
parameters for the line.
FIXED_SIZE: If this keyword is set, ra, ang contain the initial
parameters of the line. They may not be changed by the user.
MESSAGE: If this keyword is set, print a short message describing
operation of the cursor
OUTPUTS:
x0: X value of lower left corner of box.
y0: Y value of lower left corner of box.
ra: length of line in pixels.
ang: angle of orientation [-180, 180]
COMMON BLOCKS:
None.
SIDE EFFECTS:
A line is drawn in the currently active window. It is erased
on exit.
RESTRICTIONS:
Works only with window system drivers.
PROCEDURE:
The graphics function is set to 6 for eXclusive OR. This
allows the line to be drawn and erased without disturbing the
contents of the window.
Operation is as follows:
Left mouse button: Move the line by dragging.
Middle mouse button: Resize the line by dragging.
Right mouse button: Exit this procedure, returning the
current line parameters.
MODIFICATION HISTORY:
DMS, April, 1990.
DMS, April, 1992. Made dragging more intutitive.
June, 1993 - Bill Thompson
prevented the box from having a negative size.
Rodenacker, Jan 1997 Move from ELL_... to LIN_...
LIST_TIFF
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
list_tiff
PURPOSE:
Listing of some tiff-file properties, namely planar type and
if it has a clsm header the date and time of gathering, x,y,z
sizes and the number of channels
CATEGORY:
Image I/O
CALLING SEQUENCE:
list_tiff,wildname
INPUTS:
wildname: (wild) filename
OPTIONAL INPUTS:
none
KEYWORD PARAMETERS:
TEST: For clsm tiff files the clsm header structure is listed
CLSM: VAriable to contain the last clsm header read
OUTPUTS:
Listing
OPTIONAL OUTPUTS:
none
COMMON BLOCKS:
noen
SIDE EFFECTS:
Using read_tiff with my changes to get some private tiff headers
RESTRICTIONS:
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Wed Aug 6 08:19:29 1997, Karsten Rodenacker
<iliad@janus.gsf.de>
M0M1M2
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
M0M1M2
PURPOSE:
Calculation of Sum, Mean and Standard deviation and more from a
frequency distribution
CATEGORY:
CALLING SEQUENCE:
Result = M0M1M2( Histogram[, /EXTREMA=anzahl][, /entropy])
KEYWORDS:
EXTREMA Minimum and maximum from histogram and
extrema for at least anzahl objects
ENTROPY Calculation of Entropy
INPUTS:
Histogram: 1-dim Array of frequencies
reflecting classes from 0 to N
OUTPUTS:
Result = Float array [M0, M1, M2, M3, M4, MOD
[,MED , MIN, MAX, MINx, MAXx]]
PROCEDURE:
m1 = Sum(x*h1(x))/M0 mis= Sum(x^i*h1(x)/M0
M0 = Total(h1) =n
M1 = Sum(x*h1(x))/M0 =m1s/n
M2 = Sum(x^2*h1(x)/M0 -M1^2) =m2s-m1s^2
M3 = =(m3s-3m1s*m2s+2*m1s^3)/M2^3
M4 = =(m4s-4*m1*m3s+6*m1^2*m2s-3*m1^4)/M2^4-3
nach Sachs Seite 84
Additional features can easily be calculated:
Sumofsq: x=total((h/M0)^2)
EXAMPLE:
F = M0M1M2(...)
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
function m0m1m2,h1,EXTREMA=anzahl,ENTROPY=entrop
nn=n_elements(h1)
h2=dindgen(nn)
m0=float(total(h1))
if m0 eq 0. then return,replicate(0.,12)
m1=double(total(h1*h2))/m0
m2s=double(total(h1*h2^2))/m0
m3s=double(total(h1*h2^3))/m0
m4s=double(total(h1*h2^4))/m0
m2=sqrt(m2s-m1^2)
if m2^3 ne 0. then m3=(m3s-3.0*m1*m2s+2.0*m1^3)/m2^3 else m3=0.
if m2^4 ne 0. then $
m4=(m4s - 4.0*m1*m3s + 6.0*m2s*m1^2 - 3.0*m1^4)/m2^4 - 3.0 $
else m4=0.
mdw=max(h1,md)
if keyword_set(anzahl) then begin
h2=h1
for i=0,nn-2 do h2(i+1)=h2(i)+h2(i+1)
mx=h2(nn-2)
h2(nn-1)=mx
minn=min(where(h2 gt 0))
maxn=min(where(h2 eq mx))
medi=min(where((h2 < mx/2) eq mx/2))
if anzahl gt 0 and m0 gt 2*anzahl then begin
minx=min(where(h2 gt anzahl))
maxx=min(where(h2 ge mx-anzahl))
if anzahl gt 2 then mdw=max(smooth(h1,anzahl),md)
endif else begin
minx=minn
maxx=maxn
endelse
mf=[m0,m1,m2,m3,m4,md,medi,minn,maxn,minx,maxx]
endif else mf=[m0,m1,m2,m3,m4,md]
if keyword_set(entrop) then begin
x=h1(where(h1 ne 0))/m0
ent=-total(x*alog(x)/alog(2))
mf=[mf,ent]
endif
return,mf
end
MAKE_NAME
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
make_name
CALLING SEQUENCE:
Result = make_name( Prefix, num)
KEYWORDS:
EXTENSION: image file extension
PROCEDURE:
Generates an image file name of the form 'prefix''num'
e.g.'tra005.cel'.
Some sort of inversion of GET_NUM
EXAMPLE:
print,make_name('[iliad.iidl]tra','5') results in
'[iliad.iidl]tra005.cel'
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Oct 1993.
function make_name,pref,num,EXTENSION=ext
if not keyword_set(ext) then ext='cel'
return,pref+strtrim(string(num,format='(I3.3)'),2)+'.'+ext
end
MASK_UTIL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MASK_UTIL
pro mask_util,iproj,idev,oproj,odev,spec, $
SMASK=smask,NEW=new,NOOVER=noover,DISPLAY=disp
Liest Graubild mit MAske in bit 0 von iproj,idev,spec
und schreibt das Graubild mit Maskenfile nach oproj,odev,spec
SMASK="extension.plane" oder 1..8 fuer "cem.0".."cem.7" (default=1)
NEW =New file names (default=0)
NOOVER=Vorhandene Files werden nicht ueberschrieben
if not keyword_set(smask) then smask=1
if not keyword_set(new) then new=0
if not keyword_set(noover) then noover=0
if not dev_test(idev) then message,idev+' wrong device'
if not dev_test(odev) then message,odev+' wrong device'
ispra=make_praep(iproj,idev,spec,NEW=new)
ospra=make_praep(oproj,odev,spec,NEW=new)
ina=gen_name_arr(ispra,0)
iina=strmid(ina,0,rstrpos(ina,'001'))+'%%%.cel'
tina=findfile(iina,count=cina)
if cina eq 0 then message,'No image file found under '+iina $
else begin
ona=gen_name_arr(ospra,0)
odir=strmid(ona,0,strpos(ona,spec)-1)+']'
osdir=strmid(ona,0,strpos(ona,']')+1)
isdir=strmid(ina,0,strpos(ina,']')+1)
idir=strmid(ina,0,strpos(ina,spec)-1)+']'
iona=findfile(odir+spec+'.dir',count=cona)
if cona eq 0 then spawn,'create/dir '+osdir
if keyword_set(disp) then window,0,xs=256,ys=128
for i=0,cina-1 do begin
print,ina(i)
a=read_dtp(tina(i),kopf=ko)
t=a
get_mt,a,t,b
if keyword_set(disp) then begin
tv,t,0
tvscl,b,1
endif
ona=gen_name_arr(ospra,get_num(tina(i),spec,NEW=new)-1)
print,ona
write_dtp,ona,t,kopf=ko,mask=smask,bmask=b,noover=noover
endfor
wnam='w%%%.cel'
if not keyword_set(new) then wnam=spec+wnam
if not noover then begin
spawn,'copy/log '+isdir+wnam+' '+osdir
spawn,'copy/log '+idir+spec+'.pic '+odir
spawn,'copy/log '+idir+spec+'.pin '+odir
qna='$1$dia1:[iss.pin-files.'+iproj+']'+spec+'.pin'
qnaf=findfile(qna,count=cqnaf)
if cqnaf ne 0 then begin
spawn,'copy/log '+qna+' '+odir
spawn,'pur/log '+odir
endif
endif else begin
if not file_test(osdir+wnam) then $
spawn,'copy/log '+isdir+wnam+' '+osdir
if not file_test(odir+spec+'.pic') then $
spawn,'copy/log '+idir+spec+'.pic '+osdir
if not file_test(odir+spec+'.pin') then $
spawn,'copy/log '+idir+spec+'.pin '+osdir
endelse
endelse
end
MM_AND
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_AND
function mm_and,a,b
return,b < a
end
MM_BORD
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_BORD
function mm_bord,a,n,VALUE=val,Z_FIRST=z_fir, ALL=all
if n_params() eq 1 then n=1
if not keyword_set(val) then val=0
sx=size(a)
e=a
case sx(0) of
1:begin
e([0,sx(1)-1])=val
end
2:begin
wx=[indgen(n),sx(1)-indgen(n)-1]
wy=[indgen(n),sx(2)-indgen(n)-1]
e(wx,*)=val & e(*,wy)=val
end
3:begin
if keyword_set(z_fir) then begin
wx=[indgen(n),sx(2)-indgen(n)-1]
wy=[indgen(n),sx(3)-indgen(n)-1]
e(*,wx,*)=val & e(*,*,wy)=val
if keyword_set(all) then begin
e[0:n-1,*,*]=val
e[sx[1]-n:sx[1]-1,*,*]=val
endif
endif else begin
wx=[indgen(n),sx(1)-indgen(n)-1]
wy=[indgen(n),sx(2)-indgen(n)-1]
e(wx,*,*)=val & e(*,wy,*)=val
if keyword_set(all) then begin
e[*,*,0:n-1]=val
e[*,*,sx[3]-n:sx[3]-1]=val
endif
endelse
end
4:begin ; first coordinate not considered
if keyword_set(z_fir) then begin
wx=[indgen(n),sx(3)-indgen(n)-1]
wy=[indgen(n),sx(4)-indgen(n)-1]
e(*,*,wx,*)=val & e(*,*,*,wy)=val
if keyword_set(all) then begin
e[*,0:n-1,*,*]=val
e[*,sx[1]-n:sx[1]-1,*,*]=val
endif
endif else begin
wx=[indgen(n),sx(2)-indgen(n)-1]
wy=[indgen(n),sx(3)-indgen(n)-1]
e(*,wx,*,*)=val & e(*,*,wy,*)=val
if keyword_set(all) then begin
e[*,*,*,0:n-1]=val
e[*,*,*,sx[1]-n:sx[1]-1]=val
endif
endelse
end
else:
endcase
return,e
end
MM_BORD_D, LABELBILD, RAND=X
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_BORD_D, labelbild, RAND=x
deletes objects at border in place
for 3d objects only at first two dim.
pro mm_bord_d,lb,RAND=rd
if not keyword_set(rd) then rd=2
si=size(lb)
case si(0) of
2: begin
hh=[reform(lb(0:rd-1,*),rd*si(2)), $
reform(lb(si(1)-rd:si(1)-1,*),rd*si(2)), $
reform(lb(*,0:rd-1),rd*si(1)), $
reform(lb(*,si(2)-rd:si(2)-1),rd*si(1))]
end
3: begin
hh=[reform(lb(0:rd-1,*,*),rd*si(2)*si(3)), $
reform(lb(si(1)-rd:si(1)-1,*,*),rd*si(2)*si(3)), $
reform(lb(*,0:rd-1,*),rd*si(1)*si(3)), $
reform(lb(*,si(2)-rd:si(2)-1,*),rd*si(1)*si(3))]
end
else: Message,'MM_BORD_D not implemented for dim.'+string(byte(si(0)))
endcase
ihh=hh(sort(hh))
thh=ihh(uniq(ihh))
if n_elements(thh) gt 1 then $
for i=1,n_elements(thh)-1 do lb=lb*(lb ne thh(i))
end
MM_CENTRE
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_centre
function mm_centre,a,b,c
forward_function mm_or, mm_and
return,mm_or(mm_or(mm_and(a,b),mm_and(a,c)),mm_and(b,c))
end
MM_DIL_N
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_DIL_N
2-dim: BYTE, INT, LONG not in place
Function value is returned
3-dim: only BYTE in place
Parameter is modified, -1 is returned
function mm_dil_n,a,n
if n_params() eq 1 then n=1
sa=size(a)
if sa(1+sa(0)) gt 3 then message,'Neither BYTE, INT nor LONG !'
case sa(0) of
2:begin
if n ge 0 then begin
ste=[[0,1,0],[1,1,1],[0,1,0]]
qua=[[1,1,1],[1,1,1],[1,1,1]]
endif else begin
squa=[[1,1],[1,1]]
if n eq -1 then kx=0 else kx=1
endelse
b=a
if n eq 0 then return,b
case sa(1+sa(0)) of
1:begin
if n lt 0 then b=dilate(temporary(b),squa,kx,kx,/gr) $
else for i=0,n-1 do $
if i and 1 then b=dilate(temporary(b),qua,/gr) $
else b=dilate(temporary(b),ste,/gr)
return,b
end
else:begin
for i=0,n-1 do $
if i and 1 then b=dilate_32(temporary(b),qua) $
else b=dilate_32(temporary(b),ste)
return,b
end
endcase
end
3:begin
if sa(1+sa(0)) ne 1 then message,'Not BYTE for 3-dim !'
if n gt 0 then begin
ste=[[[0,0,0],[0,1,0],[0,0,0]], $
[[0,1,0],[1,1,1],[0,1,0]], $
[[0,0,0],[0,1,0],[0,0,0]]]
qua=[[[1,1,1],[1,1,1],[1,1,1]], $
[[1,1,1],[1,1,1],[1,1,1]], $
[[1,1,1],[1,1,1],[1,1,1]]]
endif else begin
squa=[[[1,1],[1,1]],[[1,1],[1,1]]]
if n eq -1 then kx=0 else kx=1
endelse
if n eq 0 then return,-1l
if n lt 0 then begin
a=dilate(temporary(a),squa,kx,kx,kx,/gr)
if kx eq 1 then a=shift(temporary(a),0,0,1)
endif else for i=0,n-1 do $
if i and 1 then a=dilate(temporary(a),qua,/gr) $
else a=dilate(temporary(a),ste,/gr)
return,-1l
end
else: message,'Dimension not implemented !'
endcase
end
MM_DIST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_DIST
PURPOSE:
Generates the distance function of a binary image
CATEGORY:
Mathematical morphology
CALLING SEQUENCE:
result = mm_dist(image)
INPUTS:
image: 2d- or 3d- byte array
OPTIONAL INPUTS:
none
KEYWORD PARAMETERS:
RADIUS: For 3d- images: radius of successive erosions
VERBOSE: For 3d- images: print of actual repetition
DISPLAY: For 3d- images: display of one section at actual repetition
OUTPUTS:
result: distance transform: each pixel value represents the minimum
distance to the background
image: for 3-d the image is binarized (image = image GE 0)
OPTIONAL OUTPUTS:
none
COMMON BLOCKS:
none
SIDE EFFECTS:
none
RESTRICTIONS:
For 2-d images procedure DISTPN is applied
For 3-d images for erosion function MM_DIL_N is applied on inverted input
PROCEDURE:
For 2-d images procedure DISTPN is applied.
For 3-d images the input is binarized (input GE 0) and successive erosions
are added up to the input image is zeroed.
EXAMPLE:
2-d:
a = bytarr(128,128)
a[32:96,32:96] = 1B
b = mm_dist(a)
3-d:
a = bytarr(128,128,128)
a[32:96,32:96,32:96] = 1b
b = mm_dist(a)
MODIFICATION HISTORY:
Fri Jul 11 08:43:46 1997, Karsten Rodenacker
<iliad@janus.gsf.de>
FUNCTION mm_dist,a,RADIUS=rad,VERBOSE=verb,DISPLAY=disp
IF NOT keyword_set(rad) THEN rad=1
IF rad LT 0 THEN rad = -1
sa=size(a)
a=temporary(a) NE 0b
IF min(sa(1:3)) LE 256 THEN b=a $
ELSE b=fix(a)
CASE sa(0) OF
3:BEGIN
j=0
WHILE max(a) NE 0 DO BEGIN
a=1b-temporary(a)
x=mm_dil_n(a,rad)
a=mm_bord(temporary(a),1,val=1)
a=1b-temporary(a)
b=b+a
j=j+1
IF keyword_set(disp) THEN tvscl,b[*,*,sa[3]/2]
IF keyword_set(verb) THEN print,j*rad,format='($,i3)'
IF rad EQ -1 THEN rad=-2 ELSE IF rad EQ -2 THEN rad=-1
ENDWHILE
IF keyword_set(verb) THEN print,' '
return,b
END
ELSE:return,distpn(a NE 0)
ENDCASE
END
MM_ERO_N
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_ERO_N
2-dim: BYTE, INT, LONG not in place
function value is returned, parameter is not mod.
3-dim: only BYTE in place
parameter is modified, function value is -1
function mm_ero_n,a,n
if n_params() eq 1 then n=1
sa=size(a)
if sa(1+sa(0)) gt 3 then message,'Neither BYTE, INT nor LONG !'
case sa(0) of
2-dim
2:begin
if n ge 0 then begin
ste=[[0,1,0],[1,1,1],[0,1,0]]
qua=[[1,1,1],[1,1,1],[1,1,1]]
endif else begin
squa=[[1,1],[1,1]]
if n eq -1 then kx=0 else kx=1
endelse
b=a
if n eq 0 then return,b
case sa(1+sa(0)) of
1:begin
if n lt 0 then b=erode(temporary(b),squa,kx,kx,/gr) $
else for i=0,n-1 do $
if (i and 1) eq 1 then b=erode(temporary(b),qua,/gr) $
else b=erode(temporary(b),ste,/gr)
return,b
end
else:begin
for i=0,n-1 do $
if (i and 1) eq 1 then b=erode_32(temporary(b),qua) $
else b=erode_32(temporary(b),ste)
return,b
end
endcase
end
3-dim
3:begin
if sa(1+sa(0)) ne 1 then message,'Only BYTE for 3-dim !'
if n gt 0 then begin
ste=[[[0,0,0],[0,1,0],[0,0,0]], $
[[0,1,0],[1,1,1],[0,1,0]], $
[[0,0,0],[0,1,0],[0,0,0]]]
qua=[[[1,1,1],[1,1,1],[1,1,1]], $
[[1,1,1],[1,1,1],[1,1,1]], $
[[1,1,1],[1,1,1],[1,1,1]]]
endif else begin
squa=[[[1,1],[1,1]],[[1,1],[1,1]]]
if n eq -1 then kx=0 else kx=1
endelse
if n eq 0 then return,-1
if n lt 0 then begin
a=erode(temporary(a),squa,kx,kx,kx,/gr)
if kx eq 1 then a=shift(temporary(a),0,0,1)
endif else for i=0,n-1 do $
if (i and 1) eq 1 then a=erode(temporary(a),qua,/gr) $
else a=erode(temporary(a),ste,/gr)
return,-1
end
else: message,'Dimension not implemented !'
endcase
end
MM_FILL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_FILL
function mm_fill,x
ix=x
n=where(ix eq 0)
ix(where(ix ne 0))=1
e=ix
e(*,*)=0
sx=size(x)
kx=n(0) mod sx(1)
ky=n(0) / sx(1)
a=search2d(ix,kx,ky,0,0)
e(a)=1
e=e xor (1 - x)
return,e or x
end
MM_FILL_S
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_FILL_S
function mm_fill_s,x
ix=label_region(1b-x)
ihm=max(histogram(ix*(x eq 0b)),ikl)
return,mm_bord(byte(ix ne ikl))
end
MM_OR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_OR
function mm_or,a,b
return,b > a
end
MM_OUV_N
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_OUV_N
function mm_ouv_n,a,n
forward_function mm_ero_n, mm_dil_n
if n_params() eq 1 then n=1
if (size(a))(0) ne 3 then return,mm_dil_n(mm_ero_n(a,n),n) $
else begin
t=mm_ero_n(a,n) & t=mm_dil_n(a,n) & return,-1l
endelse
end
MM_RAND
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_RAND
function mm_rand,a,n,outer=out
if n_params() eq 1 then n=1
sa=size(a)
if sa(1+sa(0)) gt 3 then message,'Neither BYTE, INT nor LONG !'
case sa(0) of
2:begin
if keyword_set(out) then $
return,mm_dil_n(a,n)-a $
else $
return,a-mm_ero_n(a,n)
end
3:begin
if sa(1+sa(0)) ne 1 then message,'Not BYTE for 3-dim !'
b=a
if keyword_set(out) then begin
t=mm_dil_n(b,n)
a=b-temporary(a)
endif else begin
t=mm_ero_n(b,n)
a=temporary(a)-b
endelse
return,-1
end
else:return,-2
endcase
end
MM_SELE
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_SELE
function mm_sele,x,kx,ky
sx=size(x)
e=x
e(*,*)=0
if kx lt sx(1) and ky lt sx(2) then begin
a=search2d(x,kx,ky,x(kx,ky),x(kx,ky))
e(a)=1
endif
return,e
end
MM_TOP_HAT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MM_TOP_HAT
function mm_top_hat,a,rad,thr,INVERS=inv
forward_function mm_fer_n, mm_ouv_n
sa = size(a)
if sa(0) gt 2 then begin
tmp_a = a
if keyword_set(inv) then begin
t = mm_fer_n(tmp_a, rad)
tmp_a = temporary(tmp_a) - a
endif else begin
t = mm_ouv_n(tmp_a, rad)
tmp_a = a - temporary(tmp_a)
endelse
if n_params() gt 2 then return, mm_bord(temporary(tmp_a), rad) gt thr $
else return, mm_bord(temporary(tmp_a), rad)
endif else begin
if keyword_set(inv) then t=mm_fer_n(a, rad)-a else t=a-mm_ouv_n(a, rad)
if n_params() gt 2 then return, mm_bord(t, rad) gt thr $
else return, mm_bord(t, rad)
endelse
end
MSK
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
MSK
PURPOSE:
Compute the number and optionally mean, standard deviation
and skewness of any array.
CATEGORY:
G1- Simple calculations on statistical data.
CALLING SEQUENCE:
Result = MSK(Array [, Mean [,Std [,Kurtosis [,Min [,Max]]]]])
INPUTS:
Array: The data array. Array may be any type except string.
OUTPUTS:
MSK returns the number of elements
OPTIONAL OUTPUT PARAMETERS:
Std: standard deviation (sample variance)
Mean: Upon return, this parameter contains the mean of the values
in the data array.
Skewness:Upon return, this parameter contains the kurtosis of the values
in the data array.
Min: Minimum value
Max: Maximum value
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
Mean = TOTAL(Array)/N_ELEMENTS(Array)
Std = SQRT(TOTAL((Array-Mean)^2/(N-1)))
Skewness = TOTAL((Array-Mean)^3/(N.Std^3)
Max = Max (Array, MIN=Min)
MODIFICATION HISTORY:
DMS, RSI, Sept. 1983.
Function MSK, Array, Mean,Std,Skewness,Min,Max
on_error,2 ;return to caller if error
n = n_elements(array) ;# of points.
if n le 2 then message, 'Number of data points must be > 1'
mean = total(array)/n ;yes.
std = sqrt(total((array-mean)^2)/(n-1))
skewness = total((array-mean)^3)/(n * std^3)
max = MAX (array, MIN=min)
return,n
end
NS_MULT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
NS_MULT
function ns_mult,f,p_len,level,skip,tag
sf=size(f)
im=fltarr((sf(1)-p_len*2)/skip,(2*(sf(2)-p_len*2)/skip))
sim=size(im)
meth=[0B,0B,1B,1B,1B,1B,1B,1B]
case !version.os of
'vms': i=call_external('ns_share1','find_feat_2', $
f,im,skip*sim(2)/2,skip*sim(1), $
long(2*p_len+1), long(level), long(skip), long(tag), $
value=meth, $
default=filepath('ns_share1.exe', $
root=!idl_basiss,subd=['rod',!version.os]))
'hp-ux': i=call_external(filepath('ns_share1.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'find_feat_2', $
f,im,skip*sim(2)/2,skip*sim(1), $
long(2*p_len+1), long(level), long(skip), long(tag), $
value=meth)
'IRIX': i=call_external(filepath('ns_share1.so', $
root=!idl_basiss,subd=['rod',!version.os]), $
'find_feat_2', $
f,im,skip*sim(2)/2,skip*sim(1), $
long(2*p_len+1), long(level), long(skip), long(tag), $
value=meth)
'Win32': i=call_external(filepath('ns_share1.dll', $
root=!idl_basiss,subd=['rod',!version.os]), $
'find_feat_2', $
f,im,skip*sim(2)/2,skip*sim(1), $
long(2*p_len+1), long(level), long(skip), long(tag), $
value=meth)
else:message,'find_feat_2 not implemented on '+!version.os
endcase
return,im
end
NS_PADD
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
NS_PADD
function ns_padd,im,p_len
sim=size(im)
f=make_array(sim(1)+p_len*2,sim(2)+p_len*2,/byte)
sf=size(f)
f(p_len:sf(1)-p_len-1,p_len:sf(2)-p_len-1)=im(*,*)
f(p_len:sf(1)-p_len-1,0:p_len)=rotate(im(0:sim(1)-1,0:p_len),7)
f(p_len:sf(1)-p_len-1,sf(2)-p_len:sf(2)-1)= $
rotate(im(0:sim(1)-1,sim(2)-p_len:sim(2)-1),7)
f(0:p_len-1,0:sf(2)-1)=rotate(f(p_len:p_len*2-1,0:sf(2)-1),5)
f(sf(1)-p_len:sf(1)-1,0:sf(2)-1)= $
rotate(f(sf(1)-2*p_len:sf(1)-p_len-1,0:sf(2)-1),5)
return,f
end
N_SCHW
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
N_SCHW
pro n_schw,na,bild,param,ifeat,MASK=mask,DISPLAY=disp,ERG_CH=erg_ch
if not keyword_set(mask) then mask=0
if keyword_set(disp) then begin
tv,bytarr(256,384),0,0 & !p.multi=[1,1,3,0,0] & tv,bild,0
endif
erg_ch='*'
case param.thre.thsv of
1: begin ; My simple threshold
hi=histogram(bild)
ifeat(1)=float(round(s_thr(hi, $
param.thre.thss,param.thre.thsa,param.thre.thsf, $
display=disp)))
ifeat(2)=ifeat(1)
ifeat(6)=0. & ifeat(7)=0.
fail=0 & binb=0
end
2: begin ; Gaussian threshold
hi=histogram(bild)
ifeat(1)=float(round(g_thr(hi, $
param.thre.thsf, smooth=param.thre.thss, $
display=disp)))
ifeat(2)=ifeat(1)
ifeat(6)=0. & ifeat(7)=0.
fail=0 & binb=0
end
3: begin ; Gaussian threshold and cluster
hi=histogram(bild)
ifeat(1)=float(round(g_thr(hi, $
param.thre.thsf, smooth=param.thre.thss, $
display=disp)))
ifeat(2)=ifeat(1)
ifeat(6)=0. & ifeat(7)=0.
bina=ns_clust(b2fl(smooth(bild,3)),2,1,1)
binb=fill(fer(select(bina,64,64)))
fail=0
end
-1: begin
para=fltarr(9) & para(*)=-1. & para(5)=100.
erge=fltarr(11) & erge(*)=0.
binb=0
ifeat(1)=float(d_thr(bild,255,para,erge))
if ifeat(1) gt 0. then begin
erg_ch=' '
print,format='($," ")'
ifeat(2)=ifeat(1)
ifeat(6)=erge(5)& ifeat(7)=erge(3)
ifeat(8)=erge(1)& ifeat(9)=erge(2)
ifeat(10)=erge(3)& ifeat(11)=erge(4)
ifeat(12)=erge(0)
fail=0
Manchmal erfuellt der Startpunkt der gefundenen Maske nicht die
Schwellbedingung, anscheinend ein Fehler in D_THR. In diesem Fall
veraendere ich das Bild.
if bild(ifeat(6),ifeat(7)) gt ifeat(1) then $
bild(ifeat(6),ifeat(7))=ifeat(1)
endif else begin
ifeat(2)=0.
ifeat(6)=0. & ifeat(7)=0.
hi=histogram(bild)
ifeat(1)=float(round(s_thr(hi, $
param.thre.thss,param.thre.thsa,param.thre.thsf, $
display=disp)))
if param.thre.thsr then begin
erg_ch='*'
print,format='($,"*")'
binb=byte(bild le byte(ifeat(1)))
endif else begin
erg_ch='C'
print,format='($,"C")'
bina=ns_clust(b2fl(smooth(bild,3)),2,1,1)
binb=fill(fer(select(bina,64,64)))
endelse
if keyword_set(disp) then tvscl,binb,1
fail=1
endelse
end
-2: begin
para=fltarr(9) & para(*)=-1. & para(5)=100.
erge=fltarr(11) & erge(*)=0.
binb=0
ifeat(1)=float(d_thr_n(bild,para,erge,/inv))
if ifeat(1) gt 0. then begin
erg_ch=' '
print,format='($," ")'
ifeat(2)=ifeat(1)
ifeat(6)=erge(0)& ifeat(7)=erge(1)
ifeat(4)=erge(4)
fail=0
Manchmal erfuellt der Startpunkt der gefundenen Maske nicht die
Schwellbedingung, anscheinend ein Fehler in D_THR. In diesem Fall
veraendere ich das Bild.
if bild(ifeat(6),ifeat(7)) gt ifeat(1) then $
bild(ifeat(6),ifeat(7))=ifeat(1)
endif else begin
ifeat(2)=0.
ifeat(6)=0. & ifeat(7)=0.
hi=histogram(bild)
ifeat(1)=float(round(s_thr(hi, $
param.thre.thss,param.thre.thsa,param.thre.thsf, $
display=disp)))
if param.thre.thsr then begin
erg_ch='*'
print,format='($,"*")'
binb=byte(bild le byte(ifeat(1)))
endif else begin
erg_ch='C'
print,format='($,"C")'
bina=ns_clust(b2fl(smooth(bild,3)),2,1,1)
binb=fill(fer(select(bina,64,64)))
endelse
if keyword_set(disp) then tvscl,binb,1
fail=1
endelse
end
else:message,'Threshold method not defined'
end
if param.thre.thsm or keyword_set(mask) then begin
Bildmaske mit abspeichern
if (ifeat(2) ne 0.) and not fail and typeof(binb,/dim) eq 0 then $
binb=gen_mask(bild,ifeat(1),ifeat(6),ifeat(7)) $
else if not param.thre.thsr then begin
bina=zerleg(binb,/water)
binb=fer(select(bina,64,64))
endif
if keyword_set(disp) then tvscl,binb,1
update_dtp,na,long(ifeat(1)),binb,MASK=mask
endif else begin
Nur Schwelle in Kopf abspeichern
binb=bild le byte(ifeat(1))
update_dtp,na,long(ifeat(1))
end
if keyword_set(disp) then tvscl,binb,1
end
OUV
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
OUV
function ouv,x,STERN=ste
if not keyword_set(ste) then st_e=[[1,1,1],[1,1,1],[1,1,1]] $
else st_e=[[0,1,0],[1,1,1],[0,1,0]]
return,dilate(erode(x,st_e,/gr),st_e,/gr)
end
P2A
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
P2A
function p2a,a
h=erode(a,[[0,1,0],[1,1,1],[0,1,0]])
return,(total(a-h))^2/(total(a)*4.0*!pi)
end
PARSE_FN
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
PARSE_FN
Parses filenames and returns the list of dirctories and
the filename if there is any
function parse_fn,fn,NUMBER=num,FILENAME=filen,DIR_ONE=dirone
case !version.os_family of
'vms': begin
del='[.]' & dele=']'
end
'Windows': begin
del='\' & dele='\'
end
else: begin
del='/' & dele='/'
end
endcase
x=rstrpos(fn,dele)
if x ge 0 then filen=strmid(fn,x+1,strlen(fn)-x) else filen=fn
if x gt 0 then fnn=strmid(fn,0,x+1) else fnn=''
if keyword_set(dirone) then begin
dirs=fnn & num=0
end else num=strparse(fnn,del,dirs)
return,dirs
end
PIC2CEL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
PIC2CEL
ILIAD PIC Images nach DTP-Images verwandeln
na = Full name without extension
ext = Extension without dot (default 'pic')
disp = Display of image(s)
pro pic2cel,na, extension=ext, display=disp
if not keyword_set(ext) then ext='pic'
if not keyword_set(disp) then disp=0
p=read_pic(na+'.'+ext)
sp=size(p)
if sp(0) gt 2 then begin
g=p(*,*,0)
m=p(*,*,1)
endif
if disp then begin
window,0,xs=(sp(0)-1)*sp(1),ys=sp(2)
tvscl,g,0
if sp(0) gt 2 then tvscl,m,1
endif
write_dtp,na+'.'+'cel',g
if sp(0) gt 2 then write_dtp,na+'.'+'cem',m
end
PLOT_H
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
PLOT_H
pro plot_h,data,BIN=bin,CLASS=clas,MIN=mn,MAX=mx, MNNULL=mnnull, MXNULL=mxnull, $
HISTOGRAM=h, VALUE=v, SUM=sum, NORM=norm, TOTAL=tot, $
OVER=over, VERBOSE=verb,_EXTRA=pp
if not keyword_set(mn) then $
if not keyword_set(mnnull) then mn=min(data) else mn=0.
if not keyword_set(mx) then $
if not keyword_set(mxnull) then mx=max(data) else mx=0.
if keyword_set(clas) then bin=(mx-mn)/clas $
else if not keyword_set(bin) then bin=1.0
h=histogram(data,bin=bin,min=mn,max=mx)
sh=size(h)
v=findgen(sh(1))*bin+mn
tot=total(h)
if keyword_set(norm) then h=float(h)/tot
if keyword_set(sum) then for i=1,sh(1)-1 do h(i)=h(i)+h(i-1)
if not keyword_set(over) then plot,v,h,_extra=pp, xrange=[mn,mx+bin] $
else oplot,v,h,_extra=pp
if keyword_set(verb) then print,sh(1),bin,mn,mx
end
PLOT_LIST
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
plot_list
PRO_UPDATE
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
PRO_UPDATE
pro pro_update,name,dir,NEU=neu,VERBOSE=verb
if keyword_set(neu) then dpro='pro_neu' else dpro='pro'
case !version.os of
'vms':begin
idir='idl$idl:['+dpro+'.'+dir+']'
itdir='idl$tidl:['+dpro+'.'+dir+']'
anz=6 & iverb=0
end
'IRIX':begin
idir='/IDL/pro_src/RODENA/'+dpro+'/'+dir+'/'
itdir='/usr/nviss1/iliad/idl/'+dpro+'/'+dir+'/'
anz=0 & iverb=1
end
else:message,'Not implemented'
endcase
spawn,'diff '+idir+name+'.pro '+itdir, res, count=cres
if iverb then print,name
if (cres gt anz) or keyword_set(verb) then $
for i=0,cres-1 do print,res(i)
end
RAND
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
RAND
function rand,a
if keyword_set(out) then $
return,dilate(a,[[0,1,0],[1,1,1],[0,1,0]])-a $
else $
return,a-erode(a,[[0,1,0],[1,1,1],[0,1,0]])
end
RAND_LOE
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
RAND_LOE
function rand_loe,bb,ONLY=only
ss=size(bb)
ibb=bb
ibb(0:*,0)=0 & ibb(0:*,ss(2)-1)=0
ibb(0,0:*)=0 & ibb(ss(1)-1,0:*)=0
if not keyword_set(only) then begin
for i=1,ss(1)-2 do if ibb(i,1) then ibb=ibb xor select(ibb,i,1)
for i=1,ss(1)-2 do if ibb(i,ss(2)-2) then ibb=ibb xor select(ibb,i,ss(2)-2)
for j=1,ss(2)-2 do if ibb(1,j) then ibb=ibb xor select(ibb,1,j)
for j=1,ss(2)-2 do if ibb(ss(1)-2,j) then ibb=ibb xor select(ibb,ss(1)-2,j)
endif
return,ibb
end
READ_DTP
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_DTP
PURPOSE:
Reads a DTP-Image file and returns the image
buffer (byte array)
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
Result = READ_DTP( name )
INPUTS:
Name: Full qualified image file name (string)
OUTPUTS:
Result: Array of image (byte)
KEYWORDS:
KOPF: Variable will contain the header information
MASK: Hint for reading additionally Mask image
extension and plane of mask (default="cem.0")
BMASK: Contains the mask image if it exists
EXAMPLE:
Bild = READ_DTP('/usr/users/iliad/nviss/test1/bild/sincos.cel')
MODIFICATION HISTORY:
Written by: K. Rodenacker, 20.7.93.
Modified 19.7.95
FUNCTION read_dtp, name, kopf=kopf, mask=mask, bmask=bmask
if !version.arch eq 'vax' then OPENR,u,name,/get_lun,default='.cel' $
else OPENR,u,name,/get_lun
a=BYTARR(512)
READU,u,a
b=where(a eq 0) & sb=size(b)
c=a
if sb(0) ne 0 then c(b)=32 ; Set binary zeros with spaces
if a(0) lt 65B or a(0) gt 68B then $
print,name,' Header corrupted !'
kopf=STRING(c)
sp=FIX(STRING(a(22:24)))
zl=FIX(STRING(a(25:27)))
if sp eq 0 or zl eq 0 then begin ; Trial to get image size if
fs=fstat(u) ; header is corrupted
sp=long(sqrt(fs.size - fs.cur_ptr))
zl=sp
print,name,' Image size from file size !'
endif
bild=bytarr(sp,zl,/NOZERO)
READU,u,bild
FREE_LUN,u
bmask=0
if keyword_set(mask) then begin
if type(mask) eq 2 then imsk='cem.'+string(mask-1) else imsk=mask
staa=str_sep(imsk,'.')
exte=strlowcase(staa(0))
if (size(staa))(1) lt 2 then plan=0 else plan=long(staa(1))
name2=strlowcase(name)
name2=strmid(name2,0,strpos(name2,'cel',rstrpos(name2,'.')))+exte
na=findfile(name2,cou=cna)
if cna ne 0 then bmask=(read_dtp(name2) and byte(2^plan)) gt 0b
endif
RETURN,bild
END
READ_IMA
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_IMA
PURPOSE:
Reads an IMA-Image file and returns the image
buffer (byte array)
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
Result = READ_IMA( name )
INPUTS:
Name: Full qualified image file name (string)
OUTPUTS:
Result: Array of image (byte)
EXAMPLE:
Bild = READ_IMA('/usr/users/iliad/nviss/test1/bild/sincos.ima')
MODIFICATION HISTORY:
Written by: K. Rodenacker, 20.9.93.
FUNCTION read_ima, name
ON_ERROR,2
OPENR,u,name,/get_lun
bild=MAKE_ARRAY(512,512,/BYTE,/NOZERO)
READU,u,bild
CLOSE,u
FREE_LUN,u
RETURN,bild
END
READ_PIC
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_PIC
PURPOSE:
Reads an ILIAD PIC-File and creates and loads an array of
appropriate type and size
CATEGORY:
Input/Output
CALLING SEQUENCE:
Result = READ_PIC(Name, HEAD=head, /PVC)
INPUTS:
Name: Name of ILIAD Pic File
OUTPUTS:
Result: array with data
KEYWORDS:
HEAD: File head lonarr(12)
PVC: Reads into Structure VC_FEATURE
SIDE EFFECTS:
Opens, reads and closes the file.
MODIFICATION HISTORY:
Written by: K.Rodencker, 14.10.93
Modified: 1.12.94
READ_PIC_RECORD
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_PIC_RECORD
PURPOSE:
Reads a record from an ILIAD PIC-File and creates and loads an
array of appropriate type and size
CATEGORY:
Input/Output
CALLING SEQUENCE:
Result = READ_PIC_RECORD(Name, Num, HEAD=head, /PVC)
INPUTS:
Name: Name of ILIAD Pic File
Num: Number of requested record [0,max number)
OUTPUTS:
Result: array with data
KEYWORDS:
HEAD: File head lonarr(12)
PVC: Reads into Structure VC_FEATURE
SIDE EFFECTS:
Opens, reads and closes the file.
MODIFICATION HISTORY:
Written by: K.Rodencker, 23.11.95
READ_RAW
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_RAW
PURPOSE:
Reads a RAW-Image byte file and returns the image
buffer (byte array)
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
Result = READ_RAW( Name, XS=cols, YS=rows, ZS=bands,
SKIP=num)
INPUTS:
Name: Full qualified image file name (string)
OUTPUTS:
Result: Array of image (byte)
KEYWORDS:
XS: Number of columns (default=512)
YS: Number of rows (default=512)
ZS: Number of bands (default=1)
SKIP: Number of bytes to overread
MODIFICATION HISTORY:
Written by: K. Rodenacker, 13.10.93.
FUNCTION read_raw, name, XS=cols, YS=rows, ZS=bands, SKIP=nums
ON_ERROR,2
IF not KEYWORD_SET(nums) THEN nums=0
IF not KEYWORD_SET(cols) THEN cols=512
IF not KEYWORD_SET(rows) THEN rows=512
IF not KEYWORD_SET(bands) THEN bands=1
if nums ne 0 then a=make_array(nums,/byte)
bild=MAKE_ARRAY(cols,rows,bands,/BYTE,/NOZERO)
OPENR,u,name,/get_lun
if nums ne 0 then READU,u,a
READU,u,bild
FREE_LUN,u
RETURN,reform(bild)
END
READ_SEQ
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_SEQ
PURPOSE:
Reads an Image sequence and returns the image
buffer (byte array)
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
Result = READ_SEQ( Name, TYPE=type, XS=cols, YS=rows, ZS=bands,
SKIP=skip )
INPUTS:
Name: Array of image file names (array of strings)
OUTPUTS:
Result: Array of image (byte)
KEYWORDS:
TYPE: IMA/DTP/PIC/RAW (default=IMA)
XS: # columns (default=512)
YS: # rows (default=512)
ZS: # bands (default=| Name |)
SKIP: # bytes to skip (default=0) only for RAW/RAW1
MODIFICATION HISTORY:
Written by: K. Rodenacker, 14.10.93.
FUNCTION read_seq, name, TYPE=type, XS=cols, YS=rows, ZS=bands, SKIP=skip
if not KEYWORD_SET(type) then type='IMA' else type=strupcase(type)
if not KEYWORD_SET(cols) then cols=512
if not KEYWORD_SET(rows) then rows=512
if not KEYWORD_SET(bands) then bands=n_elements(name)
case type of
'IMA': begin
if bands gt n_elements(name) then bands=n_elements(name)
bild=make_array(rows,cols,bands,/byte)
for i=0,bands-1 do bild(*,*,i)=read_ima(name(i))
end
'DTP': begin
if bands gt n_elements(name) then bands=n_elements(name)
a=read_dtp(name(0))
s=size(a)
bild=make_array(s(2),s(1),bands,/byte)
bild(*,*,0)=a
for i=1,bands-1 do bild(*,*,i)=read_dtp(name(i))
end
'PIC': begin
bild=read_pic(name(0))
end
'RAW': begin
if bands gt n_elements(name) then bands=n_elements(name)
bild=make_array(rows,cols,bands,/byte)
for i=0,bands-1 do $
bild(*,*,i)=read_raw(name(i),xs=cols,ys=rows,skip=skip)
end
'RAW1': begin
bild=read_raw(name(0),xs=cols,ys=rows,zs=bands,skip=skip)
end
'TIFF': begin
end
else: message,type+" not supported"
endcase
RETURN, reform(bild)
END
READ_S_ASCII
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_S_ASCII
PURPOSE:
Reads data from an ASCII file into a string array.
CATEGORY:
Input/Output.
CALLING SEQUENCE:
Result = READ_S_ASCII( FILNAM )
INPUTS:
FILNAM
Char. value, the name of the data file.
OPTIONAL INPUT PARAMETERS:
None.
OUTPUTS:
Returns the data lines in a string array.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
Straightforward.
MODIFICATION HISTORY:
Modified 02-AUG-1993 by Karsten Rodenacker from Mati Meron.
READ_TIFF
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
READ_TIFF
PURPOSE:
Read TIFF format images.
CATEGORY:
Input/output.
CALLING SEQUENCE:
Result = READ_TIFF(Filename [,R, G, B])
INPUTS:
Filename: A string containing the name of file to read.
The default extension is ".TIF".
OUTPUTS:
READ_TIFF returns an 8, 16, or 32-bit array containing the image
data. The dimensions of the result are the same as defined in the TIFF
file: [Columns, Rows]. The data type of the image is same as
the type of samples in the image file.
For TIFF images that are RGB interleaved by pixel, the output
dimensions are [3, Cols, Rows].
For TIFF images that are RGB interleaved by image, on output
Planarconfig is set to 2, and the result is the integer value
zero. In this case, three separate images are returned in
the R, G, and B output parameters.
OPTIONAL OUTPUTS:
R, G, B: Variables to hold the Red, Green, and Blue color vectors
extracted from TIFF Class P, Palette Color images.
For TIFF images that are RGB interleaved by image (Planarconfig
returned as 2) the R, G, and B variables each hold an image
with the dimensions [Columns, Rows].
KEYWORDS:
UNSIGNED: If set, return TIFF files containing unsigned 16-bit integers
as signed 32-bit longword arrays. If not set, return
a signed 16-bit integer for these files. In this case,
data values between 32768 and 65535 are returned as
negative values between -32768 and -1. This keyword
has no effect if the input file does not contain 16-bit
integers. To manually convert unsigned 16-bit to 32-bit:
l32 = long(u16)
neg = where(l32 lt 0, count)
if count ne 0 then l32[neg] = 65536 + l32[neg]
The following keywords are used for output parameters only:
ORDER: The order parameter from the TIFF File. This parameter is
returned as 0 for images written bottom to top, and 1 for
images written top to bottom. If the Orientation parameter
does not appear in the TIFF file, an order of 1 is returned.
PLANARCONFIG: This parameter is returned as 1 for TIFF files that are
GrayScale, Palette, or RGB color interleaved by pixel.
This parameter is returned as 2 for RGB color TIFF files
interleaved by image.
COMPANY: Returns directory entry value of directory entry 271,
typically the company. Only defined if entry exist!
DEVICE: Returns directory entry value of directory entry 272,
typically the device. Only defined if entry exist!
SOFTWARE: Returns directory entry value of directory entry 305,
typically a software identification. Only defined if entry exist!
TCLSM: Returns private ZEISS header of CLSM software,
the directory entry 34412. Only defined if entry exist!
COMMON BLOCKS:
TIFF_COM. Only for internal use.
SIDE EFFECTS:
A file is read.
RESTRICTIONS:
Handles TIFF classes G, P, and R. One image per file.
EXAMPLE:
Read the file "my.tiff" in the current directory into the variable
IMAGE, and save the color tables in the variables, R, G, and B by
entering:
IMAGE = READ_TIFF("my.tiff", R, G, B)
To view the image, load the new color table and display the image by
entering:
TVLCT, R, G, B
TV, IMAGE
MODIFICATION HISTORY:
DMS, Written for VMS in 1985.
DMS, April, 1991. Rewrote and added class R and P images.
DMS, Jan, 1992. Fixed bug for images without a RowsPerStrip field.
DJC, Nov, 1993. Fixed doc header.
DMS, Dec, 1994. Fixed bug with private tags.
MWR, Mar, 1995. Fixed bug when opening non-existent file.
DMS, Aug, 1995. Added support for 16 and 32 bit samples.
DMS, Aug, 1996. Added UNSIGNED keyword.
SVP, Jan, 1997. Changed from tiff_read to read_tiff
KR, Jul, 1997, Added T271 T272 T305 TCLSM keywords.
concerning info from Zeiss Confocal Laser Scan. Micr.
RICE
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
RICE
PURPOSE:
Grey thinning/thickening
CATEGORY:
Image processing, Math. morphology
CALLING SEQUENCE:
Result = RICE( Bild, MASK=mask, TYP=typ, ANZAHL=anz, INVERT=invert, LOOPC=lps)
INPUTS:
Bild: Image BYTE
Typ: 0/1
Anz: 0/Anzahl
KEYWORD PARAMETERS:
MASK: Mask image for restrictions
INVERT: The image is inverted befor processing and re-inverted
after processing
ANZAHL: Number of allowed loops, 0 up to termination
TYP: Type default=0
LOOPC: Variable for loop count
OUTPUTS:
Result: Transformed image
SIDE EFFECTS:
The external $1$dia1:[iliad.idl.rod.cc]rod_share is called
RESTRICTIONS:
Image must be BYTE type
MODIFICATION HISTORY:
Written by: K. Rodenacker, 13, Dec 1993.
function rice,bild,MASK=mask,TYP=typ,ANZAHL=anz,INVERT=invert,LOOPC=lps
s=size(bild)
if s(0) ne 2 then message, 'No 2-dim image !'
if s(3) ne 1 then message, 'No BYTE image !'
resu=bytarr(s(1),s(2))
ibild=byte(bild)
if keyword_set(mask) then imask=byte(mask)
if not keyword_set(typ) then typ=0
if not keyword_set(anz) then anz=0
if keyword_set(invert) then begin
ibild=255B-ibild
if keyword_set(mask) then imask=255B-imask
endif
case !version.os of
'vms': begin
fi=filepath('rod_share.exe',root=!idl_basiss,subd=['rod',!version.os])
if not keyword_set(mask) then $
i=call_external('rod_share','rice_b',ibild,resu,0,s(2),s(1),typ,anz, $
default=fi, value=[0B,0B,1B,1B,1B,1B,1B]) $
else $
i=call_external('rod_share','rice_b',ibild,resu,imask,s(2),s(1),typ,anz, $
default=fi, value=[0B,0B,0B,1B,1B,1B,1B])
end
'IRIX': begin
unix: fi=filepath('rod_share.so',root=!idl_basiss,subd=['rod',!version.os])
uniwin: if not keyword_set(mask) then $
i=call_external(fi,'rice_b',ibild,resu,0,s(2),s(1),typ,anz, $
value=[0B,0B,1B,1B,1B,1B,1B]) $
else $
i=call_external(fi,'rice_b',ibild,resu,imask,s(2),s(1),typ,anz, $
value=[0B,0B,0B,1B,1B,1B,1B])
end
'hp-ux':goto,unix
'Win32': begin
fi=filepath('rod_share.dll',root=!idl_basiss,subd=['rod',!version.os])
goto,uniwin
end
else:message,'RICE_B not implemented!'
endcase
if keyword_set(invert) then resu=255B-resu
if keyword_set(mask) then resu=resu and mask
; 1 bit Rand loeschen
resu(0:s(1)-1,0)=0 & resu(0:s(1)-1,s(2)-1)=0
resu(0,0:s(2)-1)=0 & resu(s(1)-1,0:s(2)-1)=0
if keyword_set(lps) then lps=i
Return,resu
end
SELECT
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
select
function select,x,kx,ky
sx=size(x)
e=x
e(*,*)=0
if kx lt sx(1) and ky lt sx(2) then begin
a=search2d(x,kx,ky,x(kx,ky),x(kx,ky))
e(a)=1
endif
return,e
end
SHAD_PER
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
shad_per
pro shad_per,tran,ww
SHADING CORRECTION after loading the appropriate shading image with SHAD_VOR
tran = image to be corrected (tran=tran/sha_image*ww)
ww = given white value,
will be corrected (ww=ww*sha_max/max(tran)) if max(tran) gt sha_max
common shading,sha_name,sha_nr,sha_max,sha_image
sha_name = Name of shading image file
sha_nr = Number of shading image file (from sha_name)
sha_max = Maximum value of shading image
sha_image= Shading image
maxin=max(tran)
if maxin gt sha_max then ww=float(ww) * sha_max / maxin
tran=byte(round(float(tran) / sha_image * ww) < 255.)
end
SHAD_VOR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
shad_vor
pro shad_vor,dir,prae,nr,meds
common shading,sha_name,sha_nr,sha_max,sha_image
nf=findfile(make_name(dir+prae+'w',nr),c=nfa)
if (sha_nr eq 0) or (sha_nr gt nr) or (nfa eq 0) then begin
nf=findfile(dir+prae+'w%%%.cel',c=nfa)
if nfa gt 0 then begin
i=0 & j=0
while (i lt nfa) and (j le nr) do begin
j=get_num(nf(i),prae+'w')
i=i+1
end
found:if j gt nr then i=i-2 else i=i-1
if i lt 0 then i=0
j=get_num(nf(i),prae+'w')
endif else j=0
if j ne 0 then sha_name=nf(i) else sha_name=''
endif else sha_name=nf(0)
if strlen(sha_name) gt 0 then begin
inr=get_num(sha_name,prae+'w')
if inr ne sha_nr then begin
sha_image=byte(median(read_dtp(sha_name),meds))
sha_nr=inr
endif
endif else begin
sha_image=240B
sha_nr=0
endelse
sha_max=max(sha_image)
end
SP_CLAB
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
sp_clab
function sp_clab,ip,thr,FOUR=four,COUNT=jnr,ERROR=jerr
sip=size(ip)
ithr=long(thr)
jnr=0l
if keyword_set(four) then nc=4l else nc=8l
iip=long(ip)
jp=iip
jerr=0l
work=lonarr(2048)
case !version.os of
'hp-ux':i=call_external(filepath('rod_share.so', $
root=!idl_basiss, subd=['rod',!version.os]), $
'c_clab', iip,jp,sip(1),sip(2),ithr, jnr, nc, work, 2048, jerr)
'IRIX':i=call_external(filepath('rod_share.so', $
root=!idl_basiss, subd=['rod',!version.os]), $
'c_clab', iip,jp,sip(1),sip(2),ithr, jnr, nc, work, 2048, jerr)
'vms': i=call_external('rod_share', $
'c_clab', iip,jp,sip(1),sip(2),ithr, jnr, nc, work, 2048, jerr, $
default=filepath('rod_share.exe', $
root=!idl_basiss, subd=['rod',!version.os]))
'Win32':i=call_external(filepath('rod_shar.dll', $
root=!idl_basiss, subd=['rod',!version.os]), $
'c_clab', iip,jp,sip(1),sip(2),ithr, jnr, nc, work, 2048, jerr)
else:jp(*,*)=0l
endcase
return,jp
end
SP_RUNL
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
sp_runl
function sp_runl,ip,id,ng,nr
sip=size(ip)
if n_params() lt 4 then nr=max(sip(1:2))
if n_params() lt 3 then ng=256
if n_params() lt 2 then id=0
inr=long(nr)
ing=long(ng)
iip=long(ip)
mx=lonarr(ng,nr)
iid=long(id)
i=call_external('spider','runl',iip,sip(1),sip(2), $
mx, ing, inr, iid, $
default='$1$dia1:[iliad.idl.rod]spider.exe')
return,mx
end
STEGM
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
stegm
PURPOSE:
Grey thinning/thickening
CATEGORY:
Image processing, Math. morphology
CALLING SEQUENCE:
Result = stegm( Bild, Stel, Gstel, TYP=typ)
INPUTS:
Bild: Image BYTE
Stel: Structured element
Gstel: Structured element validity
KEYWORD PARAMETERS:
TYP: Type default=0
OUTPUTS:
Result: Transformed image
SIDE EFFECTS:
The external $1$dia1:[iliad.idl.rod.cc]rod_share is called
RESTRICTIONS:
Image must be BYTE type
MODIFICATION HISTORY:
Written by: K. Rodenacker, 13, Oct 1994.
Modified 19. Feb.1996
function stegm,bild,stel,gstel,TYP=typ,FLAG=flag,VAL=val
s=size(bild)
if s(0) ne 2 then message, 'No 2-dim image !'
if s(3) ne 1 then message, 'No BYTE image !'
resu=bytarr(s(1),s(2))
ibild=byte(bild)
if not keyword_set(typ) then typ=0
if not keyword_set(flag) then flag=0
if not keyword_set(val) then val=0
meth=[0B,0B,1B,1B,1B,1B,1B,1B,1B,1B]
case !version.os of
'vms': i=call_external('rod_share','stegm_b', $
ibild,resu,0,s(2),s(1),long(stel),long(gstel),typ,flag,val, $
value=meth, $
default=filepath('rod_share.exe', $
root=!idl_basiss,subd=['rod',!version.os]))
'hp-ux': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]),'stegm_b', $
ibild,resu,0,s(2),s(1),long(stel),long(gstel),typ,flag,val, $
value=meth)
'IRIX': i=call_external(filepath('rod_share.so', $
root=!idl_basiss,subd=['rod',!version.os]),'stegm_b', $
ibild,resu,0,s(2),s(1),long(stel),long(gstel),typ,flag,val, $
value=meth)
'Win32': i=call_external(filepath('rod_share.dll', $
root=!idl_basiss,subd=['rod',!version.os]),'stegm_b', $
ibild,resu,0,s(2),s(1),long(stel),long(gstel),typ,flag,val, $
value=meth)
else:message,'Not implemented!'
endcase
resu(0:s(1)-1,0)=0 & resu(0:s(1)-1,s(2)-1)=0
resu(0,0:s(2)-1)=0 & resu(s(1)-1,0:s(2)-1)=0
return,resu
end
STRETCH
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
STRETCH
PURPOSE:
Stretch the image display color tables so the full range
runs from one color index to another.
CATEGORY:
Image processing, point operations.
CALLING SEQUENCE:
STRETCH, Low, High [, /CHOP]
INPUTS:
Low: The lowest pixel value to use. If this parameter is omitted,
0 is assumed. Appropriate values range from 0 to the number
of available colors-1.
High: The highest pixel value to use. If this parameter is omitted,
the number of colors-1 is assumed. Appropriate values range
from 0 to the number of available colors-1.
OPTIONAL INPUTS:
Gamma: Gamma correction factor. If this value is omitted, 1.0 is
assumed. Gamma correction works by raising the color indices
to the Gamma power, assuming they are scaled into the range
0 to 1.
KEYWORD PARAMETERS:
CHOP: If this keyword is set, color values above the upper threshold
are set to color index 0. Normally, values above the upper
threshold are set to the maximum color index.
LINEAR: If this keyword is set, no streching but clipping is
performed.
OUTPUTS:
No explicit outputs.
COMMON BLOCKS:
COLORS: The common block that contains R, G, and B color
tables loaded by LOADCT, HSV, HLS and others.
SIDE EFFECTS:
Image display color tables are loaded.
RESTRICTIONS:
Common block COLORS must be loaded before calling STRETCH.
PROCEDURE:
New R, G, and B vectors are created by linearly interpolating
the vectors in the common block from Low to High. Vectors in the
common block are not changed.
If NO parameters are supplied, the original color tables are
restored.
EXAMPLE:
Load the STD GAMMA-II color table by entering:
LOADCT, 5
Create and display and image by entering:
TVSCL, DIST(300)
Now adjust the color table with STRETCH. Make the entire color table
fit in the range 0 to 70 by entering:
STRETCH, 0, 70
Notice that pixel values above 70 are now colored white. Restore the
original color table by entering:
STRETCH
MODIFICATION HISTORY:
DMS, RSI, Dec, 1983.
DMS, April, 1987. Changed common.
DMS, October, 1987. For unix.
DMS, RSI, Nov., 1990. Added GAMMA parameter.
Ro Added LINEAR parameter.
S_THR
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
S_THR
PURPOSE:
Calculation of an adequate simple threshold
CATEGORY:
Image processing
CALLING SEQUENCE:
thr = S_THR(Hist, Hist_thr, Add_con, Fak_sd,
DISPLAY=display, SMOOTH=smooth)
INPUTS:
Hist: Frequency histogram integer array
OPTIONAL INPUTS:
Hist_thr: Minimum acceptable frequency (default=10)
Add_con: Frequency histogram arrayadditive constant (default=5)
Fak_sd: Multiplication factor for SD (default=3.0)
KEYWORD PARAMETERS:
DISPLAY: Draw thresholds and histogram
SMOOTH: Smooth size of Histogram (default=5)
OUTPUTS:
Result is a float array M with
M(0): threshold = M(1) - M(2) * Fak_sd - Add_con
or = LOWER + 0.666*(UPPER-LOWER+1)
M(1): Mode of histogram
M(2): Standard deviation
M(3): Lower bound
M(4): Upper bound
OPTIONAL OUTPUTS:
Display of histogram and results
PROCEDURE:
From the mode of the histogram the right half is refected at this
mode and the SD calculated. If the resulting threshold is not in
[lower,upper] bounds it is calculated as 2/3 of the range.
MODIFICATION HISTORY:
Written by: K. Rodenacker, 20.10.93
Corrected: 19.9.94
function s_thr,h,sw_t,add_t,fak_t,display=disp,smooth=smooth
case n_params() of
0: message, "Histogram is necessary"
1: begin sw_t=10 & add_t=5 & fak_t=3.0 & end
2: begin add_t=5 & fak_t=3.0 & end
3: fak_t=3.0
else:
endcase
h0=h
x=where(h0 lt sw_t,anz)
if anz gt 0 then h0(x)=0
if not keyword_set(smooth) then smooth=5
if smooth gt 2 then hs=smooth(h0,smooth) else hs=smooth(h0,5)
hs(255)=0 & hs(0)=0
hmx=max(hs,hmxk)
x=where(hs eq 0,anz)
if anz gt 2 then begin
lb=max(x(where(x lt hmxk))) & ub=min(x(where(x ge hmxk)))
end else begin
lb=0 & ub=n_elements(hs)-1
end
h1=lonarr(256)
h1(hmxk:ub)=h0(hmxk:ub)
for i=hmxk-1,max([1,2*hmxk-ub]),-1 do h1(i)=h0(2*hmxk-i)
m=m0m1m2(h1)
thr=m(1) - fak_t*m(2) - add_t
if (thr le lb) or (thr ge ub) then thr=float(lb) + 0.666*(ub-lb+1)
if keyword_set(disp) then begin
y=[0,hmx/2]
!x.range=0 & !y.range=0
plot,hs,psym=10,color=255
cred=thecolor('red') & cgreen=thecolor('green') & cblue=thecolor('blue')
x=[lb,lb] & oplot,x,y,color=cred
x=[ub,ub] & oplot,x,y,color=cred
x=[hmxk,hmxk] & oplot,x,y,color=cgreen
x=[int(m(1)+m(2)),int(m(1)+m(2))] & oplot,x,y,color=cblue
y=[0,hmx]
x=[int(thr),int(thr)] & oplot,x,y,color=cred
end
erg=[float(thr),m(1),m(2),float(lb),float(ub)]
return,erg
end
TEST_PIC
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
TEST_PIC
PURPOSE:
Tests an ILIAD PIC-File
CATEGORY:
Input/Output
CALLING SEQUENCE:
Result = TEST_PIC(Name, HEAD=head, /PVC)
INPUTS:
Name: Name of ILIAD Pic File
OUTPUTS:
Result: 0 PIC-File ok
Result: 1 PIC-File NOT ok
KEYWORDS:
HEAD: File head lonarr(12)
SIDE EFFECTS:
Opens, tests and closes the file.
MODIFICATION HISTORY:
Written by: K.Rodencker, 14.03.95
TM_WSHE1
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
TM_WSHE1
PURPOSE:
Die Funktion berechnet die Wasserscheiden fuer ein Bild beliebiger
Groesse
CATEGORY:
Mathematische Morphologie
CALLING SEQUENCE:
Result = TM_WSHE1(image,MASK=mask,/FOUR,/DISPLAY,/FLOW,/TIME)
INPUTS:
Image: Das Bild, fuer das die Wasserscheiden berechnet werden sollen
KEYWORD PARAMETERS:
/MASK: Die Wasserscheiden werden nur fuer die Maske berechnet
/FOUR: Es wird nur vierer Nachbarschaft betrachtet. Ist dieser Schalter
nicht gesetzt, wird achter Nachbarschaft bearbeitet.
/DISPLAY: Ein Fenster wird geoeffnet, um den Input/Output anzuzeigen
/CLEAR: Bei DISPLAY wird das Fenster wieder geloescht
/FLOW: Schalter um die Schritte der Flutung synchron ausgeben
zu lassen
/TIME: Wenn der Schalter gesetzt ist, wird nach der Berechnung
die dafuer benoetigte Zeit ausgegeben
/VERBOSE: Ein geschwaetziger Ablauf
OUTPUTS:
Es wird ein Bild in gleicher Groesse zurueckgegeben, das die Regionen,
die berechnet wurden, enthaelt. (Der Rand ist immer -1 gesetzt!!!)
ERROR bei falscher MASK Angabe:[B
Falls eine Maske angegeben wird, die keinen Bildpunkt mit
dem minimalen Grauwert des ganzen Bildes enthaelt, kann keine
Wasserscheide bestimmt werden:
Fehlerrueckgabe = -1
EXAMPLE:
a = tm_wshe1(Bild,Mask=mask)
a enthaelt ein Bild, das die Regionen der Wasserscheiden der Maske
des Bildes 'Bild' enthaelt, bezogen auf die vierer-Nachbarschaft
b = tm_wshe1(Bild,/EIGHT,/DISPLAY)
b enthaelt ein Bild, das die Regionen der Wasserscheiden des Bildes
'Bild' enthaelt, bezogen auf die achter-Nachbarschaft. Zusaetzlich
wird das Eingabebild und b nebeneinander ausgegeben.
MODIFICATION HISTORY:
Written by: Thomas Mick, 19.06.1996
Last modified: 19.06.1996, 396.356mal.
Last modified: 28.06.1996, 17undvier mal von Ro
Last modified: 09.07.97, 3d extension, functions inlined Ro
Der Algorithmus wurde abgekupfert von LUC VINCENT und PIERRE SOILLE,
die ihn in der Veroeffentlichung
"Watersheds in digital spaces: An Efficient
Algorithm Based on Immersion Simulations"
(Recognitions on Pattern Analysis and Machine Intelligence,
Vol.13,No.6,June 1991)
publik gemacht haben. Danke, Jungs!. Dank gilt auch meiner Mutter,
die mich unermuedlich unterstuetzt, mir in Zeiten der Verzweiflung
eine rettende Hand und in Zeiten des Hungers einen Geldschein fuer
eine warme Suppe hingehalten hat, es aber im Endeffekt doch nicht
geschafft hat, mir beizubringen, wie ich mir die Schuhe binden kann.
Special thanks fuer die musikalische Unterstuetzung von den Gruppen
K's choice und Garbage. Dieses Programm ist nicht unter
http://www.sex.com
dokumentiert. Gruesse auch an Mahadma Ghandi und nicht (ausdruecklich
nicht!!!) an den Papst. Besondere Gruesse an Douglas Adams: mach's
gut und danke fuer den Fisch.
*******************************************************************************
TM_WSHE2
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
TM_WSHE2
PURPOSE:
Die Funktion berechnet die Wasserscheiden fuer ein Bild beliebiger
Groesse
CATEGORY:
Mathematische Morphologie
CALLING SEQUENCE:
Result = TM_WSHE2(image,MASK=mask,/FOUR,/DISPLAY,/FLOW,/TIME)
INPUTS:
Image: Das Bild, fuer das die Wasserscheiden berechnet werden sollen
KEYWORD PARAMETERS:
MASK: Die Wasserscheiden werden nur fuer die Maske berechnet
FOUR: Es wird nur vierer Nachbarschaft betrachtet. Ist dieser Schalter
nicht gesetzt, wird achter Nachbarschaft bearbeitet.
DISPLAY: Ein Fenster wird geoeffnet, um den Input/Output anzuzeigen
CLEAR: Bei DISPLAY wird das Fenster wieder geloescht
TIME: Wenn der Schalter gesetzt ist, wird nach der Berechnung
die dafuer benoetigte Zeit ausgegeben
VERBOSE: Ein geschwaetziger Ablauf
REVERSE_INDEX: Variable which will contain the reversed index
list used. See in HISTOGRAM for explanation.
OUTPUTS:
Es wird ein Bild in gleicher Groesse zurueckgegeben, das die Regionen,
die berechnet wurden, enthaelt. (Der Rand ist immer -1 gesetzt!!!)
ERROR bei falscher MASK Angabe:
Falls eine Maske angegeben wird, die keinen Bildpunkt mit
dem minimalen Grauwert des ganzen Bildes enthaelt, kann keine
Wasserscheide bestimmt werden:
Fehlerrueckgabe = -1
EXAMPLE:
a = tm_wshe2(Bild,Mask=mask)
a enthaelt ein Bild, das die Regionen der Wasserscheiden der Maske
des Bildes 'Bild' enthaelt, bezogen auf die vierer-Nachbarschaft
b = tm_wshe2(Bild,/EIGHT,/DISPLAY)
b enthaelt ein Bild, das die Regionen der Wasserscheiden des Bildes
'Bild' enthaelt, bezogen auf die achter-Nachbarschaft. Zusaetzlich
wird das Eingabebild und b nebeneinander ausgegeben.
RESTRICTIONS:
TM_WSHE2 is calling external C-function watershed.c from shared
library up_share.so/.dll/.exe
MODIFICATION HISTORY:
Written by: Thomas Mick, 19.06.1996
Last modified: 19.06.1996, 396.356mal.
Last modified: 28.06.1996, 17undvier mal von Ro
Last modified: 09.07.97, 3d extension, functions inlined Ro
28.07.97 change from tm_wshe1 to tm_wshe2
call_external
05.08.97 returning reverse index list
Der Algorithmus wurde abgekupfert von LUC VINCENT und PIERRE SOILLE,
die ihn in der Veroeffentlichung
"Watersheds in digital spaces: An Efficient
Algorithm Based on Immersion Simulations"
(Recognitions on Pattern Analysis and Machine Intelligence,
Vol.13,No.6,June 1991)
publik gemacht haben. Danke, Jungs!. Dank gilt auch meiner Mutter,
die mich unermuedlich unterstuetzt, mir in Zeiten der Verzweiflung
eine rettende Hand und in Zeiten des Hungers einen Geldschein fuer
eine warme Suppe hingehalten hat, es aber im Endeffekt doch nicht
geschafft hat, mir beizubringen, wie ich mir die Schuhe binden kann.
Special thanks fuer die musikalische Unterstuetzung von den Gruppen
K's choice und Garbage. Dieses Programm ist nicht unter
http://www.sex.com
dokumentiert. Gruesse auch an Mahadma Ghandi und nicht (ausdruecklich
nicht!!!) an den Papst. Besondere Gruesse an Douglas Adams: mach's
gut und danke fuer den Fisch.
*******************************************************************************
TYPEOF
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
TYPEOF
Returns the variable (sub-)typ or the dimension (/DIMENSION)
function typeof,va, DIMENSION=dim
sva=size(va)
if not keyword_set(dim) then return,sva(1+sva(0)) $
else return,sva(0)
end
UPDATE_DTP
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
update_dtp
PURPOSE:
Updates a DTP-image file with a threshold Thresh in the header (74-79)
and a binary image Binb in bit 0 if this parameter is set.
With keyword MASK the binary image is updated or written in a
separate file.
CATEGORY:
I/O
CALLING SEQUENCE:
update_dtp, Name, Thresh[, Binb], MASK="cem.0",
KOPF=kopf, DIA1=c, DIA2=c
MODIFICATION HISTORY:
Written by: K. Rodenacker, 22, Nov 1993.
Modified: 19, July 1995
Modified: 7, Nov 1995
pro update_dtp,name,thr,binb, MASK=mask, KOPF=kopf, DIA1=dia1, DIA2=dia2
if keyword_set(mask) then begin
if type(mask) eq 2 then imsk='cem.'+string(mask-1,format="(I1.1)") $
else imsk=mask
staa=str_sep(imsk,'.')
exte=strlowcase(staa(0))
No level number given default level 0
if (size(staa))(1) lt 2 then plan=0 else plan=long(staa(1))
name2=extr_name(name,prefix=pre)
name2=pre+name2+'.'+exte
endif
openu,du,/get_lun,name
iko=assoc(du,bytarr(512))
head=byte(iko(0))
fsp=FIX(STRING(head(22:24)))
fzl=FIX(STRING(head(25:27)))
Update der Schwelle im Kopf wenn thr vorhanden
if n_params() gt 1 then head=byte(string(iko(0:73,0))+ $
string(format='(2I3.3)',thr,thr)+string(iko(80:511,0)))
if keyword_set(dia1) then head(47)=byte(strmid(dia1,0,1))
if keyword_set(dia2) then head(48)=byte(strmid(dia2,0,1))
iko(0)=head
kopf=string(head)
Update des Binaerbildes wenn Parameter binb vorhanden
if n_params() gt 2 then begin
sz = SIZE(binb)
if sz(0) ne 2 THEN MESSAGE,'Image array not 2-dim.!'
Vergleich der Bildgroessen
isp=sz(1)
izl=sz(2)
if isp ne fsp or izl ne fzl then $
message,'Images to be updated differ in size !'
if not keyword_set(mask) then begin
ins Graubild hinein, Ebene 0
rl=512
duf=fstat(du)
unter VMS steht in rec_len etwas drin
if duf.rec_len ne 0 then rl=1
ib=assoc(du,bytarr(isp,izl),rl)
ib(0)=(ib(0) and 254B) or (binb and 1B)
close,du
endif else begin
in separates Maskenbild
close,du
iib=(binb gt 0b)*255B and byte(2^plan)
na=findfile(name2,cou=cna)
if cna ne 0 then begin
wenn bereits vorhanden
openu,du,name2
rl=512
duf=fstat(du)
wenn VMS steht in rec_len etwas drin
if duf.rec_len ne 0 then rl=1
ib=assoc(du,bytarr(isp,izl),rl)
ib(0)=(ib(0) and (255b-byte(2^plan))) or iib
close,du
endif else write_dtp,name2,iib,KOPF=head
endelse
endif
close,du
free_lun,du
end
UPDATE_PIC
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
update_pic
PRO update_pic,nam,vec,num,LAST=last
openu,luu,nam,/get_lun,err=err_v
if (err_v ne 0) then goto,err
head=lonarr(12)
readu,luu,head
if !version.arch eq 'mipseb' then head=swap_endian(head)
wenn num nicht angegeben, anfuegen
if n_params() lt 3 then num=head(0)+1
if num le 0 then num=head(0)+1
if !version.arch ne 'vax' then begin
recl=head(1)*((head(6)+7)/8)
rest=recl-48
re=bytarr(rest)
readu,luu,re
endif else recl=1
case head(5) of
integer data
15: begin
case head(6) of
8: f=bytarr(head(1))
16: f=intarr(head(1))
31: f=lonarr(head(1))
endcase
end
float data
16: f=fltarr(head(1))
byte data
21: f=bytarr(head(1))
else: goto, err_2
endcase
a_f=assoc(luu,f,recl)
sf=size(f)
svec=size(vec)
anz=1
if svec(0) gt 1 then begin
anz=svec(2)
svec=size(vec(*,0))
endif
if svec(1) ne sf(1) then goto, err_2
mxnum=num+anz-1
for i=num,mxnum do a_f(i-1)=vec(*,i-num)
num=num+anz
if head(0) lt mxnum or keyword_set(last) then begin
head(0)=mxnum
point_lun,luu,0
writeu,luu,head
end
free_lun,luu
return
err: message,'Open error:'+string(err_v)
err_1: message,'Unexpected element type:'+string(head(6)),/continue
ext:free_lun,luu
stop
err_2: message,'Different vectors',/continue
goto,ext
end
WATERSHED
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
WATERSHED
function watershed,inb,EIGHT=eight
Watershed an der Silicon Graphics sipath
unter Benutzung von: nfs-device '/usr/nviss' an sipath
remote shell user 'iliad'
shell script '~iliad/nviss_water' an sipath
unter Benutzung eines modifizierten
WRITE_PPM an nviss
Ergebnis: Labelbild
0=kein Label
1=Umgebung wenn maskiertes Bild bearbeitet wurde
2.. Objektlabels
function watershed,inb,EIGHT=eight
ON_IOERROR, bad_io
ON_ERROR, 1
si=size(inb)
if si(0) ne 2 then message,'Not an image'
if si(3) ne 1 then iinb=bytscl(inb) else iinb=inb
case !version.os of
'vms':begin
write_ppm,'disk$nviss_user:[iss.transfer]ttt.pgm',iinb
spawn,'rsh telepath.gsf.de source ~iliad/nviss_water',ech
openr,lu,'disk$nviss_user:[iss.transfer]Label.iii',/get_lun
end
'IRIX':begin
write_ppm,'ttt.pgm',iinb
spawn,'~iliad/idl/rod/CC/water ttt.pgm'
openr,lu,'Label.iii',/get_lun
end
'ultrix':begin
write_ppm,'ttt.pgm',iinb
spawn,'~iliad/bin/water ttt.pgm'
openr,lu,'Label.iii',/get_lun
end
else:return,0
endcase
t=assoc(lu,lonarr(si(1),si(2)))
it=t(0)
case !version.os of
'vms':begin
byteorder,it,/lswap
free_lun,lu
spawn,'delete/noconf/nolog disk$nviss_user:[iss.transfer]Label.iii.*',ech_2
end
'IRIX':begin
free_lun,lu
spawn,'rm Label.iii'
end
'ultrix':begin
free_lun,lu
spawn,'rm Label.iii'
end
else:return,0
endcase
return,it
BAD_IO: Message, 'Error occured accessing label file: Label.iii'
end
WRITE_DTP
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
WRITE_DTP
PURPOSE:
Writes a DTP-Image file
CATEGORY:
INPUT/OUTPUT of images
CALLING SEQUENCE:
WRITE_DTP, name , bild, KOPF=kopf, MASK=extplane, BMASK=bmask
INPUTS:
Name: Full qualified image file name (string)
Buffer: Image array of byte
KEYWORDS:
KOPF: Variable contains the header information
DATE: If set the actual date is used. Only valid with KOPF
MASK: Hint for writing additionally Mask image
extension and plane of mask (default="cem.0")
BMASK: Contains the mask image
NOOVER: Do not overwrite existing file
EXAMPLE:
WRITE_DTP,'test.cel',bild
MODIFICATION HISTORY:
Written by: K. Rodenacker, 20.7.93.
WRITE_PIC
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
WRITE_PIC
PURPOSE:
Writes an array into an ILIAD PIC-File with
appropriate type and size
CATEGORY:
Input/Output
CALLING SEQUENCE:
WRITE_PIC, Name, Data [, /PVC]
INPUTS:
Name: Name of ILIAD Pic File
Data: array of data, bands in last (3rd) dimension
KEYWORDS:
PVC: Reads into a structure VC_FEATURE
SIDE EFFECTS:
Creates, writes and closes the file.
MODIFICATION HISTORY:
Written by: K.Rodencker, 14.10.93
WRITE_PIC_RECORD
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
write_pic_record
PRO write_pic_record,nam,vec,num,LAST=last,HEAD=head
svec=size(vec)
if svec(0) ne 1 then message,'Vector has wrong dimension'
openu,luu,nam,/get_lun,err=err_v
if (err_v ne 0) then goto,err
head=lonarr(12)
readu,luu,head
if !version.arch eq 'mipseb' then head=swap_endian(head)
wenn num nicht angegeben, anfuegen
wenn num negativ, auch anfuegen
if (n_params() lt 3) or (num lt 0) then num=head(0)
if num lt 0 then num=head(0)
if !version.arch ne 'vax' then begin
recl=head(1)*((head(6)+7)/8)
rest=recl-48
re=bytarr(rest)
readu,luu,re
endif else recl=1
case head(5) of
integer data
15: begin
case head(6) of
8: f=bytarr(head(1))
16: f=intarr(head(1))
31: f=lonarr(head(1))
endcase
end
float data
16: f=fltarr(head(1))
byte data
21: f=bytarr(head(1))
else: goto, err_2
endcase
a_f=assoc(luu,f,recl)
sf=size(f)
if svec(1) ne sf(1) then goto, err_2
a_f(num)=vec
if head(0) le num or keyword_set(last) then begin
head(0)=num+1
point_lun,luu,0
writeu,luu,head
end
free_lun,luu
return
err: message,'Open error:'+string(err_v)
err_1: message,'Unexpected element type:'+string(head(6)),/continue
ext:free_lun,luu
stop
err_2: message,'Different vectors',/continue
goto,ext
end
WRITE_PPM
[Previous Routine]
[Next Routine]
[List of Routines]
PRO WRITE_PPM, FILE, Image, ASCII = ascii
NAME:
WRITE_PPM
PURPOSE:
Write an image to a PPM (true-color) or PGM (gray scale) file.
PPM/PGM format is supported by the PMBPLUS and Netpbm packages.
PBMPLUS is a toolkit for converting various image formats to and from
portable formats, and therefore to and from each other.
CATEGORY:
Input/Output.
CALLING SEQUENCE:
WRITE_PPM, File, Image ;Write a given array.
INPUTS:
Image: The 2D (gray scale) or 3D (true-color) array to be output.
KEYWORD PARAMETERS:
ASCII = if set, formatted ASCII IO is used to write the image data.
If omitted, or set to zero, the far more efficient
binary IO (RAWBITS) format is used to write the image data.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A file is written.
RESTRICTIONS:
This routine only writes 8-bit deep PGM/PPM files of the standard
type.
Images should be ordered so that the first row is the top row.
If your image is not, use WRITE_PPM, File, REVERSE(Image, 2)
MODIFICATION HISTORY:
Written Nov, 1994, DMS.
Copyright (c) 1994, Research Systems, Inc. All rights reserved.
Unauthorized reproduction prohibited.
Check the arguments
ON_IOERROR, bad_io
ON_ERROR, 1
Is the image a 2-D array of bytes?
img_size = SIZE(image)
if keyword_set(ascii) then maxval = max(image) else maxval=255
if maxval gt 255 then message, $
'Data larger than 255 not allowed'
IF img_size(0) eq 2 then begin
cols = img_size(1)
rows = img_size(2)
type = 5 - 3 * keyword_set(ascii)
endif else if img_size(0) eq 3 then begin
if img_size(1) ne 3 then MESSAGE, 'True-color images must be (3,n,m)'
cols = img_size(2)
rows = img_size(3)
type = 6 - 3 * keyword_set(ascii)
endif else message, 'IMAGE parameter must be dimensioned (n,m) or (3,n,m)'
OPENW, unit, file, /GET_LUN
printf, unit, 'P'+strtrim(type,2)
st=strtrim(string(cols),2)+' '+strtrim(string(rows),2)
printf, unit, st
st=strtrim(string(maxval),2)
printf, unit, st
if keyword_set(ascii) then printf, unit, byte(image) $
else writeu, unit, byte(image)
FREE_LUN, unit
return
BAD_IO: Message, 'Error occured accessing PGM/PPM file:' + file
end
WRITE_S_ASCII
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
write_s_ascii
pro write_s_ascii,name,a
sa=size(a)
if sa(0) ne 1 and sa(2) ne 7 then message, 'Not 1-dim. stringarray !'
openw,lf,name,/get_lun
if !version.arch eq 'vax' then for i=0,sa(1)-1 do writeu,lf,a(i) $
else for i=0,sa(1)-1 do printf,lf,a(i)
free_lun,lf
end
XTHRESH
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
XTHRESH
PURPOSE:
Example for use of CW_HIST procedure. Allows selection of a threshold with adequate
display
CATEGORY:
image processing
CALLING SEQUENCE:
xthresh, image
INPUTS:
image: byte image array
OPTIONAL INPUTS:
KEYWORD PARAMETERS:
LOWER_VALUE: low Variable for return of selected value
UPPER_VALUE: upp Variable for return of selected value
TYPE: if true the whole binary mask is displayed, normally only the borders
are overlaid
_extra: Keywords of CW_HIST
SIDE EFFECTS:
Function CW_HIST is used
RESTRICTIONS:
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Fri Jul 11 10:16:18 1997, Karsten Rodenacker
<iliad@janus.gsf.de>
ZEISS
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
ZEISS
PURPOSE:
Interpretation of ZEISS tif-file header
Description used:
Private TIF-Data for LSM
========================
Offset Type Description
-------------------------------------------------------------------
0000h WORD Code 494Ch
0002h WORD Version (actual: 0002h)
0004h WORD Image type
Bit 0/1 Number of 8 bit planes
Bit 2/3 Number of channels per pixel
Bit 4 0: Original data,
1: Calculated data (animation)
Bit 5 1: Time series
Bit 6 Reserved (0 or 1)
Bit 7 1: Image is part of sequence
Bit 8 1: y-direction is Time
Bit 9 1: x-direction is Time
0006h WORD Reserved
0008h WORD x size of image
000ah WORD y size of image
000ch WORD x position of ROI
000ch WORD y position of ROI
0010h WORD x size of image display mask
0012h WORD y size of image display mask
0014h WORD Reserved
0016h WORD Reserved
0018h WORD Image position number in a sequence
001ah BYTE Reserved
001bh BYTE Number of valid channel parameters (1..3)
001ch BYTE Number of lasers (1..4)
001dh 3 bytes Reserved
0020h float x size of a pixel (µm or s)
0024h float y size of a pixel (µm or s)
0028h float z distance in a sequence (µm or s)
002ch float Sequence value (µm / s)
0030h 8 x WORD List of laser lines (nm)
----------------------------------------
0040h 64 bytes | Channel parameters 1 |
----------------------------------------
0080h 64 bytes | Channel parameters 2 (if available) |
----------------------------------------
00c0h 64 bytes | Channel parameters 3 (if available) |
---------------------------------------
0100h 16 x char User text 1
0110h 16 x char User text 2
0120h 16 x char Date and time text
0130h 16 x char Beam splitter text (channel 1, should be valid for all)
0140h time_t The time in seconds since midnight (00:00:00),
January 1, 1970, Universal Coordinated Time
0144h WORD Fraction of a second in milliseconds
0146h short Timezone difference in minutes
0148h short Daylight saving flag
014ah float Real scan time for one image (s)
014eh 2 bytes Reserved
0150h 16 x char Emission filter channel 1 text
0160h 16 x char Emission filter channel 2 text (if available)
0170h 16 x char Emission filter channel 3 text (if available)
0180h 32 x char Reserved for lens decription text
Channel Parameters (64 bytes)
-----------------------------
Offset Type Description
-------------------------------------------------------------------
0000h BYTE Source
1 Conv Refl
2 Conv Trans
3 Conv Overl
4 Conv Fluor
5 LSM Refl1
6 LSM Refl2
7 LSM Refl3
8 LSM Trans
9 OBIC
10 Extern
0001h BYTE Pinhole
0002h BYTE Emission filter
0003h BYTE Flags
Bit 0 TV
Bit 1 Confocal
Bit 2 Reserved
Bit 3 Ratio
0004h BYTE Attenuation filter 1
0005h BYTE Attenuation filter 2
0006h BYTE Attenuation filter 3
0007h BYTE Laser (each bit represents one laser line)
0008h BYTE Scanning time
0009h BYTE Bandwidth
000ah BYTE Beam splitter
000bh BYTE Lens
000ch BYTE Scan function
000dh BYTE Averaging mode (reserved)
000eh WORD Number of averaging
0010h WORD Contrast
0012h WORD Brightness
0014h long x motor (in motor steps)
0018h long y motor (in motor steps)
001ch long z motor (in motor steps)
0020h WORD Zoom factor * 1000
0022h short Angle of rotation (0.1 degree)
0024h WORD Obic address 1
0026h WORD Obic address 2
0028h short Scan offset x
002ah short Scan offset y
002ch BYTE Attenuation filter 4
002dh 3 bytes Reserved
0030h float Objective magnification
0034h float Objective apperture
0038h float Reserved
003ch float Reserved
CATEGORY:
I/O
CALLING SEQUENCE:
Input of ZEISS tif image with modified TIFF_READ function with keyword ZEISS=header
zeiss_structure = zeiss(header)
INPUTS:
header: returend from modified TIFF_READ function
OPTIONAL INPUTS:
none
KEYWORD PARAMETERS:
none
OUTPUTS:
zeiss_structure: zeiss structure
OPTIONAL OUTPUTS:
none
COMMON BLOCKS:
none
SIDE EFFECTS:
definition of named structure ZEISS_HEADER and CHANNEL_PARAMETER
Description of structure ZEISS_HEADER:
zhead={ZEISS_HEADER, $
Code: 0, $
Version: 0, $
Type: 0, $
Res1: 0, $
x_size: 0, $
y_size: 0, $
x_pos_ROI: 0, $
y_pos_ROI: 0, $
x_size_mask: 0, $
y_size_mask: 0, $
Res2: 0, $
Res3: 0, $
num_pos: 0, $
Res4: 0B, $
Num_channel: 0B, $
Num_lasers: 0B, $
Res5 : bytarr(3), $
x_size_pix: 0., $
y_size_pix: 0., $
z_dist: 0., $
Seq_value: 0., $
laser_lines: intarr(8), $
chan_par_1: channel_parameter, $
chan_par_2: channel_parameter, $
chan_par_3: channel_parameter, $
User_txt_1: '', $
User_txt_2: '', $
Date_time: '', $
Beam_split_txt: '', $
Time: 0L, $
time_frac: 0, $
time_zone: 0, $
DST_flag: 0, $
real_scan_time: 0., $
res6: bytarr(2), $
E_F_txt_1: '', $
E_F_txt_2: '', $
E_F_txt_3: '', $
res7: bytarr(32)}
Description of structure CHANNEL_PARAMETER:
channel_p={channel_parameter, $
source: 0b, $
pinhole: 0b, $
Emission_filter: 0b, $
Flags: 0b, $
Attenuat_filt_1: 0b, $
Attenuat_filt_2: 0b, $
Attenuat_filt_3: 0b, $
Laser: 0b, $
Scanning_time: 0b, $
Bandwidth: 0b, $
Beam_splitter: 0b, $
Lens: 0b, $
Scan_FUNCTION: 0b, $
Averaging_mode: 0b, $
Num_averaging: 0, $
Contrast: 0, $
Brightness: 0, $
x_motor: 0l, $
y_motor: 0l, $
z_motor: 0l, $
Zoom_factor: 0, $
Angle_rotation: 0, $
Obic_add_1: 0, $
Obic_add_2: 0, $
Scan_offs_x: 0, $
Scan_offs_y: 0, $
Attenuat_filt_4: 0b, $
Res1: bytarr(3), $
Obj_mag: 0.0, $
Obj_app: 0.0, $
Res2: 0.0, $
Res3: 0.0}
RESTRICTIONS:
none
PROCEDURE:
EXAMPLE:
im=tiff_read(dialog_pickfile(),r,g,b,planar=ttif,tclsm=clsm)
clsm = zeiss(clsm)
help, clsm, /str
MODIFICATION HISTORY:
Fri Jul 11 09:15:18 1997, Karsten Rodenacker
Wed Aug 6 08:38:15 1997, Karsten Rodenacker
ZERLEG
[Previous Routine]
[Next Routine]
[List of Routines]
NAME:
ZERLEG
if /WATERSHED then tm_wshe1 else rice
/DISP /ANZAHL
/FLOW /TYP
/TIME /LOOPC
function zerleg,x,WATERSHED=water,_EXTRA=extr
if not keyword_set(water) then begin
xx=byte(x gt 0)
return,ouv(rice(distpn(xx),mask=xx*255B),_extra=extr)
endif else begin
xx=distpn(long(x gt 0))
mx=mm_dil_n(byte(x gt 0),2)
return,tm_wshe1(max(xx)-xx,mask=mx,_extra=extr)
endelse
end
ZERLEG_N
[Previous Routine]
[List of Routines]
NAME:
zerleg_n
function zerleg_n,x,fer,LABEL=lab
if n_params() eq 1 then fer=2
xx=byte(x gt 0)
rx=mm_ouv_n(mm_fer_n(rice(distpn(xx),mask=xx*255B),fer),1)
if keyword_set(lab) then begin
rx1=rx
lab=long(xx) & lab(*,*)=0
i=0
mx=max(rx1)
while mx ne 0 do begin
i=i+1
lab=lab + i*(rx1 eq mx)
rx1=rx1*(1b-(rx1 eq mx))
mx=max(rx1)
endwhile
endif
return,rx
end