Change some matplotlib.tri calls to use scipy.spatial.Delaunay#649
Change some matplotlib.tri calls to use scipy.spatial.Delaunay#649David-Baddeley wants to merge 2 commits into
Conversation
…jittered triangulation calls. Note: calcNeighbourDists still uses matplotlib.tri as we need the .edges property.
There was a problem hiding this comment.
Lintly has detected code quality issues in this pull request.
| from PYME.Analysis.points.SoftRend import drawTriang, drawTriangles | ||
| xs = T.x[T.triangles] | ||
| ys = T.y[T.triangles] | ||
| #xs = T.x[T.triangles] |
There was a problem hiding this comment.
E265: block comment should start with '# '
| #ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
|
|
||
| verts = T.points[T.simplices] | ||
| xs = verts[:,:,0] |
There was a problem hiding this comment.
E231: missing whitespace after ','
| #ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
|
|
||
| verts = T.points[T.simplices] | ||
| xs = verts[:,:,0] |
There was a problem hiding this comment.
E231: missing whitespace after ','
| ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
| #xs = T.x[T.triangles] # x posititions of vertices [nm], dimensions (# triangles, 3) | ||
| #ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
|
|
There was a problem hiding this comment.
W293: blank line contains whitespace
| xs = T.x[T.triangles] # x posititions of vertices [nm], dimensions (# triangles, 3) | ||
| ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
| #xs = T.x[T.triangles] # x posititions of vertices [nm], dimensions (# triangles, 3) | ||
| #ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) |
There was a problem hiding this comment.
E265: block comment should start with '# '
| from PYME.Analysis.points.SoftRend import drawTriang, drawTriangles | ||
| xs = T.x[T.triangles] # x posititions of vertices [nm], dimensions (# triangles, 3) | ||
| ys = T.y[T.triangles] # y posititions of vertices [nm], dimensions (# triangles, 3) | ||
| #xs = T.x[T.triangles] # x posititions of vertices [nm], dimensions (# triangles, 3) |
There was a problem hiding this comment.
E265: block comment should start with '# '
Codecov Report
@@ Coverage Diff @@
## master #649 +/- ##
==========================================
- Coverage 11.37% 11.37% -0.01%
==========================================
Files 631 631
Lines 72396 72398 +2
==========================================
Hits 8234 8234
- Misses 64162 64164 +2
Continue to review full report at Codecov.
|
|
Still need to use @barentine's and then the following TracebackCreated colour filter with chans: ['chan1', 'chan0']
/Users/zachcm/Code/python-microscopy/PYME/IO/DataSources/ArrayDataSource.py:45: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
r = self.data.__getitem__(keys)
RecipeView._layout
Traceback (most recent call last):
File "/Users/zachcm/Code/python-microscopy/PYME/recipes/base.py", line 665, in execute
m.execute(self.namespace)
File "/Users/zachcm/Code/python-microscopy/PYME/recipes/base.py", line 1219, in execute
namespace[self.outputName] = self.filter(namespace[self.inputName])
File "/Users/zachcm/Code/python-microscopy/PYME/recipes/base.py", line 1208, in filter
filt_ims = [np.atleast_3d(self.applyFilter(image.data[:,:,:,chanNum].squeeze().astype('f'), chanNum, 0, image)) for chanNum in range(image.data.shape[3])]
File "/Users/zachcm/Code/python-microscopy/PYME/recipes/base.py", line 1208, in
filt_ims = [np.atleast_3d(self.applyFilter(image.data[:,:,:,chanNum].squeeze().astype('f'), chanNum, 0, image)) for chanNum in range(image.data.shape[3])]
File "/Users/zachcm/Code/python-microscopy/PYME/recipes/processing.py", line 74, in applyFilter
threshold = thresholding.otsu(data, nbins=self.n_histogram_bins, bin_spacing=self.bin_spacing)
File "/Users/zachcm/Code/python-microscopy/PYME/Analysis/thresholding.py", line 151, in otsu
"to have just one color {0}.".format(image.min()))
ValueError: threshold_otsu is expected to work with images having more than one color. The input image seems to have just one color 0.0.
|
|
Thanks for testing @zacsimile. That Otsu error just means that the jittered triangulation forks died and we tried to threshold an image of all zeros. Would seem this punt doesn't work, but I appreciate the try @David-Baddeley! |
|
I'm going to leave this open for now (even though it doesn't solve #614) as it might make sense to make us less dependant on matplotlib anyway. |
switch from
matplotlib.tritoscipy.spatial.Delaunayfor some of the jittered triangulation calls to avoid matplotlib imports and framework issuesNote:
calcNeighbourDistsstill usesmatplotlib.trias we need the.edgesproperty, but this should hopefully be OK as it should get called in the main process, not subprocesses.Addresses issue #614.
This is pretty much a punt at this point as I can't reproduce #614 on my version of OSX (i.e. I don't know if this will work)
@zacsimile or @barentine - could you try this out.