Skip to content.
CCB > CCBSIGS > ShapeToolLibraryProgram > ContourTopologyChecker

Contour Topology Checker

version: 1.0.3

Overview

This program examines a group of flattened contours (see MapContour to flatten the contours) to determine if any contours in the group cross the edges of the two dimensional map obtained by flattening the three dimensional surface (flatmap).

Applications that attempt to create averages from such contours will fail unless the original three dimensional topology (implied by the flattened map) is fully accounted for; such lines may be referred to as having 'fallen off' the edge of the two dimensional flattened surface.

This program is useful to determine whether a particular contour may be properly handled by warping protocols that do not account for all these special case topologies. This enables a user of such protocols to prune troublesome contours before starting the time consuming warping process.

The tests applied are:

  • if any vertex in any contour is not on the manifold ("lines fall off"), fail.
  • if any vertex in any contour is within a small distance default=1 of the two dimensional map space boundary, fail.
  • if any vertex is closer to an optional reference vertex (in a reference contour) than a specified distance, fail.
  • if the reference vertices are provided, the vertices in the reference contour have the first two tests applied to them, as well.

Project Components

A sample shell script

This C- Shell script determines which contours contain segments that extend over the edges of the 2d square onto which they are flattened.


#!/bin/csh

# this script determines which of a set of input contours
# contain segments that cross the bounds of the 2D, 256x256 space onto
# which they are flattened.


# version 7 January 2008

set verboseArg="-verbose "

# directory wth contour lines
set linesDir=data/10580/lines/R
set outputDir=output
mkdir -p ${outputDir}


# the surface on which these lines were drawn
set surface=data/10580/surface/10580_n3_305_6p_450_R.obj

# path to the output report 
set report="10580.fallen.txt"

# define the applications to use

# directory containing application jar files.
set jarDir=/nethome/users/shapetls/ShapeTools

# path to MapContour
set flattenContour=${jarDir}/MapContour.jar

# path to ContourTopologyCheck
set checkTopology=${jarDir}/ContourTopologyCheck.jar


foreach i ($linesDir/*.obj)
  set output=${outputDir}/$i:t
  echo "flattening contour $i into ${output}"
  java -jar ${flattenContour} ${verboseArg} -overwrite -shape ${surface}  -contour ${i} -output ${output}

  set output=$i:t
  set output=$output:r.dual.obj
  set output=${outputDir}/$output
  echo "flattening contour $i dual into ${output}"
  java -jar ${flattenContour} ${verboseArg} -dual -overwrite -shape ${surface}  -contour ${i} -output ${output}end

# check for flattened lines containiing vertices not in standard 2d flatmap space  ('falling off')

echo "checking for contour(s) that will fail"
java -jar ${checkTopology} ${verboseArg} -overwrite -directory ${outputDir}  -failed -report ${report}

echo "Done. The output report is in file ${report}"