Exemplo n.º 1
0
 def flipDec_Perm(self, tooth):
     '''
     switches a deciduous tooth to a permanent one,
     and viceVersa pass a variable like "ur5"
     '''
     quadrant = tooth[:2]
     pos = int(tooth[2]) - 1                 # will be 0-7
     if quadrant == "ul":
         var = self.dent1
         pos = 7 - pos
     elif quadrant == "ur":
         var = self.dent0
     elif quadrant == "ll":
         var = self.dent2
     else:  # lr
         var = self.dent3
         pos = 7 - pos
     existing = dec_perm.fromSignedByte(var)
     if existing[pos] == "1":
         existing = existing[:pos] + "0" + existing[pos + 1:]
     else:
         existing = existing[:pos] + "1" + existing[pos + 1:]
     if quadrant == "ul":
         self.dent1 = dec_perm.toSignedByte(existing)
     elif quadrant == "ur":
         self.dent0 = dec_perm.toSignedByte(existing)
     elif quadrant == "ll":
         self.dent2 = dec_perm.toSignedByte(existing)
     else:  # lr
         self.dent3 = dec_perm.toSignedByte(existing)
     self.updateChartgrid()
Exemplo n.º 2
0
 def flipDec_Perm(self, tooth):
     '''
     switches a deciduous tooth to a permanent one,
     and viceVersa pass a variable like "ur5"
     '''
     quadrant = tooth[:2]
     pos = int(tooth[2]) - 1  # will be 0-7
     if quadrant == "ul":
         var = self.dent1
         pos = 7 - pos
     elif quadrant == "ur":
         var = self.dent0
     elif quadrant == "ll":
         var = self.dent2
     else:  # lr
         var = self.dent3
         pos = 7 - pos
     existing = dec_perm.fromSignedByte(var)
     if existing[pos] == "1":
         existing = existing[:pos] + "0" + existing[pos + 1:]
     else:
         existing = existing[:pos] + "1" + existing[pos + 1:]
     if quadrant == "ul":
         self.dent1 = dec_perm.toSignedByte(existing)
     elif quadrant == "ur":
         self.dent0 = dec_perm.toSignedByte(existing)
     elif quadrant == "ll":
         self.dent2 = dec_perm.toSignedByte(existing)
     else:  # lr
         self.dent3 = dec_perm.toSignedByte(existing)
     self.updateChartgrid()
Exemplo n.º 3
0
 def updateChartgrid(self):
     grid = ""
     for quad in (self.dent1, self.dent0, self.dent3, self.dent2):
         grid += dec_perm.fromSignedByte(quad)
     for pos in mouth:
         if grid[mouth.index(pos)] == "0":
             self.chartgrid[pos] = pos
         else:
             self.chartgrid[pos] = decidmouth[mouth.index(pos)]
Exemplo n.º 4
0
 def updateChartgrid(self):
     '''
     a legacy issue with openmolar is the way teeth are saved as present
     is as 4 bytes (32 bits = 32 teeth). very frugal storage, but requires
     a fair deal of client computation :(
     '''
     grid = ""
     for quad in (self.dent1, self.dent0, self.dent3, self.dent2):
         grid += dec_perm.fromSignedByte(quad)
     for pos in mouth:
         if grid[mouth.index(pos)] == "0":
             self.chartgrid[pos] = pos
         else:
             self.chartgrid[pos] = decidmouth[mouth.index(pos)]
Exemplo n.º 5
0
 def updateChartgrid(self):
     '''
     a legacy issue with openmolar is the way teeth are saved as present
     is as 4 bytes (32 bits = 32 teeth). very frugal storage, but requires
     a fair deal of client computation :(
     '''
     grid = ""
     for quad in (self.dent1, self.dent0, self.dent3, self.dent2):
         grid += dec_perm.fromSignedByte(quad)
     for pos in mouth:
         if grid[mouth.index(pos)] == "0":
             self.chartgrid[pos] = pos
         else:
             self.chartgrid[pos] = decidmouth[mouth.index(pos)]
Exemplo n.º 6
0
    def _is_deciduous(self, quadrant, tooth):
        '''
        chart - returns True if the tooth is present.
        '''
        if quadrant == 1:
            att = self.pt.dent0
        elif quadrant == 2:
            att = self.pt.dent1
        elif quadrant == 3:
            att = self.pt.dent2
        elif quadrant == 4:
            att = self.pt.dent3
        else:
            return False

        array = dec_perm.fromSignedByte(att)
        if quadrant in (2, 4):
            array = list(reversed(array))
        return array[tooth - 1] == "1"
Exemplo n.º 7
0
    def _is_deciduous(self, quadrant, tooth):
        '''
        chart - returns True if the tooth is present.
        '''
        if quadrant == 1:
            att = self.pt.dent0
        elif quadrant == 2:
            att = self.pt.dent1
        elif quadrant == 3:
            att = self.pt.dent2
        elif quadrant == 4:
            att = self.pt.dent3
        else:
            return False

        array = dec_perm.fromSignedByte(att)
        if quadrant in (2,4):
            array = list(reversed(array))
        return array[tooth-1] == "1"