def testMarkInclusions(self): from ImageProcessing.LoadZStack import LoadZStack from ImageProcessing.MarkInclusions import MarkInclusions loader = LoadZStack() loader.paramPath.value = importDir loader.paramDz.value = '100.0 mum' loader.paramDy.value = '1.29 mum' loader.paramDx.value = '1.29 mum' zstack = loader.loadImageAsGreyScale() from ImageProcessing.AutoFocus import AutoFocus afw = AutoFocus() statistics = afw.getStatistics(zstack) minc = MarkInclusions() marked = minc.markInclusions(zstack, statistics) self.assertEqual(zstack.dimensions, marked.dimensions) self.assertEqual(zstack.unit, marked.unit)
def testSingle(self): print "Importing single image..." from ImageProcessing.LoadZStack import LoadZStack loader = LoadZStack() loader.paramPath.value = os.path.join(importDir, 'TestZStack_z00.tif') loader.paramDz.value = '100.0 mum' loader.paramDy.value = '1.29 mum' loader.paramDx.value = '1.29 mum' loader.paramStartz.value = '300.0 mum' loader.paramZClip.value = '3:4' zstack = loader.loadImageAsGreyScale() print "Done." print "Calculating single image statistics..." from ImageProcessing.AutoFocus import AutoFocus afw = AutoFocus() statistics = afw.getStatistics(zstack) print "Done." assert len(statistics['diameter'].data) == 2 imax = statistics['diameter'].data.argmax() imin = statistics['diameter'].data.argmin() mul = 1.29 self.check((200.0 * mul, mul), statistics['xPos'].data[imax]) self.check((200.0 * mul, mul), statistics['yPos'].data[imax]) self.check((300.0, 0.0), statistics['zPos'].data[imax]) self.check((20.7 * mul, 3 * mul), statistics['diameter'].data[imax]) self.check((53.0 * mul, mul), statistics['xPos'].data[imin]) self.check((53.0 * mul, mul), statistics['yPos'].data[imin]) self.check((300.0, 0.0), statistics['zPos'].data[imin]) self.check((7.0 * mul, mul), statistics['diameter'].data[imin])