Peter554 / StainTools

Tools for tissue image stain normalisation and augmentation in Python 3
MIT License
321 stars 107 forks source link

A bug?? #2

Closed lily10086 closed 6 years ago

lily10086 commented 6 years ago

LinAlgError Traceback (most recent call last)

in () 1 n=stainNorm_Macenko.normalizer() ----> 2 n.fit(i1) 3 normalized=utils.build_stack((i1,n.transform(i2),n.transform(i3),n.transform(i4),n.transform(i5),n.transform(i6))) /home/liuzhisheng/stain_Normalization/stainNorm_Macenko.pyc in fit(self, target) 55 def fit(self, target): 56 target = ut.standardize_brightness(target) ---> 57 self.stain_matrix_target = get_stain_matrix(target) 58 self.target_concentrations = ut.get_concentrations(target, self.stain_matrix_target) 59 /home/liuzhisheng/stain_Normalization/stainNorm_Macenko.pyc in get_stain_matrix(I, beta, alpha) 25 OD = ut.RGB_to_OD(I).reshape((-1, 3)) 26 OD = (OD[(OD > beta).any(axis=1), :]) ---> 27 _, V = np.linalg.eigh(np.cov(OD, rowvar=False)) 28 V = V[:, [2, 1]] 29 if V[0, 0] < 0: V[:, 0] *= -1 /home/liuzhisheng/anaconda2/lib/python2.7/site-packages/numpy/linalg/linalg.pyc in eigh(a, UPLO) 1274 1275 signature = 'D->dD' if isComplexType(t) else 'd->dd' -> 1276 w, vt = gufunc(a, signature=signature, extobj=extobj) 1277 w = w.astype(_realType(result_t), copy=False) 1278 vt = vt.astype(result_t, copy=False) /home/liuzhisheng/anaconda2/lib/python2.7/site-packages/numpy/linalg/linalg.pyc in _raise_linalgerror_eigenvalues_nonconvergence(err, flag) 94 95 def _raise_linalgerror_eigenvalues_nonconvergence(err, flag): ---> 96 raise LinAlgError("Eigenvalues did not converge") 97 98 def _raise_linalgerror_svd_nonconvergence(err, flag): LinAlgError: Eigenvalues did not converge
lily10086 commented 6 years ago

I use your data..

Peter554 commented 6 years ago

I see you are using Python 2.7? I have only tested the code with Python 3.5 - that could be part of the problem?

lily10086 commented 6 years ago

OO,Thanks