Browse Source

Merge pull request #80 from jimrybarski/dev

Dev
feature/load_slices
Jim Rybarski 9 years ago
parent
commit
6d64a7cea3
5 changed files with 38 additions and 6 deletions
  1. +11
    -0
      .dockerignore
  2. +5
    -0
      Dockerfile
  3. +16
    -3
      Makefile
  4. +2
    -1
      nd2reader/__init__.py
  5. +4
    -2
      nd2reader/parser.py

+ 11
- 0
.dockerignore View File

@ -0,0 +1,11 @@
.gitignore
.git
*.md
*.txt
Dockerfile
Makefile
setup.cfg
env
*.egg-info
build
dist

+ 5
- 0
Dockerfile View File

@ -15,6 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-dev \
python-pip \
python3-pip \
python-numpy \
python3-numpy \
libfreetype6-dev \
python3-matplotlib \
libfreetype6-dev \
@ -22,6 +24,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libjpeg-dev \
pkg-config \
python3-skimage \
tk \
tk-dev \
python3-tk \
&& pip3 install -U cython \
scikit-image \
&& rm -rf /var/lib/apt/lists/*


+ 16
- 3
Makefile View File

@ -1,13 +1,26 @@
.PHONY: build py2shell py3shell test
.PHONY: info build shell py2 py3 test
info:
@echo ""
@echo "Available Make Commands"
@echo ""
@echo "build: builds the image"
@echo "py2: maps ~/Documents/nd2s to /var/nd2s and runs a Python 2.7 interpreter"
@echo "py3: maps ~/Documents/nd2s to /var/nd2s and runs a Python 3.4 interpreter"
@echo "test: runs all unit tests (in Python 3.4)"
@echo ""
build:
docker build -t jimrybarski/nd2reader .
shell:
xhost local:root; docker run --rm -v ~/Documents/nd2s:/var/nd2s -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$(DISPLAY) -it jimrybarski/nd2reader bash
py2:
docker run --rm -v ~/Documents/nd2s:/var/nd2s -it jimrybarski/nd2reader python2.7
xhost local:root; docker run --rm -v ~/Documents/nd2s:/var/nd2s -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$(DISPLAY) -it jimrybarski/nd2reader python2.7
py3:
docker run --rm -v ~/Documents/nd2s:/var/nd2s -it jimrybarski/nd2reader python3.4
xhost local:root; docker run --rm -v ~/Documents/nd2s:/var/nd2s -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$(DISPLAY) -it jimrybarski/nd2reader python3.4
test: build
docker run --rm -it jimrybarski/nd2reader python3.4 /opt/nd2reader/tests.py


+ 2
- 1
nd2reader/__init__.py View File

@ -57,7 +57,8 @@ class Nd2(Nd2Parser):
fov = self._calculate_field_of_view(item)
channel = self._calculate_channel(item)
z_level = self._calculate_z_level(item)
timestamp, raw_image_data = self._get_raw_image_data(item, channel_offset)
image_group_number = int(item / len(self.channels))
timestamp, raw_image_data = self._get_raw_image_data(image_group_number, channel_offset)
image = Image(timestamp, raw_image_data, fov, channel, z_level, self.height, self.width)
except (TypeError, ValueError):
return None


+ 4
- 2
nd2reader/parser.py View File

@ -234,8 +234,10 @@ class Nd2Parser(object):
except AttributeError:
return [0]
except TypeError:
count = int(re.match(pattern, self._dimensions.decode("utf8")).group(1))
return list(range(count))
match = re.match(pattern, self._dimensions.decode("utf8"))
if not match:
return [0]
return list(range(int(match.group(1))))
else:
return list(range(count))


Loading…
Cancel
Save