def assertEqualRot(self, image, proof, cases=1):
     for n in xrange(cases):
         rotIm = numpy.rot90(image, n)
         result = list(
             IM.checkNeighbours(rotIm)) + [IM.checkTransitions(rotIm)]
         self.assertEqual(
             result, proof,
             "The neighbourhood fingerprint should be %s, but is %s for \n%s!"
             % (proof, result, image))
 def test3DirectConnectedPixelCorner(self):
     """If three pixels are directly connected at an corner to the central pixel, the latter has 3 neighboured feature pixels, 2 closely neighboured background pixels, and 1 transition from feature to background, while the corner position depends on the orientation of the corner."""
     self.binIm[2,:2] = self.F
     self.binIm[1,0]  = self.F
     for n in xrange(4):
         proof = [3,2,n+1,1]
         rotIm = numpy.rot90(self.binIm,n)
         result = list(IM.checkNeighbours(rotIm))+[IM.checkTransitions(rotIm)]
         self.assertEqual(result,proof,"The neighbourhood fingerprint should be %s, but is %s for \n%s!"%(proof,result,rotIm))
Example #3
0
 def test3DirectConnectedPixelCorner(self):
     """If three pixels are directly connected at an corner to the central pixel, the latter has 3 neighboured feature pixels, 2 closely neighboured background pixels, and 1 transition from feature to background, while the corner position depends on the orientation of the corner."""
     self.binIm[2,:2] = self.F
     self.binIm[1,0]  = self.F
     for n in xrange(4):
         proof = [3,2,n+1,1]
         rotIm = numpy.rot90(self.binIm,n)
         result = list(IM.checkNeighbours(rotIm))+[IM.checkTransitions(rotIm)]
         self.assertEqual(result,proof,"The neighbourhood fingerprint should be %s, but is %s for \n%s!"%(proof,result,rotIm))
 def setUp(self):
     #Compute thin quarter ring feature
     self.quarterRing = ring()
     #Computer broad quarter ring feature
     self.broadQuarterRing = ring(width=3)
     #get Worker
     self.worker = IM.SkeletonizeFeature(None)
 def setUp(self):
     self.dim = 11
     self.worker = IM.SkeletonizeFeature(None)
     self.feature = TDM.stringFeature(self.dim,
                                      directions=2,
                                      distanceToBorder=2)
     self.wideFeature = TDM.stringFeature(self.dim, width=3, directions=2)
 def assertEqualRot(self,image,proof,cases=1):
     for n in xrange(cases):
         rotIm = numpy.rot90(image,n)
         result = list(IM.checkNeighbours(rotIm)) + [IM.checkTransitions(rotIm)]
         self.assertEqual(result,proof,"The neighbourhood fingerprint should be %s, but is %s for \n%s!"%(proof,result,image))
 def setUp(self):
     self.dim = 11
     self.worker = IM.SkeletonizeFeature(None)
     self.skeleton = TDM.stringFeature(self.dim, distanceToBorder=2)