Giter VIP home page Giter VIP logo

pylibczi's Introduction

NOTE: aicspylibczi This project has been forked and made into a much more general tool for reading czi files by developers at the Allen Institute for Cell Science at the Allen Institute. Please try this version with pip install aicspylibczi or visit the fork homepage.

pylibczi

Python module to expose libCZI functionality for reading (subset of) Zeiss CZI files and meta-data.

Installation

The preferred installation method is with pip install. This will intall the pylibczi python module and extension binaries (hosted on PyPI):

pip install pylibczi

Usage

For example usage, see sample.py. In the first example, replace test.czi with your own CZI file containing scenes. In the second example, replace test2.czi with your own CZI file containing grayscale or BGR48 image data. The latter is a more generic reader for reading and assembling all subblocks.

Documentation

Documentation is available on readthedocs.

Build

Use these steps to build and install pylibczi locally:

  • Clone the repository including submodules (--recurse-submodules).
  • Requirements:
    • libCZI requires a c++11 compatible compiler.
    • Development requirements are those required for libCZI: libpng, zlib
    • Install the python requirements:
      pip install -r requirements.txt
      pip install -r dev-requirements.txt
      
  • Build and install:
    python setup.py install
    
    • libCZI is automatically built as a submodule and linked statically to pylibczi.

pylibczi's People

Contributors

elhuhdron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pylibczi's Issues

Error running the code

Hi ,
I can't open the images, I run into this error.

Traceback (most recent call last):
File "C:/Users/q371ms/PycharmProjects/MouseBrain/tempo5.py", line 16, in
CziFile.plot_image(czifile.read_image(), figno=4, show=False)
File "C:\Users\q371ms\PycharmProjects\MouseBrain\venv\lib\site-packages\pylibczi\CziFile.py", line 108, in read_image
img = np.squeeze(self.czilib.CziFile(self.czi_filename).asarray())
File "C:\Users\q371ms\PycharmProjects\MouseBrain\venv\lib\site-packages\czifile\czifile.py", line 443, in asarray
out = create_output(out, self.shape, self.dtype)
File "C:\Users\q371ms\PycharmProjects\MouseBrain\venv\lib\site-packages\tifffile\tifffile.py", line 11044, in create_output
return numpy.zeros(shape, dtype)
MemoryError: Unable to allocate array with shape (6, 3, 27777, 68044, 1) and data type uint16

Unable to read multiband czi file with 3 scenes

Hi Paul,
First thank you for this effort, it looks very promising and very useful!
Unfortunately, I am having trouble with reading a file that has 3 scenes. Image size: 73638x44269, 5 channels, 16 bit pixel depth. I am using pylibczi v1.1.1 and Python 3.7
I can create a pylibczi.CziFile object with it and successfully read the metadata with that object's read_meta() method. But when I try use read_image() I get back an array that has a shape with only two dimensions (height, width) and 16 bit dtype. I was expecting an array with shape (height, width, 5). If I write the image out, it appears to be the first channel only and there are some missing tiles (i.e. the merging of the 3 scenes is almost correct, but there are errors).

I will be happy to provide and example image but it is way too big to attach (I can get it to you by other means).

Again, thank you for this great contribution!
-Doug

The label image as well as the Preview Scan image are not accessible.

Thank you very much for implementing a CZI. format handler that is non-dependent on JavaScript. Unfortunately after some reading and exploring, I couldn't find any way to extract the Preview image as well as Label image from the .czi files. I am using QR-codes on the label, so it would be important for me to be able to do that. Is there any chance, you could implement this for the next version? As for now, I have to use Python-bioformats to do that ( but that package is very unstable since it's depending on the javabridge package and the JRE version installed on a device).

Use CziScene to get info has a bug. markers = self.meta_root.xpath(self.xml_paths['Calibration'])[0] IndexError: list index out of range

img, polygons_points, rois_points, box_corner_pix, box_size_pix = scene.get_scene_info()
File "/DATA/234/zywang/anaconda/lib/python3.6/site-packages/pylibczi/CziScene.py", line 354, in get_scene_info
if not self.scene_loaded: self.read_scene_image()
File "/DATA/234/zywang/anaconda/lib/python3.6/site-packages/pylibczi/CziScene.py", line 306, in read_scene_image
if not self.meta_loaded: self.read_scene_meta()
File "/DATA/234/zywang/anaconda/lib/python3.6/site-packages/pylibczi/CziScene.py", line 127, in read_scene_meta
markers = self.meta_root.xpath(self.xml_paths['Calibration'])[0]
IndexError: list index out of range

Why ?

Can't install from pip

Hi,

I am trying to install pylibczi in an anaconda environment with python version 3.10.4

I got the following error after runing "pip install pylibczi":

ERROR: Could not find a version that satisfies the requirement pylibczi (from versions: none)
ERROR: No matching distribution found for pylibczi

Do I need any specific version of python?

EDIT: I was able to install it in an anaconda environment with python version 3.6.13. Is pylibczi incompatible with 3.10? Maybe a small change to include 3.10 in the "python version requirements" (I don't actually know how python packages work) solves it.

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.