Example #1
0
def test_graph_from_image(visual=False):
    im = imread("segmentation.inr.gz")
    graph = graph_from_image(im)
    if visual:
        Viewer.display(
            graph2pglscene(graph, graph.vertex_property('barycenter'),
                           graph.vertex_property('L1')))
def read_image_path(urls, mimetype_in, mimetype_out):

    if isinstance(urls, basestring):
        urls = [urls]
    for url in urls:
        url = path(url)
        if url.exists():
            try:
                data = imread(url)
            except Exception, e:
                e = MimeConversionError(url, mimetype_in, mimetype_out, e)
                raise e
            else:
                return data, {}

def compute_cell_separation(mat):
    """
    Function creating a space between cells for display.
    Change the shared voxel between two cell to 0 so you can clearly see the seperations bewteen cells.
    """
    import scipy.nd as nd
    import numpy as np
    import copy
    sep=nd.laplace(mat)
    sep2=copy.copy(sep)
    sep2[np.where(mat==1)]=0
    sep2[np.where(sep==0)]=1
    sep2[np.where(sep!=0)]=0
    mat=mat*sep2
    del sep2,sep
    
    return mat


if __name__ == '__main__':
    im1 = imread('../../../test/segmentation.inr.gz')
    im1a=SpatialImageAnalysis(im1)
    dictionary=dict(zip(im1a.labels(), im1a.volume()))
    labs=im1a.labels()
    L1=im1a.L1()[1]
    filtre=[i for i in labs if i not in L1]
    display3D(im1,filtre, dictionary, rainbow_full)
    
        self._im_view.rotate(-1)
        self.update_pix()

    def rotate_right(self):
        res = self._label._resolution
        self._label._resolution = res[1], res[0]
        self._im_view.rotate(1)
        self.update_pix()


if __name__ == '__main__':
    from openalea.deploy.shared_data import shared_data
    from openalea.image.serial.basics import imread
    import openalea.oalab
    img_path = shared_data(openalea.oalab, 'icons/Crystal_Clear_app_clock.png')
    img = imread(img_path)

    import numpy
    matrix = numpy.zeros((100, 100, 100), dtype=numpy.uint8)
    matrix[90:100, :10, :10] = 1
    matrix[:10, 90:100, :10] = 2
    matrix[:10, :10, 90:100] = 3
    img3d = SpatialImage(matrix)

    instance = QtGui.QApplication.instance()
    if instance is None:
        app = QtGui.QApplication([])
    else:
        app = instance

    slider = ImageStackViewerWidget()
def test_graph_from_image(visual = False):
    im =  imread("segmentation.inr.gz")
    graph = graph_from_image(im)
    if visual :
        Viewer.display(graph2pglscene(graph,graph.vertex_property('barycenter'),graph.vertex_property('L1')))
    w.write()


def compute_cell_separation(mat):
    """
    Function creating a space between cells for display.
    Change the shared voxel between two cell to 0 so you can clearly see the seperations bewteen cells.
    """
    import scipy.nd as nd
    import numpy as np
    import copy
    sep = nd.laplace(mat)
    sep2 = copy.copy(sep)
    sep2[np.where(mat == 1)] = 0
    sep2[np.where(sep == 0)] = 1
    sep2[np.where(sep != 0)] = 0
    mat = mat * sep2
    del sep2, sep

    return mat


if __name__ == '__main__':
    im1 = imread('../../../test/segmentation.inr.gz')
    im1a = SpatialImageAnalysis(im1)
    dictionary = dict(zip(im1a.labels(), im1a.volume()))
    labs = im1a.labels()
    L1 = im1a.L1()[1]
    filtre = [i for i in labs if i not in L1]
    display3D(im1, filtre, dictionary, rainbow_full)
Example #7
0
def wra_imread (filename) :
    return imread(filename)