home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.graphics:14182 comp.graphics.visualization:2075
- Newsgroups: comp.graphics,comp.graphics.visualization
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!centi!mavuduru
- From: mavuduru@centi.cs.umn.edu (Rama Mavuduru)
- Subject: Re: Contouring advice/code sought
- Message-ID: <mavuduru.727984162@centi>
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Nntp-Posting-Host: centi.cs.umn.edu
- Organization: University of Minnesota
- References: <30707@castle.ed.ac.uk>
- Distribution: comp
- Date: Mon, 25 Jan 1993 17:49:22 GMT
- Lines: 42
-
- In <30707@castle.ed.ac.uk> eonu24@castle.ed.ac.uk (I Reid) writes:
-
- >I need advice (or preferably code) to convert 2D data sets (512 x 298 of
- >8 bit integer data) to contour lines.
-
- >I have a number of microscopy images which I want to contour and my
- >attempts to find explanations/code to do this have failed so far, so...
-
-
- Here's the trick:
-
- The data is function values on uniform rectangular grid.
-
- Consider a rectangle of the grid.
-
- Split the rectangle into two triangles along a diagonal.
-
- Consider a triangle. Let the function values
- be F1, F2, and F3, at the vertices V1, V2, and
- V3, respectively.
-
- Let Fc be the contour value.
-
- If F1 <= Fc < F2, the contour passes through
- the edge V1V2. The contour point on this edge
- is found by linear interpolation.
-
- Similary for other edges of the triangle.
-
- This procedure will yeild two points per triangle if
- the contour passes through the triangle.
-
- Join these two points with a line.
-
- Repeat this for the other triangle in the rectangle.
-
- Repeat this for other rectangles of the grid.
-
- This will give the contour of the value Fc on the rectangular grid.
-
- ---
- Rama Mavuduru
-