Coder Social home page Coder Social logo

read_lif's Introduction

read_lif

Load 3D confocal images from lif files as numpy arrays.

The code was originally written by Mathieu Leocmach in package colloids.

Install

  • The most convenient way would be: pip install -e . from the directory where you have cloned or downloaded the code.
  • You can also Include the file read_lif in your project directory

How to Use It

import read_lif

reader = read_lif.Reader('lif_file.lif')
series = reader.getSeries()
chosen = series[0]  # choose first image in the lif file
# get a numpy array corresponding to the 1st time point & 1st channel
# the shape is (z, y, x)
image = chosen.getFrame(T=0, channel=0)

Version Issue

The current code (version >= 3.1) returns the data in the order of Z-Y-X. (ce240f6)

This is DIFFERENT from previous version, where the data is returned as X-Y-Z

read_lif's People

Contributors

mathieuleocmach avatar yangyushi avatar

Stargazers

 avatar Wisam Reid avatar Tianhong Dai avatar Nik Merlock avatar Alan Sabino avatar Henry Webel avatar Guillaume Witz avatar Rogan Grant avatar weize avatar Artyom Astafurov avatar

Watchers

James Cloos avatar Wisam Reid avatar  avatar  avatar  avatar

read_lif's Issues

Strange behavior on images with >3 channels

First of all, thanks for a great utility. It's exceptionally easy to use.

The issue is arguably more of a feature request:
When plotting images with 4 channels, matplotlib renders the images in black and white with strange overlays (see attached). Using 5 or more channels raises the error: TypeError: Invalid shape (512, 512, 5) for image data. Is there any easy workaround to this? If not, it would be great to be able to assign LUTs to each channel for highly multiplexed images.

Update: it appears that this is specific to matplotlib, as the channels get mapped to RGBa (this explains the transparency). Being able to assign color scales to each channel would still be very helpful.

Screen Shot 2019-11-04 at 10 40 44 AM

Incorrect images

Opening 2D .lif images

Hi,

I've been trying to open 2D .lif images. In the .lif, I chose the Series, and then I wish to get my (x,y) image, doing the following:
from readlif.reader import LifFile
new = LifFile(file)
img_0 = new.get_image(0)
img_1 = img_0.get_frame(z=0, t=0, c=0, m=0)

However, I get images of the right size, but not the right images. It seems like one image is like "folded in on itself".
Meaning that I have an image with particles in it, and the particles from the bottom of the image seem superimposed with particles from the top of the image. The total gives superimposed particles zoomed in.
Could you please help for that?

Thanks a lot.

Best regards,

Estée

Great job !

Hi @yangyushi !
That's a great job you did here. I wanted to isolate this bit of my code for a while and package it independently of "colloids", which is a mess to maintain.
Can you put me as contributor on this project, in case I have new code to contribute?

Version number increment

Hi guys, we have been using your very useful package and recently got burnt by the axis order change (1613c9b). The change is actually good for us in terms of memory access.

But since it breaks compatibility with the older version, I think there should be a big version number change, at least to 0.4, and maybe this could even be mentioned in the README.

Behaviour of getFrame

In my original code, getFrame was returning frames in C order (ZYX), as written in the docstring.
However since the first commit on the present repository, axes are swapped before returning (XYZ). This change of behaviour raises various compatibility issues, including within the code (I fixed one in enumByFrame recently ). Furthermore, the docstring has not been updated and is this misleading.

However, I want to keep the support for channels, introduced in @yangyushi version, since my old implementation was not taking channels into account.

I propose a new implementation of the function that reverts to the old behaviour but keeps support for channels. It is basically the new implementation without the axes swap and slightly better memory management.

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.