示例#1
0
 def test_position_cell(self):
     stack = Stack()
     stack.image = np.zeros([10, 10, 10])
     ind = np.where(np.ones([3, 3, 3]) > 0)
     cell = Cell(ind=ind)
     cell.position = (1, 1, 1)
     stack.position_cell(cell)
     self.assertEqual(np.sum(stack.image > 1), 27)
示例#2
0
 def test_position_cell3(self):
     stack = Stack()
     stack.image = np.zeros([10, 6, 6])
     cell = Cell()
     cell.image = np.zeros([15, 8, 8])
     cell.image[8:10, 2:-1, 2:-1] = 255
     cell.position = ndimage.center_of_mass(np.ones_like(stack.image))
     stack.position_cell(cell)
     self.assertEqual(np.sum(stack.image > 0), np.sum(cell.image > 0))
示例#3
0
 def test_position_cell2(self):
     stack = Stack()
     stack.image = np.zeros([10, 10, 10])
     ind = np.where(np.ones([3, 3, 3]) > 0)
     cell = Cell(ind=ind)
     cell.position = (1, 1, 1)
     stack.position_cell(cell)
     cell.position = (5, 5, 5)
     stack.position_cell(cell)