def test_open_http():
    url = "https://github.com/CellProfiler/python-bioformats/raw/39f2aa8360324b4129284d4f647d4f7ee7797518" \
          "/tests/resources/Channel1-01-A-01.tif"
    image, scale = bioformats.load_image_url(url,
                                             rescale=False,
                                             wants_max_intensity=True)
    assert image.shape[0] == 640
def test_open_file():
    path = os.path.join(os.path.dirname(__file__), 'resources',
                        'Channel1-01-A-01.tif')
    url = "file:" + future.moves.urllib.request.pathname2url(path)
    image, scale = bioformats.load_image_url(url,
                                             rescale=False,
                                             wants_max_intensity=True)
    assert image.shape[0] == 640
def test_unicode_url():
    #
    # Regression test of issue #17: ensure that this does not
    # raise an exception when converting URL to string
    #
    path = os.path.join(os.path.dirname(__file__), 'resources', 'Channel1-01-A-01.tif')
    url = "file:" + future.moves.urllib.request.pathname2url(path)
    image, scale = bioformats.load_image_url(url, rescale=False, wants_max_intensity=True)
    assert image.shape[0] == 640
 def test_01_03_unicode_url(self):
     #
     # Regression test of issue #17: ensure that this does not
     # raise an exception when converting URL to string
     #
     path = os.path.join(os.path.dirname(__file__), 'Channel1-01-A-01.tif')
     url = u"file:" + urllib.pathname2url(path).encode("utf-8")
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)
Beispiel #5
0
 def test_01_03_unicode_url(self):
     #
     # Regression test of issue #17: ensure that this does not
     # raise an exception when converting URL to string
     #
     path = os.path.join(os.path.dirname(__file__), 'Channel1-01-A-01.tif')
     url = "file:" + pathname2url(path)
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)
def test_unicode_url():
    #
    # Regression test of issue #17: ensure that this does not
    # raise an exception when converting URL to string
    #
    path = os.path.join(os.path.dirname(__file__), 'resources',
                        'Channel1-01-A-01.tif')
    url = "file:" + future.moves.urllib.request.pathname2url(path)
    image, scale = bioformats.load_image_url(url,
                                             rescale=False,
                                             wants_max_intensity=True)
    assert image.shape[0] == 640
Beispiel #7
0
        def fn():
            from bioformats import load_image_url
            import javabridge
            from scipy.io.matlab.mio import loadmat
            from cellprofiler.modules.loadimages import url2pathname

            javabridge.attach()
            with self.image_dict_lock:
                generation = self.image_dict_generation
                
            for k, v in well.iteritems():
                sd = {}
                with self.image_dict_lock:
                    if self.image_dict_generation > generation:
                        return
                    self.image_dict[k] = sd
                for c, fd in enumerate(v):
                    if PlateData.D_CHANNEL in fd:
                        channel = fd[PlateData.D_CHANNEL]
                    else:
                        channel = str(c+1)
                    url = fd[PlateData.D_FILENAME]
                    try:
                        if url.lower().endswith(".mat"):
                            img = loadmat(
                                url2pathname(url), 
                                struct_as_record=True)["Image"]
                        else:
                            img = load_image_url(url)
                        with self.image_dict_lock:
                            if self.image_dict_generation > generation:
                                return
                            sd[channel] = img
                    except:
                        traceback.print_exc()
                        pass
            wx.CallAfter(self.update_figure)
            javabridge.static_call(
                "java/lang/System", "gc", "()V")
            javabridge.detach()
Beispiel #8
0
        def fn():
            from bioformats import load_image_url
            import javabridge
            from scipy.io.matlab.mio import loadmat
            from cellprofiler.modules.loadimages import url2pathname

            javabridge.attach()
            with self.image_dict_lock:
                generation = self.image_dict_generation

            for k, v in well.iteritems():
                sd = {}
                with self.image_dict_lock:
                    if self.image_dict_generation > generation:
                        return
                    self.image_dict[k] = sd
                for c, fd in enumerate(v):
                    if PlateData.D_CHANNEL in fd:
                        channel = fd[PlateData.D_CHANNEL]
                    else:
                        channel = str(c + 1)
                    url = fd[PlateData.D_FILENAME]
                    try:
                        if url.lower().endswith(".mat"):
                            img = loadmat(
                                    url2pathname(url),
                                    struct_as_record=True)["Image"]
                        else:
                            img = load_image_url(url)
                        with self.image_dict_lock:
                            if self.image_dict_generation > generation:
                                return
                            sd[channel] = img
                    except:
                        traceback.print_exc()
                        pass
            wx.CallAfter(self.update_figure)
            javabridge.static_call(
                    "java/lang/System", "gc", "()V")
            javabridge.detach()
def test_open_http():
    url = "https://github.com/CellProfiler/python-bioformats/raw/39f2aa8360324b4129284d4f647d4f7ee7797518" \
          "/tests/resources/Channel1-01-A-01.tif"
    image, scale = bioformats.load_image_url(url, rescale=False, wants_max_intensity=True)
    assert image.shape[0] == 640
def test_open_file():
    path = os.path.join(os.path.dirname(__file__), 'resources', 'Channel1-01-A-01.tif')
    url = "file:" + future.moves.urllib.request.pathname2url(path)
    image, scale = bioformats.load_image_url(url, rescale=False, wants_max_intensity=True)
    assert image.shape[0] == 640
 def test_01_02_open_http(self):
     url = "https://github.com/CellProfiler/python-bioformats"+\
         "/raw/master/bioformats/tests/Channel1-01-A-01.tif"
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)
 def test_01_01_open_file(self):
     path = os.path.join(os.path.dirname(__file__), 'Channel1-01-A-01.tif')
     url = "file:" + urllib.pathname2url(path).encode("utf-8")
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)
Beispiel #13
0
 def test_01_02_open_http(self):
     url = "https://github.com/CellProfiler/python-bioformats"+\
         "/raw/master/bioformats/tests/Channel1-01-A-01.tif"
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)
Beispiel #14
0
 def test_01_01_open_file(self):
     path = os.path.join(os.path.dirname(__file__), 'Channel1-01-A-01.tif')
     url = "file:" + pathname2url(path)
     image, scale = load_image_url(
         url, rescale=False, wants_max_intensity=True)
     self.assertEqual(image.shape[0], 640)