|
Re: contour [message #10066 is a reply to message #8458] |
Fri, 03 October 1997 00:00   |
hcp
Messages: 41 Registered: August 1995
|
Member |
|
|
|> R. Bauer wrote:
|> > Who can explain me the cell_fill flag by contour.
[and Martin Schultz replied]
|> cell_fill splits the area to be filled into a number of smaller
|> cells (I think they are rectangles) instead of using some sophisticated
|> fill algorithm that uses the outline (contourline) of the area to be
|> filled. There are occasions when the standard fill produces very weird
|> results (I encountered these, but forgot how I made it), in these cases
|> cell_fill will be much more robust. It may be a good idea to try out
|> both algorithms (with and without cell_fill) if you have contour plots
|> with a lot of variety, many gaps in the data or other somewhat ill-posed
|> problems.
Also, be warned that in IDL 5.0 the cell_fill keyword does the same
as the fill keyword.
In IDL 5.0.2 /cell_fill is back but has bugs which occur on
map projections (one of the main places where you need cell_fill in
the first place). RSI are aware
of this. The workaround they suggest is to use this short program as
a wrapper around contour.
; ************************************************************ **
PRO CONTOUR_CELL, z, x, y, _EXTRA=e
; This program was supplied by RSI as a fix for the bigs in the
; cell_fill algorithm of the contour
; routine. contour_cell,data,xgrid,ygrid,/cell_fill will work where
; contour ,data,xgrid,ygrid,/cell_fill will not
nx = n_elements(x) ;Divide a rectangular grid into
;triangles
ny = n_elements(y)
tr = lonarr(6, nx-1, ny-1, /NOZERO)
for iy=0, ny-2 do for ix=0,nx-2 do $ ;Make the triangles
tr(0, ix, iy) = [0, 1, nx+1, 0, nx+1, nx] + (ix + iy*nx)
;2/cell
CONTOUR, z, x # replicate(1,ny), replicate(1,nx) # y, $
TRIANGULATION=tr, _EXTRA=e
end
; ************************************************************ **
Hugh
--
============================================================ ==============
Hugh C. Pumphrey | Telephone 0131-650-6026
Department of Meteorology | FAX 0131-662-4269
The University of Edinburgh | Replace 0131 with +44-131 if outside U.K.
EDINBURGH EH9 3JZ, Scotland | Email hcp@met.ed.ac.uk
OBDisclaimer: The views expressed herein are mine, not those of UofE.
============================================================ ==============
|
|
|
Re: contour [message #10072 is a reply to message #8458] |
Thu, 02 October 1997 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
R. Bauer wrote:
>
> Hi
>
> Who can explain me the cell_fill flag by contour.
>
> Thanks
>
> --
> R.Bauer
>
> Institut fuer Stratosphaerische Chemie (ICG-1)
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
Hi Reimar,
cell_fill splits the area to be filled into a number of smaller
cells (I think they are rectangles) instead of using some sophisticated
fill algorithm that uses the outline (contourline) of the area to be
filled. There are occasions when the standard fill produces very weird
results (I encountered these, but forgot how I made it), in these cases
cell_fill will be much more robust. It may be a good idea to try out
both algorithms (with and without cell_fill) if you have contour plots
with a lot of variety, many gaps in the data or other somewhat ill-posed
problems.
Regards,
Martin
------------------------------------------------------------ ------------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ ------------
|
|
|
Re: Contour [message #15318 is a reply to message #8458] |
Fri, 30 April 1999 00:00  |
VU KHAC Tri
Messages: 25 Registered: March 1999
|
Junior Member |
|
|
Hi,
Suppose you have 2D BW image (0-black, 1-white)
img1 = AddBorderToImage(img, 1, 1, 1, 1)
img2 = shift(img1,1,1)
img3 = shift(img1,0,1)
img4 = shift(img1,-1,1)
img5 = shift(img1,0,1)
img6 = shift(img1,0,-1)
img7 = shift(img1,-1,1)
img8 = shift(img1,-1,0)
img9 = shift(img1,-1,-1)
My_Contour = (img1 EQ 1) AND ((img1 NE img2) OR (img1 NE img3) OR (img1 NE
img4) OR ...(img1 NE img())
My_Contour = TrimBorderOfImage(My_Contour, 1,1,1,1)
My_Contour now is the image of the contour of BW image.
Regards,
Tri.
> Ciao,
>
> I want to extract the contour of lungs in CT-images. Therefore I created
> an black/white image, where the threshold can be selcted by the user. I
> want to overlay the resulting contour of black/white image with the
> original image. Unfortunatly the returned contour is tiny and is not
> congruent with the original. How can I magnify the contour and fit it in
> the given frame?
> So far my code is looking like that:
>
> contour, contrast,path_xy=x,y,Path_info=pafo
>
> FOR I=0,(n_Elements(pafo)-1) DO BEGIN
> s=[ indgen(pafo(I).N),0]
> Ploats,xy(*,pafo(I).Offset + s),/Norm
> ENDFOR
>
> Regards, Ruth
|
|
|