Esempio n. 1
0
 def update_labeled_image_data(self):
     im = self.image_data.arrays.get('im')[:, :, 0]
     bw = get_cleared_binary_image(im)
     bx, by = get_region_bounds(bw)
     apd = ArrayPlotData(im=bw)
     for i in range(len(bx)):
         minc, maxc = bx[i]
         minr, maxr = by[i]
         key = "bb" + str(i)
         apd.update({key + 'topx': (minc, maxc),
                     key + 'topy': (maxr, maxr),
                     key + 'botx': (minc, maxc),
                     key + 'boty': (minr, minr),
                     key + 'leftx': (minc, minc),
                     key + 'lefty': (minr, maxr),
                     key + 'rightx': (maxc, maxc),
                     key + 'righty': (minr, maxr)})
     plot = Plot(apd)
     plot.img_plot('im', colormap=gray, origin='bottom left')
     for i in range((len(apd.arrays) - 1) / 8):
         key = 'bb' + str(i)
         plot.plot((key + 'topx', key + 'topy'), color='green',
                   line_width=3)
         plot.plot((key + 'botx', key + 'boty'), color='green',
                   line_width=3)
         plot.plot((key + 'leftx', key + 'lefty'), color='green',
                   line_width=3)
         plot.plot((key + 'rightx', key + 'righty'), color='green',
                   line_width=3)
     self.labeled_image_plot = plot
Esempio n. 2
0
 def test_clear_borders(self):
     x = gzapi.get_data_by_id(self.test_id, as_grey=True)[0]
     bw = gzapi.get_cleared_binary_image(x)
     top = bw[0,:]
     bottom = bw[bw.shape[0]-1,:]
     left = bw[:,0]
     right = bw[:,bw.shape[1]-1]
     for col in (top, bottom, left, right):
         self.assertTrue(np.allclose(col, np.zeros(col.shape)))
Esempio n. 3
0
 def _labeled_image_data_default(self):
     im = self.image_data.arrays.get('im')[:, :, 0]
     bw = get_cleared_binary_image(im)
     bx, by = get_region_bounds(bw)
     apd = ArrayPlotData(im=bw)
     for i in range(len(bx)):
         minc, maxc = bx[i]
         minr, maxr = by[i]
         key = "bb" + str(i)
         apd.update({key + 'topx': (minc, maxc),
                     key + 'topy': (maxr, maxr),
                     key + 'botx': (minc, maxc),
                     key + 'boty': (minr, minr),
                     key + 'leftx': (minc, minc),
                     key + 'lefty': (minr, maxr),
                     key + 'rightx': (maxc, maxc),
                     key + 'righty': (minr, maxr)})
     return apd