Extended IDL Help pro misc (Rodenacker)

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


List of Routines


Routine Descriptions

COOR2IND

[Next Routine] [List of Routines]
 NAME:
		COOR2IND


 PURPOSE:
		calculates coordinates into an index


 CATEGORY:



 CALLING SEQUENCE:
	ind = coor2ind(vec, siz)

 
 INPUTS:
	vec:	coordinate array
	siz:	array size from size(arr)

 OUTPUTS:
	ind:	index of coordinate array


 RESTRICTIONS:
	Only for 1 to 3 dim. arrays.


 PROCEDURE:



 EXAMPLE:
	a=bytarr(64,64,64)
	print,coor2ind([32,32,32], size(a))
	      133152

 MODIFICATION HISTORY:

       Mon Jul 21 11:50:17 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

(See /IDL/pro_src/RODENA/pro/misc/coor2ind.pro)


CW_DEFROI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CW_DEFROI

 PURPOSE:
   Widget to define a region of interest within a widget drawable. 
 CATEGORY:
   Regions of interest, graphics.
 CALLING SEQUENCE:
   Result = CW_DEFROI(draw)
 INPUTS:
   Draw = id of drawable to draw the region.  The drawable should
 	have both MOTION and BUTTON events enabled.
 KEYWORD PARAMETERS:
   IMAGE_SIZE = the size of the underlying array, expressed
       as a two element vector: [columns, rows].  Default =
       drawable size / zoom.
   OFFSET = offset of lower left corner of image within the
       drawable.  Default = [0,0].
   ORDER = if set, return inverted subscripts, as if the array
       were output from top to bottom.
   RESTORE = Set to restore the drawable to its previous appearance
       on exit.  Otherwise, the regions remain on the drawable.
   ZOOM = if the image array was expanded (via REBIN for example)
       specify this two element vector containing the expansion
       factor in X and Y.  Default = [1,1].  Must be integer.
   START_MODE = 0 POLYGON (default)
              = 1 POINT
              = 2 RECTANGLE
              = 3 CIRCLE
              = 10 POLY LINE
 OUTPUTS:
      Result = subscripts of points within the region[s] defined.
       If no region was defined, a scalar -1 is returned.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       The regions are drawn within the drawable.  Set the RESTORE
       keyword to undo the damage.  
 RESTRICTIONS:
   This is a MODAL widget.  No other widget applications will be
   responsive while this widget is in use.

 PROCEDURE:
   Complicated.
 EXAMPLE:
   To obtain the average of the counts of a region within a drawable:
   Assume A = the array of interest, n columns, m rows, and that
   it is displayed in drawable D, at offset X=20, Y=100, and zoomed
   with a factor of 2:
       TV, REBIN(A, M*2, N*2), 20, 100     ;Display the image
       q = CW_DEFROI(D, ZOOM=[2,2], OFFSET=[20,100], IMAGE_SIZE=[m,n])
       if q(0) ne -1 then print,'Average = ', total(a(q))/n_elements(q)
       
 MODIFICATION HISTORY:
   DMS, RSI, December, 1993.  Written.

(See /IDL/pro_src/RODENA/pro/misc/cw_defroi.pro)


D2SHOW_TC

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		d2show_tc
		
 function d3show_tc,vol,ZOOM=zom,WINDOWS=winno,_EXTRA=extr
 sa=size(vol)
 dim=ceil(sqrt(sa(4)))
 if not keyword_set(zom) then zom=1
 b=bytarr(sa(1),sa(2)*dim*zom,sa(3)*dim*zom)
 for i=0,sa(4)-1 do begin
   x=sa(2)*zom*(i mod dim)
   y=sa(3)*zom*(i/dim)
   if zom gt 1 then $
     b(*,x:x+sa(2)*zom-1,y:y+sa(3)*zom-1)= $
       rebin(vol(*,*,*,i),3,sa(2)*zom,sa(3)*zom,/sa) $
   else b(*,x:x+sa(2)-1,y:y+sa(3)-1)=vol(*,*,*,i)
 endfor
 slide_image_tc,b,top_id=wsl,slide_window=sw,full_window=fw,_extra=extr
 winno=[fw,sw]
 return,wsl
 end

(See /IDL/pro_src/RODENA/pro/misc/d3show_tc.pro)


