Polygon dissolve logic started.
Dissolve can locate and enclose a connected polygonal
region (in box coordinates) containing equi-valued pixels.
The traversal needs to be written to create the polygon in
coordinate space and zero edges in box coordinates, leaving
the pixel marks (in box coordinates) in place.  README.md
modified to include new help. Possible modifications:
nodata could be flagged as "visited." (even,even) coordinates
in box space could be marked to guide the traversal (maybe).
vertex algebra defined, proper orientations in [r,c] box coordinates i
and (i,j) raster coordinate spaces defined.
Vertex algebra operations added. This can leave isolated nonzero
vertices. And connected zero vertices as well. Nevertheless,
the edge and vertex algebra provides enough information to
traverse the polygon...
First attempted traversal algorithm.
Basic traversal algorithm seems to work! Need several test cases
Also, this must be combined with nextVertex(). Essentially, this
is, while nextVertex(): traverse()
Direction map added to make verification easier.
Removed unnecessary print statement. nextValid() logic corrected.
Always finish the current row, then advance to others.
The initial marking procedure is wasteful and exceeds stack limits.
Before moving, mark 8: top, left, right bot, then left and right of top and
left and right of bottom.
Complete revision of traversal algorithm
Initial square marked
A generic example has been found: a genus two configuration,
especially a genus 2 with deeply embedded holes. The initial
configuration can be modified. The starting configuration
assumed that right is always valid, but this can lead to
a move right through a region into a hole, around which
the program will cycle endlessly. A solution is two part.
First mark the visited squares with a region number.
This will become a map later to point to a data structure:
region n will have a pointer to a polygon. The outer loop
and inner loop will be added.  The generic example leads to
two cases:

A) At potential starting vertex [r, c].  Direction is RIGHT.

The inside and outside boxes have the same class. You
CANNOT go right without crossing the region.

Point LEFT from upper left corner.

A1) If the inside box has the same class, this cannot be
a starting point.  Mark the box at [r+1,c+1] with the same
region number, and exit. CHECKSUM: the boxes above and left
should be in the same region.

A2) If the inside box has a different class, proceed ccw.
You are now circumscribing an inner ring of the region.
The dissolve algorithm, if this is correct, handles inner rings.
Reversing the direction from right to left changes the traversal
from clockwise to counterclockwise without changing the logic.
Almost magical.
Handles genus 0 and 1 cases. Genus 2 needs additional work.
Maintaining region -> class list. The starting point is checked
in case this crosses a deleted edge. A region to start coordinate
map could be maintained. Later regions could be contained in
holes of other regions. A hole can be a disjoint union of
polygons in general. This means that the defining characteristic
of a hole is a surrounded union of regions, bounded everywhere
by the same region.

Can make a list of potential holes: these occur when
at [r, c] the top class equals myCls and the leftclass
is defined and different from myCls. The starting point
and outer region should be noted.

These can be (should be) traversed in counter clockwise order.
It requires a kind of second pass.

But then the shapefile data structures might as well be constructed
in memory.
Some debugging code. It is essential to classify (quantize) the
file first. The classification matters (one might want irregular
histograms).
Arcinfo.py does reclassification by equal area histogram or
equal division histogram calculations. (Needs to write out the file.)
Have to check changes to arcinfo.py...
First working version of ArcInfo Grid ASCII to ArcInfo Grid ASCII
reclassification program. Should add illustration.
Some remarks on arcinfo.py.
Aggressive marking during traversal phase -- maybe make this an option.
Next the traversal of potential holes during the second pass. This could
be combined with the first pass, but this will complicate the logic of
a program that needs to be run once per dataset...
Elimination of redundant if else: in isInOut(); addition if
isInOutReg().