|
12 | 12 | import numpy as np
|
13 | 13 | import os
|
14 | 14 | import re
|
| 15 | +import urllib |
15 | 16 | import unittest
|
16 | 17 |
|
17 | 18 | import javabridge as J
|
@@ -154,24 +155,20 @@ def test_03_03_read_subimage_tif(self):
|
154 | 155 | self.assertTrue(np.all(expected_0_10_0_10 == data_0_10_0_10))
|
155 | 156 | # self.assertTrue(np.all(expected_n10_n10 == data[-10:,-10:]))
|
156 | 157 |
|
157 |
| - # def test_03_03_load_using_bioformats_url(self): |
158 |
| - # data = F.load_using_bioformats_url( |
159 |
| - # "http://www.cellprofiler.org/linked_files/broad-logo.gif", |
160 |
| - # rescale=False) |
161 |
| - # self.assertSequenceEqual(data.shape, (38, 150, 3)) |
162 |
| - # expected_0_10_0_10 = np.array([ |
163 |
| - # [181, 176, 185, 185, 175, 175, 176, 195, 187, 185], |
164 |
| - # [ 25, 7, 7, 7, 2, 2, 13, 13, 0, 1], |
165 |
| - # [ 21, 1, 1, 0, 0, 1, 0, 1, 0, 0], |
166 |
| - # [ 64, 13, 1, 1, 12, 12, 2, 1, 1, 1], |
167 |
| - # [ 22, 56, 26, 13, 1, 1, 6, 0, 0, 0], |
168 |
| - # [ 12, 13, 82, 57, 9, 12, 2, 6, 6, 6], |
169 |
| - # [ 12, 13, 20, 89, 89, 21, 11, 12, 1, 0], |
170 |
| - # [ 6, 1, 7, 21, 89, 102, 26, 0, 10, 1], |
171 |
| - # [ 26, 0, 0, 1, 20, 84, 151, 58, 12, 1], |
172 |
| - # [ 23, 6, 1, 1, 0, 1, 55, 166, 100, 12]], |
173 |
| - # dtype=np.uint8) |
174 |
| - # self.assertTrue(np.all(expected_0_10_0_10 == data[:10,:10, 0])) |
| 158 | + def test_03_03_load_using_bioformats_url(self): |
| 159 | + url = "https://github.com/CellProfiler/python-bioformats/raw/1.0.5/bioformats/tests/Channel1-01-A-01.tif" |
| 160 | + try: |
| 161 | + fd = urllib.urlopen(url) |
| 162 | + if fd.code < 200 or fd.code >= 300: |
| 163 | + raise IOError("Http error %d" % fd.code) |
| 164 | + except IOError, e: |
| 165 | + def bad_url(e=e): |
| 166 | + print "bad url" |
| 167 | + raise e |
| 168 | + unittest.expectedFailure(bad_url)() |
| 169 | + |
| 170 | + data = F.load_using_bioformats_url(url, rescale=False) |
| 171 | + self.assertSequenceEqual(data.shape, (640, 640)) |
175 | 172 |
|
176 | 173 | def test_04_01_read_omexml_metadata(self):
|
177 | 174 | path = os.path.join(os.path.dirname(__file__), 'Channel1-01-A-01.tif')
|
|
0 commit comments