D3L_N

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		D3L_N



 PURPOSE:
	Input of 3d-images from sequences of section tif-files and definition of
	data arrays in common wd3d_dat as preparation od call WD3D.
	File sequences have to be in the form xxxxxyyy.zzz where xxxxx is an arbitrary
	string, yyy a number, starting from NUMBER_FIELD and zzz an arbitrary string 
	according EXTENSION


 CATEGORY:
	3d image analysis


 CALLING SEQUENCE:
	d3n

 
 INPUTS:
	none


 OPTIONAL INPUTS:
	none

	
 KEYWORD PARAMETERS:

	OVER_COLOR:	Pseudocolor display is used. 
			If !version.arch eq 'mipseb' normally truecolor is used

	PATH:		path	For pickfile path is used as beging search path ['/']

	NAME:		name	Full file sequence specification, no pickfile is used.
				e.g. '/mnt/iliad/series/abcd???.tif'

	NOTOPHAT:	Blue channel is not overwritten by top-hat-transformation

	NUMBER_FIELD:	sele_n	A string describing the first section image ['000']
				e.g. '27'	

	NUMBER_SECTIONS:anz_sec	Number of images to be read in starting from NUMBER_FIELD
				[all found]

	EXTENSION:	sele_e	A string describing the extension ['tif']

	RESULT:		err	Returns an error value (0 an error occured)

	LABEL:		Space for label image is allocated

	NAM_LABEL:	nlabe	Name of labelled image sequence

	SIZE_TOPHAT:	itophat_size	Size of top-hat-transformation [3]

	SIZE_OPENING:	iopen_size	Size of opening [1]

     Extra keywords used from wd3d, not used from d3l_n, only transferred to wd3d
	(see WD3D)

	XVISIBLE:	ixvis

	YVISIBLE:	iyvis

	NOSIGNAL_COUNT:

	MIN_SIGNAL_VOLUME:imin_sig_vol

	MIN_NUCLEUS_VOLUME:imin_nuc_vol

	THRESH_TOPHAT:	itophat_thr

	NOGALLERY:

	BOX_ALL:

	VERBOSE:


 OUTPUTS:



 OPTIONAL OUTPUTS:



 COMMON BLOCKS:

	VOLUME_DATA:	for possible use of SLICER procedure

	WD3D_DAT:	contains all volume data
		a:	color volume (pseudo color [x,y,z], truecolor [3,x,y,z]
		rh,fl,bl:red, green, blue channel (bl is overwritten by top-hat
		lrh,lfl:label images
		rv,gv,bv:look-up-tables
		sa:	size of volume [x,y,z]
		color:	true if color volume
		true_color:true if truecolor display
		iname:	name selector string
		jname:	automatic generated filename for results
		ipath:	path
		lname:	label file selector string
		clsm:	Zeiss header from first tif-file read
		x_sp,y_sp,z_sp:Pixel sizes from Zeiss header


 SIDE EFFECTS:



 RESTRICTIONS:
	Use of procedure vol_tiff_read


 PROCEDURE:



 EXAMPLE:



 MODIFICATION HISTORY:

       Fri Jul 11 09:30:28 1997, Karsten Rodenacker
       Wed Jul 30 09:23:36 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

(See /IDL/pro_src/RODENA/pro/misc/d3l_n.pro)


D3SHOW

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		d3show
		
 function d3show,vol,ZOOM=zom,WINDOWS=winno,_EXTRA=extr
 sa=size(vol)
 dim=ceil(sqrt(sa(3)))
 if not keyword_set(zom) then zom=1
 b=bytarr(sa(1)*dim*zom,sa(2)*dim*zom)
 for i=0,sa(3)-1 do begin
   x=sa(1)*zom*(i mod dim)
   y=sa(2)*zom*(i/dim)
   if zom gt 1 then $
     b(x:x+sa(1)*zom-1,y:y+sa(2)*zom-1)=rebin(vol(*,*,i),sa(1)*zom,sa(2)*zom,/sa) $
   else b(x:x+sa(1)-1,y:y+sa(2)-1)=vol(*,*,i)
 endfor
 slide_image,b,top_id=wsl,slide_window=sw,full_window=fw,_extra=extr
 winno=[fw,sw]
 return,wsl
 end

(See /IDL/pro_src/RODENA/pro/misc/d3show.pro)


D3S_N

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		D3S_N
		Speichern von 3D Daten fuer WD3D
		Keywords:
			NUMBER_FIELD:	Laufnummer fuer ersten Schnitt ('000')
			NUMBER_SECTIONS:Anzahl Schnitte (0) all
			EXTENSION:	Extension ('tif')
			NAME:		Name der Sequence (complete)
			LABEL:		Label images are stored (lrh,lfl,bl)

(See /IDL/pro_src/RODENA/pro/misc/d3s_n.pro)


FIND_F

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		FIND_F


 PURPOSE:
	Find first element in a byte array of whose value
	reflects the condition and value.
	Search starts from init index.
	The function returns the index of the found element.

	For large arrays, e.g. [256,256,64] idl function where is to slow.

 CATEGORY:
	Utility


 CALLING SEQUENCE:
	ind = find_f(arr, init, condition=cond, value=val)

 
 INPUTS:
	arr:	Byte array to be searched
	init:	Long initial index


 KEYWORD PARAMETERS:
	CONDITION:	A number reflecting the used condition [def. 0]
			0 -> EQ (! !=)
			1 -> NE (! ==)
			2 -> GE (!  <)
			3 -> LE (!  >)
			4 -> GT (! <=)
			5 -> LT (! >=)

	VALUE:		compared value [def. 0B]


 OUTPUTS:
	index of found array element
		-1	not found from starting index to end of array
		-2	not a byte array
		-3	start index not in array

 SIDE EFFECTS:
	call_external to sharable library rod_share[.exe/.dll/.so] with
	entry point find_first_b.


 RESTRICTIONS:
	Only implemented for vms, hp-ux, IRIX and Win32 !version.os


 PROCEDURE:
	Related procedures: coor2ind, ind2coor


 EXAMPLE:
	a=bytarr(64,64,64)
	a[32,32,32]=25b
	ind=find_f(arr,0,cond=2,val=25)
	print,ind, ind2coor(ind, size(a))
	      133152          32          32          32


 MODIFICATION HISTORY:

       Mon Jul 21 11:00:56 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

(See /IDL/pro_src/RODENA/pro/misc/find_f.pro)


GEN_DM

[Previous Routine] [Next Routine] [List of Routines]
  NAME: 
      GEN_DM 
  Distanzmatrix berechnen 
 FUNCTION GEN_DM,x,y,MAINMAX=mm 
 sx=size(x) 
 sy=size(y)
 w=where(sx ne sy,cw)  
 if cw ne 0 then message,'Pointvectors differ' 
 if sx(0) ne 1 then message,'Pointvectors not 1-dim.'        
 dm=fltarr(sx(1),sx(1))    
 for i=0,sx(1)-1 do for j=i,sx(1)-1 do begin    
  dm(i,j)=norm([x(i),y(i)]-[x(j),y(j)])    
  dm(j,i)=dm(i,j)    
 endfor    
 if keyword_set(mm) then begin 
  maxi=max(dm)+1.    
  for i=0,sx(1)-1 do dm(i,i)=maxi 
 endif 
 return,dm 
 end 

(See /IDL/pro_src/RODENA/pro/misc/gen_dm.pro)


IMAGE_CONT_2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMAGE_CONT_2

 PURPOSE:
	Overlay an image and a contour plot.

 CATEGORY:
	General graphics.

 CALLING SEQUENCE:
	IMAGE_CONT_2, A, B

 INPUTS:
	A:	The two-dimensional array to display with TV.
	A:	The 2nd two-dimensional array to display with CONTOUR.

 KEYWORD PARAMETERS:
 WINDOW_SCALE:	Set this keyword to scale the window size to the image size.
		Otherwise, the image size is scaled to the window size.
		This keyword is ignored when outputting to devices with 
		scalable pixels (e.g., PostScript).

	ASPECT:	Set this keyword to retain the image's aspect ratio.
		Square pixels are assumed.  If WINDOW_SCALE is set, the 
		aspect ratio is automatically retained.

	INTERP:	If this keyword is set, bilinear interpolation is used if 
		the image is resized.

 OUTPUTS:
	No explicit outputs.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	The currently selected display is affected.

 RESTRICTIONS:
	None.

 PROCEDURE:
	If the device has scalable pixels, then the image is written over
	the plot window.

 MODIFICATION HISTORY:
	DMS, May, 1988.

(See /IDL/pro_src/RODENA/pro/misc/image_cont_2.pro)


IND2COOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IND2COOR


 PURPOSE:
	calculates an index into coordinates

 CATEGORY:
	Utility


 CALLING SEQUENCE:
	arr = ind2coor(ind, siz)

 
 INPUTS:
	ind:	index
	siz:	array size from size(xxx)

 OUTPUTS:
	arr:	coordinates array


 RESTRICTIONS:
	Only for 1 to 3 dim arrays


 PROCEDURE:



 EXAMPLE:
	help,ind2coor(123456,size(bytarr(64,64,64)))
	<Expression>    LONG      = Array[3]
	print,ind2coor(123456,size(bytarr(64,64,64)))
	      0           9          30


 MODIFICATION HISTORY:

       Mon Jul 21 11:52:59 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>


(See /IDL/pro_src/RODENA/pro/misc/ind2coor.pro)


LABEL_SIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LABEL_SIZE


 PURPOSE:
	Delete all objects from a label image with number of
	pixels/voxels lt min_size and ge max_size and renumber the
	labels consecutively.
	Nothing is done if no object is found.


 CATEGORY:
	image processing / utilities


 CALLING SEQUENCE:
	label_size, lab, min_size[, max_size]

 
 INPUTS:
	lab:	label image from label_region or label_ws


 OPTIONAL INPUTS:
	none

	
 KEYWORD PARAMETERS:
	none


 OUTPUTS:
	input image lab is changed


 OPTIONAL OUTPUTS:
	none


 COMMON BLOCKS:
	none


 SIDE EFFECTS:
	input image is changed


 RESTRICTIONS:



 PROCEDURE:
	histogram, reverse_i is used to estimate objects


 EXAMPLE:



 MODIFICATION HISTORY:

       Tue Aug 5 14:26:47 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>


(See /IDL/pro_src/RODENA/pro/misc/label_size.pro)


LABEL_WS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LABEL_WS


 PURPOSE:
	Labelling of all objects in an image or a volume with
	watershed algorithm


 CATEGORY:
	Image processing


 CALLING SEQUENCE:
	lab = label_ws(img)

 
 INPUTS:
	img:	binary image or volume


 OPTIONAL INPUTS:
	none

	
 KEYWORD PARAMETERS:
	LONG:	Result is an integer array (def. byte)
		For images with more than 255 objects.

	MASK:	Dilated input is used as mask parameter to reduces
		computing time, good for small connected objects

	REVERSE_INDEX: Variable which will contain the indices of the
		reverse index list used by watershed, implicitly this
		is the region processed. See in HISTOGRAM for explanation.


 OUTPUTS:
	lab:	Label image

 SIDE EFFECTS:



 RESTRICTIONS:
	The external function c_watershed is implicitly called by the
	function tm_wshe2.

	Application of watershed implies that background cannot be labelled!


 PROCEDURE:
	tm_wshe2 is applied on the inverted and binarized input image.
	The resulting label image is multiplied by the binarized input
	image.
	If mask is set, tm_wshe2 is called with keyword MASK
	containing the binarized input image dilated by a radius of
	2. This will reduce computing time if the number of
	pixels/voxels set is small against the size of the
	image/volume. This is normally the case.


 EXAMPLE:
	xxx=bytarr(512,512) & xxx[32:34,32:34]=1 & xxx[62:64,62:64]=1
	yyy=label_ws(xxx,/mask) 
	print, yyy[32,32], yyy[62,62] 	
	   1   2	

 MODIFICATION HISTORY:

       Tue Aug 5 09:20:16 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

		

       Mon Aug 4 14:12:49 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>


(See /IDL/pro_src/RODENA/pro/misc/label_ws.pro)


MAIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		MAIN



 PURPOSE:
	Simple call interface for 3D inspection and analysis program WD3D
	Calls D3L_N for loading volumes and then WD3D


 CATEGORY:
	3d-image analysis


 CALLING SEQUENCE:
	main

 
 INPUTS:



 OPTIONAL INPUTS:


	
 KEYWORD PARAMETERS:

	see D3L_N and WD3D

	NOTOPHAT:	-> Blue channel if any will be displayed
			However the same channel is used for box marking too
	LOAD_ONLY:	-> The selected sequence will be loaded only
			and the program returns to prompter

	OVER:		pseudo color

 OUTPUTS:



 OPTIONAL OUTPUTS:



 COMMON BLOCKS:

	see D3L_N and WD3D


 SIDE EFFECTS:
	Calls
		D3L_N	for loading image sequences
		WD3D	for interactive inspection and analysis


 RESTRICTIONS:



 PROCEDURE:



 EXAMPLE:

		main			-> file choser starts from /
		main,/PATH='/export/telepath/series/'
					-> file choser starts from
						/export/telepath/series/


 MODIFICATION HISTORY:

       Fri Jul 11 09:59:52 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>


(See /IDL/pro_src/RODENA/pro/misc/main.pro)


MST

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
      MST
 Minimum spanning tree bestimmen  
 FUNCTION MST,dm,ist
 if n_params() lt 2 then ist=0
 sdm=size(dm) 
 if sdm(0) ne 2 then message,'Distancematrix not 2-dim.' 
 if sdm(1) ne sdm(2) then message,'Distancematrix not a sqare' 
 n=sdm(1) 
 ss=bytarr(n) & ss(ist)=1b  
 aa=intarr(2,n-1)  
 cs=intarr(n) & cs(*)=ist  
 while total(ss) ne n do begin  
  t=where(ss eq 0)  
  mini=min(dm(t,cs(t)),kl)  
  s=t(kl mod int(n-total(ss)))  
  ss(s)=1  
  nss=total(ss)  
  aa(*,nss-2)=[s,cs(s)]  
  if nss lt n then begin 
    t=where(ss eq 0) 
    xx=where(dm(t,replicate(s,n-nss)) lt dm(t,cs(t))) 
    sxx=size(xx) 
    if sxx(0) eq 1 then cs(t(xx))=s 
  endif
 endwhile 
 return,aa
 end

(See /IDL/pro_src/RODENA/pro/misc/mst.pro)


NNG

[Previous Routine] [Next Routine] [List of Routines]
  NAME:  
      NNG 
 Nearest neighbors bestimmen    
 FUNCTION NNG,dm,ng  
 sdm=size(dm)  
 if sdm(0) ne 2 then message,'Distancematrix not 2-dim.'  
 if sdm(1) ne sdm(2) then message,'Distancematrix not a sqare'  
 n=sdm(1)  
 nen=intarr(n)     
 for i=0,n-1 do begin     
  mini=min(dm(i,ng(ng(i):ng(i+1)-1)),kl)    
  nen(i)=ng(ng(i)+kl)  
 endfor  
 return,nen  
 end  

(See /IDL/pro_src/RODENA/pro/misc/nng.pro)


PLOT_DNA

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		plot_dna

	Einlesen von DNA Daten von Filen,
	Selektieren eines Specimens Spec,
	Ausgeben entsprechend TYPE mit einer oder mehreren Moeglichkeiten
	aus ['DNA','Ent','cDI','SINE1','SINE4','PB']
	oder entsprechend /MULTI, alle Moeglichkeiten in ein Bild
	
	Input File: e.g.

   2    1170    2.01071
   3    1170    2.07279
   4    1170    2.09343
   5    1170    2.03847

	The all columns must contain numbers, where the first is arbitrary,
	the second is the specimen number and the third is the DNA value in
	multiples of c.

 pro plot_dna,filen,spec,TYPE=dtyp,MULTI=multi
 if keyword_set(multi) then begin
   if multi eq 1 then !p.multi=[0,3,2,0,0] else !p.multi=[0,multi,2,0,0]
 endif else !p.multi=[0,0,0,0,0]
 !x.charsize=1.5 & !y.charsize=1.5
 d=read_ascii(filen)
 sd=size(d)
 if sd(0) ne 2 then begin
   message,'No data !',/continue
   return
 endif
 if n_params() ge 2 then wh=where(d(1,*) eq spec) $
 else wh=lindgen(sd(2))
 ds=size(wh)
 if ds(0) ne 1 then begin
   message,'No data selected !',/continue
   return
 endif
 ih=histogram(d(2,wh),binsize=0.1,min=1.0, max=16.0)
 fh=smooth(float(ih),3)
 h=fh/float(ds(1))
 h(0)=0	; Damit polyfill nicht Ueberraschungen macht
 xx=findgen(151)/10+1.0
 if keyword_set(multi) then begin
   if multi eq 1 then dtyp=['DNA','Ent','cDI','SINE1','SINE4','PB']
 endif
 if keyword_set(dtyp) then begin
   if typeof(dtyp,/dim) eq 0 then dtyp=[dtyp]
 endif else dtyp=['DNA']
 st=size(dtyp)
 for i=0,st(1)-1 do case dtyp(i) of
 'DNA':begin
    plot,xx,h,psym=10,yrange=[0.0,15],noclip=0
    polyfill,xx,h*100,noclip=0
    xyouts,4.0,13,'!5DNA Mean = '+string(total(d(2,wh)/ds(1)), $
      format='(f7.2)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,12,'!5Specimen:'+string(spec,format='(i5)')
    end
 'Ent':begin
print,'Entropy'
    l=h & l(*)=0.0 & l(where(h ne 0.0))=alog10(h(where(h ne 0.0)))
    e=-h*l
    plot,xx,e,psym=10,yrange=[0.0,0.5],noclip=0
    polyfill,xx,e,noclip=0
    xyouts,4.0,0.43,'!5Entropy = '+string(total(e),format='(f7.4)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,0.4,'!5Specimen:'+string(spec,format='(i5)')
    end
 'cDI':begin
print,'2cDI'
    di=h*(xx-2.0)^2
    plot,xx,di,psym=10,noclip=0,ytick_get=yv
    polyfill,xx,di,noclip=0
    syv=size(yv)
    yp=yv(syv(1)-1)*0.85
    xyouts,4.0,yp,'!52cDI ='+string(alog10(total(di)+1.0)*1.757, $
      format='(f7.4)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,yv(syv(1)-1)*0.8,'!5Specimen:'+string(spec,format='(i5)')
    end
 'SINE1':begin
    z=h*50.*(1.+sin(alog(xx)/alog(2.0)*2.*!pi-!pi*0.5))
    plot,xx,z,psym=10,yrange=[0.0,15],noclip=0
    polyfill,xx,z,noclip=0
    xyouts,4.0,13,'!5SINE1 = '+string(total(z),format='(f7.2)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,12,'!5Specimen:'+string(spec,format='(i5)')
    end
 'SINE4':begin
    dxx3=3.0*(xx-2.0)/14.>0.
    dz3=h*50.*(1.+sin(alog(xx)/alog(2.0)*2.*!pi-!pi*0.5)+dxx3)
    plot,xx,dz3,psym=10,yrange=[0.0,15],noclip=0
    polyfill,xx,dz3,noclip=0
    xyouts,4.0,13,'!5SINE4 ='+string(total(dz3),format='(f7.2)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,12,'!5Specimen:'+string(spec,format='(i5)')
    end
 'PB':begin
    dbr=xx & dbr(*)=-1.0
    dbr(0:7)=0.0 & dbr(8:13)=1.0 & dbr(28:34)=1.0 & dbr(65:75)=1.0
    dbr=h*dbr*100.0
    plot,xx,dbr,psym=10,yrange=[-15.0,15.0],ystyle=1,noclip=0
    polyfill,xx,dbr,noclip=0
    xyouts,4.0,11,'!5Ploidy Balance ='+string(total(dbr), $
      format='(f7.2)'),charsize=1
    if n_params() gt 1 then $
      xyouts,4.0,9,'!5Specimen:'+string(spec,format='(i5)')
    end
 else:
 endcase
 end

(See /IDL/pro_src/RODENA/pro/misc/plot_dna.pro)


SLIDE_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SLIDE_IMAGE

 PURPOSE:
	Create a scrolling graphics window for examining large images.
	By default, 2 draw widgets are used.  The left draw widget shows
	a reduced version of the complete image, while the draw widget on
	the right displays the actual image with scrollbars that allow sliding
	the visible window.

 CALLING SEQUENCE:
	SLIDE_IMAGE [, Image]

 INPUTS:
	Image:	The 2-dimensional image array to be displayed.  If this 
		argument is not specified, no image is displayed. The 
		FULL_WINDOW and SCROLL_WINDOW keywords can be used to obtain 
		the window numbers of the 2 draw widgets so they can be drawn
		into at a later time.

 KEYWORDS:
      CONGRID:	Normally, the image is processed with the CONGRID
		procedure before it is written to the fully visible
		window on the left. Specifying CONGIRD=0 will force
		the image to be drawn as is.

  FULL_WINDOW:	A named variable in which to store the IDL window number of \
		the non-sliding window.  This window number can be used with 
		the WSET procedure to draw to the scrolling window at a later
		point.

	GROUP:	The widget ID of the widget that calls SLIDE_IMAGE.  If this
		keyword is specified, the death of the caller results in the
		death of SLIDE_IMAGE.

	ORDER:	This keyword is passed directly to the TV procedure
		to control the order in which the images are drawn. Usually,
		images are drawn from the bottom up.  Set this keyword to a
		non-zero value to draw images from the top down.

     REGISTER:	Set this keyword to create a "Done" button for SLIDE_IMAGE
		and register the widgets with the XMANAGER procedure.

		The basic widgets used in this procedure do not generate
		widget events, so it is not necessary to process events
		in an event loop.  The default is therefore to simply create
		the widgets and return.  Hence, when register is not set, 
		SLIDE_IMAGE can be displayed and the user can still type 
		commands at the "IDL>" prompt that use the widgets.

	RETAIN:	This keyword is passed directly to the WIDGET_DRAW
		function, and controls the type of backing store
		used for the draw windows.  If not present, a value of
		2 is used to make IDL handle backing store.

 SLIDE_WINDOW:	A named variable in which to store the IDL window number of 
		the sliding window.  This window number can be used with the 
		WSET procedure to draw to the scrolling window at a later 
		time.

	TITLE:	The title to be used for the SLIDE_IMAGE widget.  If this
		keyword is not specified, "Slide Image" is used.

	TOP_ID:	A named variable in which to store the top widget ID of the 
		SLIDE_IMAGE hierarchy.  This ID can be used to kill the 
		hierarchy as shown below:

			SLIDE_IMAGE, TOP_ID=base, ...
			.
			.
			.
			WIDGET_CONTROL, /DESTROY, base

	XSIZE:	The maximum width of the image that can be displayed by
		the scrolling window.  This keyword should not be confused 
		with the visible size of the image, controlled by the XVISIBLE
		keyword.  If XSIZE is not specified, the width of Image is 
		used.  If Image is not specified, 256 is used.

     XVISIBLE:	The width of the viewport on the scrolling window.  If this 
		keyword is not specified, 256 is used.

	YSIZE:	The maximum height of the image that can be displayed by
		the scrolling window.  This keyword should not be confused 
		with the visible size of the image, controlled by the YVISIBLE
		keyword.  If YSIZE is not present the height of Image is used.
		If Image is not specified, 256 is used.

     YVISIBLE:	The height of the viewport on the scrolling window. If
		this keyword is not present, 256 is used.

 OUTPUTS:
	None.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Widgets for displaying a very large image are created.
	The user typically uses the window manager to destroy
	the window, although the TOP_ID keyword can also be used to
	obtain the widget ID to use in destroying it via WIDGET_CONTROL.

 RESTRICTIONS:
	Scrolling windows don't work correctly if backing store is not 
	provided.  They work best with window-system-provided backing store
	(RETAIN=1), but are also usable with IDL provided backing store 
	(RETAIN=2).

	Various machines place different restrictions on the size of the
	actual image that can be handled.

 MODIFICATION HISTORY:
	7 August, 1991, Written by AB, RSI.
	10 March, 1993, ACY, Change default RETAIN=2
	23 Sept., 1994  KDB, Fixed Typo in comments. Fixed error in
			Congrid call. xvisible was used instead of yvisible.

(See /IDL/pro_src/RODENA/pro/misc/slide_image.pro)


SLIDE_IMAGE_TC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SLIDE_IMAGE_TC

 PURPOSE:
	Create a scrolling graphics window for examining large images.
	By default, 2 draw widgets are used.  The left draw widget shows
	a reduced version of the complete image, while the draw widget on
	the right displays the actual image with scrollbars that allow sliding
	the visible window.

 CALLING SEQUENCE:
	SLIDE_IMAGE_TC [, Image]

 INPUTS:
	Image:	The 2-dimensional image array to be displayed.  If this 
		argument is not specified, no image is displayed. The 
		FULL_WINDOW and SCROLL_WINDOW keywords can be used to obtain 
		the window numbers of the 2 draw widgets so they can be drawn
		into at a later time.

 KEYWORDS:
      CONGRID:	Normally, the image is processed with the CONGRID
		procedure before it is written to the fully visible
		window on the left. Specifying CONGIRD=0 will force
		the image to be drawn as is.

  FULL_WINDOW:	A named variable in which to store the IDL window number of \
		the non-sliding window.  This window number can be used with 
		the WSET procedure to draw to the scrolling window at a later
		point.

	GROUP:	The widget ID of the widget that calls SLIDE_IMAGE.  If this
		keyword is specified, the death of the caller results in the
		death of SLIDE_IMAGE.

	ORDER:	This keyword is passed directly to the TV procedure
		to control the order in which the images are drawn. Usually,
		images are drawn from the bottom up.  Set this keyword to a
		non-zero value to draw images from the top down.

     REGISTER:	Set this keyword to create a "Done" button for SLIDE_IMAGE
		and register the widgets with the XMANAGER procedure.

		The basic widgets used in this procedure do not generate
		widget events, so it is not necessary to process events
		in an event loop.  The default is therefore to simply create
		the widgets and return.  Hence, when register is not set, 
		SLIDE_IMAGE can be displayed and the user can still type 
		commands at the "IDL>" prompt that use the widgets.

	RETAIN:	This keyword is passed directly to the WIDGET_DRAW
		function, and controls the type of backing store
		used for the draw windows.  If not present, a value of
		2 is used to make IDL handle backing store.

 SLIDE_WINDOW:	A named variable in which to store the IDL window number of 
		the sliding window.  This window number can be used with the 
		WSET procedure to draw to the scrolling window at a later 
		time.

	TITLE:	The title to be used for the SLIDE_IMAGE widget.  If this
		keyword is not specified, "Slide Image" is used.

	TOP_ID:	A named variable in which to store the top widget ID of the 
		SLIDE_IMAGE hierarchy.  This ID can be used to kill the 
		hierarchy as shown below:

			SLIDE_IMAGE_TC, BASE_ID=base, ...
			.
			.
			.
			WIDGET_CONTROL, /DESTROY, base

	XSIZE:	The maximum width of the image that can be displayed by
		the scrolling window.  This keyword should not be confused 
		with the visible size of the image, controlled by the XVISIBLE
		keyword.  If XSIZE is not specified, the width of Image is 
		used.  If Image is not specified, 256 is used.

     XVISIBLE:	The width of the viewport on the scrolling window.  If this 
		keyword is not specified, 256 is used.

	YSIZE:	The maximum height of the image that can be displayed by
		the scrolling window.  This keyword should not be confused 
		with the visible size of the image, controlled by the YVISIBLE
		keyword.  If YSIZE is not present the height of Image is used.
		If Image is not specified, 256 is used.

     YVISIBLE:	The height of the viewport on the scrolling window. If
		this keyword is not present, 256 is used.

 OUTPUTS:
	None.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Widgets for displaying a very large image are created.
	The user typically uses the window manager to destroy
	the window, although the TOP_ID keyword can also be used to
	obtain the widget ID to use in destroying it via WIDGET_CONTROL.

 RESTRICTIONS:
	Scrolling windows don't work correctly if backing store is not 
	provided.  They work best with window-system-provided backing store
	(RETAIN=1), but are also usable with IDL provided backing store 
	(RETAIN=2).

	Various machines place different restrictions on the size of the
	actual image that can be handled.

 MODIFICATION HISTORY:
	7 August, 1991, Written by AB, RSI.
	10 March, 1993, ACY, Change default RETAIN=2

(See /IDL/pro_src/RODENA/pro/misc/slide_image_tc.pro)


STRPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STRPARSE
 PURPOSE:
	Parses the string LINE using the characters in DELIM as delimiters.  
	Puts individual pieces into consecutive locations in LIST.
 CATEGORY:
	String Processing
 CALLING SEQUENCE:
	Result = STRPARSE( LINE, DELIM [, LIST])
 INPUTS:
    LINE
	Character string.
    DELIM
	Character string.  Each Character of DELIM is used as a delimiter.
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	Returns the number of pieces found minus one i.e. the index of the last
	element of LIST if LIST is provided.  If LINE is a null string or not a
	string, the function returns -1.
 OPTIONAL OUTPUT PARAMETERS:
    LIST
	Character array.  If name is provided, the pieces of LINE resulting 
	from the parsing process are returned in consecutive locations in LIST.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Straightforward.  Using the function TYPE from MIDL.
 MODIFICATION HISTORY:
	Created 15-JUL-1991 by Mati Meron.

(See /IDL/pro_src/RODENA/pro/misc/strparse.pro)


TRACE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 		TRACE

 PURPOSE:	Define a path through an image using the image display 
               system and the cursor/mouse.  This routine is designed to
               be used on images which have been displayed with the TVIM
               procedure.

 CATEGORY:	Image processing.

 CALLING SEQUENCE:
	R = trace(xsize,ysize)
       R = trace(xsize,ysize,xverts, yverts, /nodes, /restore, /silent)

 INPUTS:
       xsize,ysize      Size of image array 

 KEYWORD INPUT PARAMETERS:

	RESTORE   if set, originaly displayed image is restored to its
		  original state on completion. 

       NODES     If set index array is not returned.
                 Use this option when positions x and y vertices are
                 all that are required.

	X0,Y0     Lower left image coordinates, default=0,0

	ZOOM      Two element vector specifying zoom factor in x and y,
                 if omitted, [1.,1.] is assumed.  A single scalar value
                 will set both the x and y zoom factors.

       SILENT    If set no intructional printout is issued at the 
                 beginning of execution
 OUTPUTS:
	Function result = subscript vector of pixels along defined path.

 OPTIONAL OUTPUTS:
       XVERTS    Vector of x vertices of traced path
       YVERTS    Vector of y vertices of traced path


 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Display is changed if RESTORE is not set.

 RESTRICTIONS:
	Only works for interactive, pixel oriented devices with a
		cursor and an exclusive or writing mode.
	A path may have at most 1000 vertices.  If this is not enough
		edit the line setting MAXPNTS.
 PROCEDURE:
	The exclusive-or drawing mode is used to allow drawing and
	erasing objects over the original object.

	The operator marks the vertices of the path, either by
	dragging the mouse with the left button depressed or by
	marking individual points along the path by clicking the
	left mouse button, or with a combination of both.

	The center button removes the most recently drawn points.

	Press the right mouse button when finished.  On exit gaps in the 
       traced path are filled by interpolation

 Adapted from DEFROI by : Paul Ricchiazzi    oct92 
                          Earth Space Research Group, UCSB
			   Karsten Rodenacker Jul93	(no !x,!y)

(See /IDL/pro_src/RODENA/pro/misc/trace.pro)


VOL_TIFF_READ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		VOL_TIFF_READ



 PURPOSE:
	Input of 3d-images from sequences of section tif-files and definition of
	data array [red, green, blue].
	File sequences have to be in the form xxxxxyyy.zzz where xxxxx is an arbitrary
	string, yyy a number, starting from NUMBER_FIELD and zzz an arbitrary string 
	according EXTENSION


 CATEGORY:
	3d image I/O


 CALLING SEQUENCE:
	vol = vol_tiff_read(name, NUMBER_FIELD='000', NUMBER_SECTIONS=10)

 
 INPUTS:
	name:		Name prefix of the file sequence, e.g. 'abcd'


 OPTIONAL INPUTS:
	none

	
 KEYWORD PARAMETERS:

	NAME:		Full file sequence specification, no pickfile is used.
			e.g. '/mnt/iliad/series/abcd'

	SPLITTED:	If set the data are returned into variables
			given by keywords RED GREEN BLUE and not
			merged into one array. Function will return 1.

	RED:		Variable for red channel

	GREEN:		Variable for green channel

	BLUE:		Variable for blue channel

	NUMBER_FIELD:	A string describing the first section
			image to be read in, e.g. '27'. ['000']

	NUMBER_SECTIONS:Number of images to be read in starting from NUMBER_FIELD
			[all found]

	EXTENSION:	A string describing the extension ['tif']

	CLSM:		Variable to contain a clsm privat tiff header

	COLOR:		Variable which is set to 1 in case of color
			images. Resulting volume is dimension either
			[3,x,y,z] (color) or [x,y,z] (grey)

	VERBOSE:	Verbose mode

 PROCEDURE:

	Reads sequencially tiff images into a buffer

 EXAMPLE:



 MODIFICATION HISTORY:

       Tue Jul 29 08:23:46 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

(See /IDL/pro_src/RODENA/pro/misc/vol_tiff_read.pro)


WD3D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
		WD3D



 PURPOSE:
		Display, analysis and count of  3D Daten

 CATEGORY:
	3D image analysis


 CALLING SEQUENCE:
	WD3D	only after call of d3l_n

 OPTIONAL INPUTS:
	Labelled image

	
 KEYWORD PARAMETERS:
			General

	NOGALLERY:	No gallery is displayed (def. 0)
	  XVISIBLE
	  YVISIBLE:	Size of gallery (def. 512,512)
	BOX_ALL		Start default box size all (32,32,depth)

			For automatic signal count

	NOSIGNAL_COUNT:	No automatic signal count (def. 0)
	MIN_SIGNAL_VOLUME: Min. signal volume (voxel) (def. 10)
	THRESH_TOPHAT:	Threshold TOPHAT (def. 40)
	  SIZE_TOPHAT:	Size of TOPHAT (def. 3)
	  SIZE_OPENING:	Size of opening after tophat (def. 1)

			For labelling functions

	LABEL:		To reserve space for label volumes
	NAM_LABEL:	Name for label volume file ('')
	  SIZE_NUCLEUS_OPEN: Size of opening nucleus (def. 2)
	  MIN_NUCLEUS_VOLUME	Minimum nucleus volume (def. 3000)
	LONG:		integer signal label volume (def. byte)

			Misc

	GROUP:		Widget_id of main widget
	REBUILD:	Forces rebuild of widgets (for size changes)
	COLOR:		n/a
	VERBOSE:	Full messages

			Keywords used from d3l_n, 
			not used from wd3d (see d3l_n) !

	OVER_COLOR:
	PATH:
	NAME:
	NOTOPHAT:
	NUMBER_FIELD:
	EXTENSION:
	NUMBER_SECTIONS:
	RESULT:



 OUTPUTS:
	Count informations
	Labelled image

 OPTIONAL OUTPUTS:
	Count informations
	Labelled image

 COMMON BLOCKS:
	WD3D_DAT	contains data
	WD3D_INT	internal data

 SIDE EFFECTS:



 RESTRICTIONS:
		Needs preceeding call of procedure D3L_N,
		to load data and establish common's

 PROCEDURE:
	1 Load data by calling d3l_n or the simple interface main
	2 Call wd3d

 EXAMPLE:
	main,/LAB,PATH='~/series'


 MODIFICATION HISTORY:

       Fri Jul 25 16:52:54 1997, Karsten Rodenacker

       Tue Jul 22 16:28:25 1997, Karsten Rodenacker

       Tue Jul 29 08:15:26 1997, Karsten Rodenacker
       <iliad@janus.gsf.de>

(See /IDL/pro_src/RODENA/pro/misc/wd3d.pro)


WD3D_CONTIN

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		wd3d_contin
		
 pro wd3d_contin,name,PRINT=prin
 
 common wd3d_int
 boxarr=strarr(1000)
 wd3d_read,name
 wd3d_count,tit=name,histogram=hi
 print,'Frequencies:',hi(1:7),format='(a,7i4)'
 if keyword_set(prin) then begin
   set_plot,'ps'
   wd3d_count,tit=string(name,hi(1:7),format='(a,x,7i4)')
   lprint,/return
 endif
 end

(See /IDL/pro_src/RODENA/pro/misc/wd3d_contin.pro)


WD3D_MERGE

[Previous Routine] [Next Routine] [List of Routines]
	NAME:
		wd3d_merge
		
 pro wd3d_merge,wild,onam
 na=findfile(wild,cou=cna)
 b=strarr(1000)
 b(0)=string(wild,cna,onam,format="(a,t60,i3,x,a)")
 print,b(0)
 k=1
 for i=0,cna-1 do begin
   print,na(i)
   a=read_s_ascii(na(i))
   sa=size(a)
   l=0
   for j=1,sa(1)-1 do if strlen(a(j)) gt 30 then begin
     b(k)=string(a(j),i,format="(a,i4)") 
     k=k+1
   endif
 endfor
 write_s_ascii,onam,b(0:k)
 end

(See /IDL/pro_src/RODENA/pro/misc/wd3d_merge.pro)


WRITE_S_ASCII

[Previous 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

(See /IDL/pro_src/RODENA/pro/misc/write_s_ascii.pro)