示例#1
0
 def test_rhoAsh_equ_correct2(self):
     hu = uniform(0,2000)
     self.param['calibrationCorrect'] = True
     self.param['numCTparam'] = 'single'
     self.param['rhoAsha1'] = uniform(0,2000)
     self.param['rhoAshb1'] = uniform(0,2000)
     rhoQCT, rhoAsh, modulus = _define_equations(self.param)
     self.assertEqual(rhoAsh(rhoQCT(hu)), self.param['rhoAsha1'] + (hu*self.param['rhoAshb1']))
示例#2
0
 def setUp(self):
     self.vtk = create_vtk()
     self.voxels = [[1, 2], [6, 10, 12], [13, 16, 18, 22], [26]]        
     self.param = {'integration': 'E',
                   'rhoQCTa': 0.,
                   'rhoQCTb': 1.,
                   'calibrationCorrect': False,
                   'numEparam': 'single',
                   'minVal': 0.0001,
                   'Ea1': 0.,
                   'Eb1': 1.,
                   'Ec1': 1.}  
     self.rhoQCT_equ, self.rhoAsh_equ, self.modulus_equ = _define_equations(self.param)  
     self.moduli = [[_apply_equations(self.vtk.lookup[i], 
                                  self.rhoQCT_equ, 
                                  self.rhoAsh_equ, 
                                  self.modulus_equ) for i in v] for v in self.voxels]  
     self.mean_moduli = [mean(m) for m in self.moduli]
示例#3
0
 def test_rhoAsh_equ_correct3(self):
     hu = uniform(0,2000)
     self.param['calibrationCorrect'] = True
     self.param['numCTparam'] = 'triple'
     self.param['rhoAsha1'] = uniform(0,2000)
     self.param['rhoAshb1'] = uniform(0,2000)
     self.param['rhoAsha2'] = uniform(0,2000)
     self.param['rhoAshb2'] = uniform(0,2000)
     self.param['rhoAsha3'] = uniform(0,2000)
     self.param['rhoAshb3'] = uniform(0,2000)
     tmp = [uniform(0,2000), uniform(0,2000)]
     self.param['rhoThresh1'] = min(tmp)
     self.param['rhoThresh2'] = max(tmp)
     self.param['rhoQCTa'] = 0.
     self.param['rhoQCTb'] = 1.
     rhoQCT, rhoAsh, modulus = _define_equations(self.param)
     if rhoQCT(hu) < self.param['rhoThresh1']:
         res = self.param['rhoAsha1'] + (self.param['rhoAshb1'] * rhoQCT(hu))
     elif (rhoQCT(hu) >= self.param['rhoThresh1']) & (rhoQCT(hu) <= self.param['rhoThresh2']):
         res = self.param['rhoAsha2'] + (self.param['rhoAshb2'] * rhoQCT(hu))
     else:
         res = self.param['rhoAsha3'] + (self.param['rhoAshb3'] * rhoQCT(hu))
     self.assertEqual(rhoAsh(rhoQCT(hu)), res)
示例#4
0
 def test_rhoAsh_equ_correct(self):
     hu = uniform(0,2000)
     self.param['rhoQCTa'] = uniform(0,2000)
     self.param['rhoQCTb'] = uniform(0,2000)
     rhoQCT, rhoAsh, modulus = _define_equations(self.param)
     self.assertEqual(rhoAsh(rhoQCT(hu)), self.param['rhoQCTa'] + (hu*self.param['rhoQCTb']))