Exemplo n.º 1
0
def tryToLoadDataset(path, iFileLoader):
	# Return None if the dataset could not be loaded for any reason
	logger = LoggerFactory.getLogger("DatasetProvider.tryToLoadDataset")

	if not os.path.exists(path):
		logger.info('Path {} does not exist, returning None', path)
		return None

	try:
		dataset = loadImageIntoSFH(path, iFileLoader)[0] # a dataset
		if not len(dataset.shape) == 2:
			logger.error('Expected 2 dimensions but found %r when sanity checking image %r using loader %r' % (dataset.shape, path, iFileLoader))
			print "*" * 80
			print "DatasetProvider.tryToLoadDataset got a dataset with ", dataset.shape, " dimensions."
			print "The analysis code will try again to load the image, and unless it times out everything is *OKAY*"
			print "Please call DASC support to report this (tricky to track down) bug"
			print "*" * 80
			return None
		logger.debug('Returning dataset {} from path {}', dataset, path)
		return dataset
	except:
		logger.error('Error loading or sanity checking image %r using loader %r :\n %s' % (path, iFileLoader, ''.join(traceback.format_exception(*sys.exc_info()))))
		return None
Exemplo n.º 2
0
	def setUp(self):
		self.ds = loadImageIntoSFH(TESTFILE)[0]
		self.p = TwodGaussianPeak()
Exemplo n.º 3
0
	def setUp(self):
		self.ds = loadImageIntoSFH(TESTFILE)[0]
		self.p = SumMaxPositionAndValue()
Exemplo n.º 4
0
 def setUp(self):
     self.ds = loadImageIntoSFH(TESTFILE)[0]
     self.p = TwodGaussianPeak()
Exemplo n.º 5
0
 def setUp(self):
     self.ds = loadImageIntoSFH(TESTFILE)[0]
     self.p = SumMaxPositionAndValue()
	def readout(self):
		return loadImageIntoSFH(self.path)[0]#, self.iFileLoader)[0]
Exemplo n.º 7
0
	def __load(self, retryUntilTimeout = True):
		if retryUntilTimeout == False or self.fileLoadTimout == None:
			self.dataset = loadImageIntoSFH(self.path, self.iFileLoader)[0]
		else:
			self.dataset = self.__keepTryingToLoadDataset()
Exemplo n.º 8
0
 def testLoadIntoSFH(self):
     sfh = loadImageIntoSFH(TESTFILE)
     self.assert_(sfh is not None)
Exemplo n.º 9
0
 def testLoadOddImageIntoSFH(self):
     sfh = loadImageIntoSFH(IPP_XRAY_EYE_FILE)
     self.assert_(sfh is not None)
Exemplo n.º 10
0
 def testLoadOddImageIntoSFHWithStandardTIFFLoader(self):
     sfh = loadImageIntoSFH(IPP_XRAY_EYE_FILE, TIFFImageLoader)
     self.assert_(sfh is not None)
Exemplo n.º 11
0
 def testLoadIntoSFHWithExplicitLoader(self):
     sfh = loadImageIntoSFH(TESTFILE, TIFFImageLoader)
     self.assert_(sfh is not None)