Browse Source

#27 better instructions

feature/load_slices
Jim Rybarski 10 years ago
parent
commit
ae06dca96c
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      README.md

+ 14
- 6
README.md View File

@ -1,14 +1,12 @@
# nd2reader # nd2reader
## Simple access to .nd2 files
### About ### About
`nd2reader` is a pure-Python package that reads images produced by NIS Elements. `nd2reader` is a pure-Python package that reads images produced by NIS Elements.
.nd2 files contain images and metadata, which can be split along multiple dimensions: time, fields of view (xy-plane), focus (z-plane), and filter channel. .nd2 files contain images and metadata, which can be split along multiple dimensions: time, fields of view (xy-plane), focus (z-plane), and filter channel.
`nd2reader` produces data in numpy arrays, which makes it trivial to use with the image analysis packages `scikit-image` and `OpenCV`.
`nd2reader` produces data in numpy arrays, which makes it trivial to use with the image analysis packages such as `scikit-image` and `OpenCV`.
### Installation ### Installation
@ -20,9 +18,9 @@ If you want to install via git, clone the repo and run:
`python setup.py install` `python setup.py install`
### Usage
### Simple Iteration
nd2reader provides two main ways to view image data. For most cases, you'll just want to iterate over each image:
For most cases, you'll just want to iterate over each image:
``` ```
import nd2reader import nd2reader
@ -31,10 +29,12 @@ for image in nd2:
do_something(image.data) do_something(image.data)
``` ```
### Image Sets
If you have complicated hierarchical data, it may be easier to use image sets, which groups images together if they If you have complicated hierarchical data, it may be easier to use image sets, which groups images together if they
share the same time index and field of view: share the same time index and field of view:
```
```python
import nd2reader import nd2reader
nd2 = nd2reader.Nd2("/path/to/my_complicated_images.nd2") nd2 = nd2reader.Nd2("/path/to/my_complicated_images.nd2")
for image_set in nd2.image_sets: for image_set in nd2.image_sets:
@ -47,6 +47,14 @@ for image_set in nd2.image_sets:
do_something_out_of_focus_related(out_of_focus_image) do_something_out_of_focus_related(out_of_focus_image)
``` ```
### Direct Image Access
There is a method, `get_image`, which allows random access to images. This might not always return an image, however,
if you acquired different numbers of images in each cycle of a program. For example, if you acquire GFP images every
other minute, but acquire bright field images every minute, `get_image` will return `None` at certain time indexes.
### Images
`Image` objects provide several pieces of useful data. `Image` objects provide several pieces of useful data.
``` ```


Loading…
Cancel
Save