find_boundary routine [message #38644] |
Thu, 18 March 2004 14:06 |
brian_frizzelle
Messages: 2 Registered: March 2004
|
Junior Member |
|
|
Let me apologize if this post is a bit lengthy. And in case it's
important, I'm using IDL 6.0 on a Windows machine.
I need help calculating the perimeters of regions. I have an input
array of roughly 900 by 1200 cells which contains 15 different
categories (coded 1 through 15). For each category, I need to find the
total perimeter length among all of its regions.
I found David Fanning's FIND_BOUNDARY routine and ran it on this
array, but it seemed to stop at the first region that it found. So I
wrote a script that subsetted each array first by category, then by
region within the category (regions were created with LABEL_REGION).
Running FIND_BOUNDARY again, I got an output for each category, but
the numbers seemed off.
So I resorted to creating a simple 5x5 array with two categories, one
region each, to test the perimeter output of FIND_BOUNDARY.
- Category 1 has 16 cells and a perimeter of 18.
- Category 2 has 9 cells and a perimeter of 18.
* FIND_BOUNDARY output a perimeter of 2 for each category.
* FIND_BOUNDARY also only give me an output array with 2 X/Y
coordinates.
Has anyone else found this to be a problem? Maybe I'm passing in the
wrong parameters. Here are the details of what I've done so far. Any
help would be greatly appreciated.
Brian Frizzelle
-------------------------
arrayTest: regCat1: regCat2:
1 1 1 2 2 1 1 1 0 0 0 0 0 1 1
1 1 1 2 2 1 1 1 0 0 0 0 0 1 1
1 1 1 1 2 1 1 1 1 0 0 0 0 0 1
1 1 1 1 2 1 1 1 1 0 0 0 0 0 1
1 1 2 2 2 1 1 0 0 0 0 0 1 1 1
IDL> bndry = find_boundary(regCat1, XSize=5, YSize=5, Perimeter=perim)
IDL> print, perim
2.0000000
IDL> print, bndry
0 0
0 1
|
|
|