Browse Source

resolves #152: images truly act like numpy arrays now and are also displayable

feature/load_slices
jim 9 years ago
parent
commit
4a48847630
5 changed files with 16 additions and 5 deletions
  1. +1
    -1
      Makefile
  2. +11
    -0
      functional_tests/FYLM141111001.py
  3. +1
    -1
      nd2reader/__init__.py
  4. +2
    -2
      nd2reader/model/image.py
  5. +1
    -1
      setup.py

+ 1
- 1
Makefile View File

@ -31,7 +31,7 @@ test: build
ftest: build
xhost local:root; docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$(DISPLAY) -v $(CURDIR):/opt/nd2reader -v ~/nd2s:/var/nd2s -it jimrybarski/nd2reader python3.4 /opt/nd2reader/ftest.py
docker run --rm -v $(CURDIR):/opt/nd2reader -v ~/nd2s:/var/nd2s -it jimrybarski/nd2reader python2.7 /opt/nd2reader/ftest.py
xhost local:root; docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$(DISPLAY) -v $(CURDIR):/opt/nd2reader -v ~/nd2s:/var/nd2s -it jimrybarski/nd2reader python2.7 /opt/nd2reader/ftest.py
publish:
python setup.py sdist upload -r pypi

+ 11
- 0
functional_tests/FYLM141111001.py View File

@ -4,6 +4,7 @@ run them unless you're Jim Rybarski.
"""
from nd2reader import Nd2
from skimage import io
import numpy as np
from datetime import datetime
import unittest
@ -227,3 +228,13 @@ class FYLM141111Tests(unittest.TestCase):
mean = np.mean(self.nd2[0])
self.assertEqual(type(mean), np.float64)
self.assertAlmostEqual(expected_mean, mean)
def test_subtract_images(self):
# just to prove we can really treat Image like an array
diff = self.nd2[0] - self.nd2[2]
self.assertTrue(np.any(diff))
def test_show(self):
io.imshow(self.nd2[0])
io.show()
self.assertTrue(True)

+ 1
- 1
nd2reader/__init__.py View File

@ -1,3 +1,3 @@
from nd2reader.main import Nd2
__version__ = '2.1.2'
__version__ = '2.1.3'

+ 2
- 2
nd2reader/model/image.py View File

@ -19,11 +19,11 @@ class Image(np.ndarray):
self._channel = None
self._z_level = None
def __array_wrap__(self, obj):
def __array_wrap__(self, obj, *args):
if len(obj.shape) == 0:
return obj[()]
else:
return np.ndarray.__array_wrap__(obj)
return obj
def add_params(self, index, timestamp, frame_number, field_of_view, channel, z_level):
"""


+ 1
- 1
setup.py View File

@ -1,6 +1,6 @@
from setuptools import setup
VERSION = '2.1.2'
VERSION = '2.1.3'
if __name__ == '__main__':
setup(


Loading…
Cancel
Save