- read metadata into ome structure
- pytest - use pathlib - series as part of the path: path/PosN - summary only shows some available metadata - allow dict in Imread[dict(c=c, z=z, t=t)] - bfread in different process so the user can start another jvm - deal with multiple images (series/positions) in czi files - use jpype instead of javabridge/bioformats - poetry for install
This commit is contained in:
45
README.md
45
README.md
@@ -1,10 +1,9 @@
|
||||
# ndbioimage
|
||||
# ndbioimage - Work in progress
|
||||
|
||||
Exposes (bio) images as a numpy ndarray like object, but without loading the whole
|
||||
image into memory, reading from the file only when needed. Some metadata is read
|
||||
and exposed as attributes to the Imread object (TODO: structure data in OME format).
|
||||
Additionally, it can automatically calculate an affine transform that corrects for
|
||||
chromatic abberrations etc. and apply it on the fly to the image.
|
||||
Exposes (bio) images as a numpy ndarray-like-object, but without loading the whole
|
||||
image into memory, reading from the file only when needed. Some metadata is read and
|
||||
and stored in an ome structure. Additionally, it can automatically calculate an affine
|
||||
transform that corrects for chromatic abberrations etc. and apply it on the fly to the image.
|
||||
|
||||
Currently supports imagej tif files, czi files, micromanager tif sequences and anything
|
||||
bioformats can handle.
|
||||
@@ -13,13 +12,8 @@ bioformats can handle.
|
||||
|
||||
pip install ndbioimage@git+https://github.com/wimpomp/ndbioimage.git
|
||||
|
||||
### With bioformats (if java is properly installed)
|
||||
|
||||
pip install ndbioimage[bioformats]@git+https://github.com/wimpomp/ndbioimage.git
|
||||
|
||||
### With affine transforms (only for python 3.8, 3.9 and 3.10)
|
||||
|
||||
pip install ndbioimage[transforms]@git+https://github.com/wimpomp/ndbioimage.git
|
||||
Optionally:
|
||||
https://downloads.openmicroscopy.org/bio-formats/latest/artifacts/bioformats_package.jar
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -27,34 +21,34 @@ bioformats can handle.
|
||||
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from ndbioimage import imread
|
||||
with imread('image_file.tif', axes='ctxy', dtype=int) as im:
|
||||
from ndbioimage import Imread
|
||||
with Imread('image_file.tif', axes='ctxy', dtype=int) as im:
|
||||
plt.imshow(im[2, 1])
|
||||
|
||||
- Showing some image metadata
|
||||
|
||||
|
||||
from ndbioimage import imread
|
||||
from ndbioimage import Imread
|
||||
from pprint import pprint
|
||||
with imread('image_file.tif') as im:
|
||||
with Imread('image_file.tif') as im:
|
||||
pprint(im)
|
||||
|
||||
- Slicing the image without loading the image into memory
|
||||
|
||||
|
||||
from ndbioimage import imread
|
||||
with imread('image_file.tif', axes='cztxy') as im:
|
||||
from ndbioimage import Imread
|
||||
with Imread('image_file.tif', axes='cztxy') as im:
|
||||
sliced_im = im[1, :, :, 100:200, 100:200]
|
||||
|
||||
sliced_im is an instance of imread which will load any image data from file only when needed
|
||||
sliced_im is an instance of Imread which will load any image data from file only when needed
|
||||
|
||||
|
||||
- Converting (part) of the image to a numpy ndarray
|
||||
|
||||
|
||||
from ndbioimage import imread
|
||||
from ndbioimage import Imread
|
||||
import numpy as np
|
||||
with imread('image_file.tif', axes='cztxy') as im:
|
||||
with Imread('image_file.tif', axes='cztxy') as im:
|
||||
array = np.asarray(im[0, 0])
|
||||
|
||||
## Adding more formats
|
||||
@@ -63,9 +57,8 @@ automatically recognize it and use it to open the appropriate file format. Image
|
||||
subclass Imread and are required to implement the following methods:
|
||||
|
||||
- staticmethod _can_open(path): return True if path can be opened by this reader
|
||||
- \_\_metadata__(self): reads metadata from file and adds them to self as attributes,
|
||||
- the shape of the data in the file needs to be set as self.shape = (X, Y, C, Z, T)
|
||||
- other attributes like pxsize, acquisitiontime and title can be set here as well
|
||||
- property ome: reads metadata from file and adds them to an OME object imported
|
||||
from the ome-types library
|
||||
- \_\_frame__(self, c, z, t): return the frame at channel=c, z-slice=z, time=t from the file
|
||||
|
||||
Optional methods:
|
||||
@@ -78,5 +71,5 @@ Optional fields:
|
||||
for example: any file handles
|
||||
|
||||
# TODO
|
||||
- structure the metadata in OME format tree
|
||||
- more image formats
|
||||
- re-implement transforms
|
||||
|
||||
Reference in New Issue
Block a user