impy is an all-in-one image analysis library, equipped with parallel processing, GPU support, GUI based tools and so on.

Overview

impy is All You Need in Image Analysis

impy is an all-in-one image analysis library, equipped with parallel processing, GPU support, GUI based tools and so on.

The core array, ImgArray, is a subclass of numpy.ndarray, tagged with information such as

  • image axes
  • scale of each axis
  • directory of the original image
  • history of image processing
  • and other image metadata

By making full use of them, impy provides super efficient tools of image analysis for you.

I'm also working on documentation for tutorials and API. Please take a look if you're interested in.

Code as fast as you speak

Almost all the functions, such as filtering, deconvolution, labeling, single molecule detection, and even those pure numpy functions, are aware of image metadata. They "know" which dimension corresponds to "z" axis, which axes they should iterate along or where to save the image. As a result, your code will be very concise:

import impy as ip
import numpy as np

img = ip.imread("path/to/image")       # Read images with metadata.
img["z=3;t=0"].imshow()                # Plot image slice at z=3 and t=0.
img_fil = img.gaussian_filter(sigma=2) # Paralell batch denoising. No more for loop!
img_prj = np.max(img_fil, axis="z")    # Z-projection (numpy is aware of image axes!).
img_prj.imsave(f"Max-{img.name}")      # Save in the same place. Don't spend time on searching for the directory!

Seamless interface between napari

napari is an interactive viewer for multi-dimensional images. impy has a simple and efficient interface with it, via the object ip.gui. Since ImgArray is tagged with image metadata, you don't have to care about axes or scales. Just run

ip.gui.add(img)

impy's viewer also provides many useful widgets and functions such as

  • Excel-like table for data analysis, layer property editing etc.
  • Compact file explorer
  • interactive matplotlib figure canvas
  • cropping, duplication, measurement, filtering tools

Extend your function for batch processing

Already have a function for numpy? Decorate it with @ip.bind

@ip.bind
def imfilter(img, param=None):
    # Your function here.
    # Do something on a 2D or 3D image and return image, scalar or labels
    return out

and it's ready for batch processing!

img.imfilter(param=1.0)

Making plugin is easy

Image analysis usually relies on manual handling, which has been discoraging people from programatic analysis on their data. But now, with @ip.gui.bind decorator, make plugin by yourself!

import matplotlib.pyplot as plt
from skimage.measure import moments

@ip.gui.bind
def func(gui): # the first argument will be ip.gui
    img = gui.get("image") # Get the front image
    y, x = gui.viewer.cursor.position # Get cursor position
    y0 = int(y-5)
    x0 = int(x-5)
    img0 = img[y0:y0+11, x0:x0+11] # Get 11x11 region around cursor

    # Calculate centroid.
    M = moments(img0.value)
    cy, cx = M[1, 0]/M[0, 0], M[0, 1]/M[0, 0]

    # Plot centroid.
    plt.figure()
    plt.imshow(img0, cmap="gray")
    plt.scatter([cx], [cy], s=360, color="crimson", marker="+")
    plt.text(cx+0.5, cy+0.5, f"({cx+x0:.1f}, {cy+y0:.1f})", size="x-large", color="crimson")
    plt.title("Centroid")
    plt.show()
    
    # Append centroid to table widget.
    gui.table.append([cy+y0, cx+x0])
    return

Installation

pip install git+https://github.com/hanjinliu/impy

or

git clone https://github.com/hanjinliu/impy

Depencencies

  • scikit-image>=0.18
  • numpy>=1.17
  • scipy>=1.6.3
  • matplotlib>=3.3.4
  • pandas>=1.3.1
  • dask>=2021.6.0
  • tifffile>=2021.6.14
  • napari>=0.4.11

impy is partly dependent on numba, cupy, trackpy and dask-image. Please install these packages if needed.

⚠️ Image processing algorithms in ImgArray are almost stable so that their behavior will not change a lot. However, since napari is under development and I'm groping for better UI right now, any functions that currently implemented in impy viewer may change or no longer work in the future. Make sure keeping napari and impy updated when you use.

Comments
  • MSVS 16 error impy is not subscriptable

    MSVS 16 error impy is not subscriptable

    Hi, I have just started out trying to import impy as ip in MSVS 16 2019 with the following statement

    import impy as ip

    I also tried

    from impy import ALL as ip

    Both statement fail with VS error that impy is not subscriptable.

    Could you please address this issue.

    impy-error

    My python 3.8 virtual environment is installed under the project repo folders via command line terminal I have used the command pip install impy-array to install impy in the project's virtual environment.

    Thanks for you help

    opened by myhub6997 2
  • Implement `BigImgArray`

    Implement `BigImgArray`

    BigImgArray is slight different from LazyImgArray. It saves the result in a temporary file for every process.

    img = ip.big_imread(...)
    img1 = img.gaussian_filter()  # saved here
    img2 = img1.proj("z")  # saved here
    
    opened by hanjinliu 0
  • Re-implement `Axes`

    Re-implement `Axes`

    This PR largely enhances axes functionalities.

    TODOs

    • [x] Axes is now a MutableSequence.
    • [x] Always use Axis objects as its components.
    • [x] Move scale into axis object.
    • [ ] Documentation about Axes.
    opened by hanjinliu 0
  • `Axes` should support

    `Axes` should support "undef" axis.

    In some cases we have to deal with undefined axis. Axes should support this kind of problem like img.axes = "##yx" suppose the undefined axis is represented by "#".

    Examples

    1. Slicing using a list.
    img = ip.zeros((10, 10, 100, 100), axes="tzyx")
    
    # This is OK. Result has "tzyx" axes.
    img[[3, 6, 9]]
    
    # This is not supported well. Returns an array without axes.
    # Ideally, axes should be "#yx"
    img[[3, 6, 9], [2, 5, 8]]
    
    1. Slicing using a binary array
    img = ip.zeros((10, 10, 100, 100), axes="tzyx")
    
    # This is OK. Result has "tzyx" axes.
    sl = np.random.random((10,)) > 0.5
    img[sl]
    
    # This is not supported well. Returns an array without axes.
    # Ideally, axes should be "#yx"
    sl = np.random.random((10, 10)) > 0.5
    img[sl]
    
    1. New axis
    img = ip.zeros((10, 10, 100, 100), axes="tzyx")
    img[np.newaxis]  # should be "#tzyx"
    
    enhancement 
    opened by hanjinliu 0
  • Flexible associable slicing of `ImgArray`

    Flexible associable slicing of `ImgArray`

    Currently, ImgArray has an attribute labels which is "associable". An associable attribute means that when the ImgArray is sliced the associable attribute will also get sliced at the correct position.

    In terms of extensibility, other object should also be compatible with this strategy, such as ROI. All the associable objects should be managed by a list and sliced in _view_labels.

    Examples

    Following code does not work but clearly implies what should be supported.

    img = ip.zeros((100, 100, 100), axes="zyx")  # create an array
    img.points = [[10, 20, 30], [60, 50, 40]]
    img.points  # Out: Points([[10, 20, 30], [60, 50, 40]])
    img[5:].points  # Out: Points([[5, 20, 30], [5, 50, 40]])
    
    opened by hanjinliu 0
  • v2.0.0

    v2.0.0

    Preparing for v2.0.0. This new release will change many things for broader usage of impy in other modules.

    • [x] Remove history.
    • [x] Remove dirpath and use source for tracking source image file.
    • [x] Remove progress monitoring.
    • [x] Remove unused napari supports.
    opened by hanjinliu 0
  • Refactor arrays

    Refactor arrays

    There are many inefficient things in current version.

    • [ ] Split image source file path into img.dirpath and img.name is very confusing. Should be img.source or something.
    • [ ] img.history should be completely removed. It usually becomes useless after binary operation, stacking or other functions that need more than one image. Stop recording history will also simplify the code a lot.
    • [ ] Clearly split metadata related to axes (such as scale and channel names) and image itself (such as source file).
    • [ ] Most of the custom napari widgets should be removed because it seems that napari plugin development is so active that people should install what they want. Only those axes and scale related things should be retained on impy side.

    Maybe I should create a new repo like Julia's AxesArray to keep things extensible enough, and use impy as an practical extension.

    opened by hanjinliu 0
  • Update in numpy/cupy switching

    Update in numpy/cupy switching

    In this version numpy/cupy will be switched using context manager.

    with ip.use("cupy"):
        out = img.gaussian_filter()
    

    By default numpy is used.

    opened by hanjinliu 0
  • Develop

    Develop

    Complexities of such as __array_ufunc__ is releave a little. Labeling functions now support multi-dimensional images. imshow_label can be used for 3-D images.

    opened by hanjinliu 0
  • Develop

    Develop

    bug fix

    • gaussian_filter did not work in previous version

    newly added

    • structure tensor functions.
    • find maxima.
    • update argument.
    • dog_filter
    • More user friendly Gaussian API.
    opened by hanjinliu 0
  • Develop

    Develop

    Many Updates

    • label, regionprops compatible with scikit-image.
    • Hessian methods
    • ROI methods are deleted
    • string slicing are changed from "t=1,z=1" to "t=1;z=1"
    • morphology functions
    opened by hanjinliu 0
Releases(v2.2.0)
  • v2.2.0(Dec 26, 2022)

    New Features

    • New methods in ImgArray

      • min, max, std, sum, mean: Basic reduction with support of string axis.
      • np.cross now supports ImgArray input with string axis.
      • as_rgba: convert an image into a RGBA image.
    • New methods in LazyImgArray

      • radon, iradon: Lazy Radon transformation and its inverse.
      • wiener, lucy: Deconvolution (reverted by dropping support of tiled deconvolution).
    • New class: BigImgArray (see docs).

    Changes

    • Support like argument in many array constructors, such as ip.array and ip.random.normal.
    • Return self instead of None for set_scale. Similarly, new method set_axes can be used instead of axes property.
    • Don't use dask.core.Array preparing for the newer dask version.
    • Use da.store to cache LazyImgArray into a memory map.
    • Use generic wrapper and call scipy.fft inside dask FFT.

    Bug Fixes

    • ImgArray.iradon
    • ImgArray.transpose
    Source code(tar.gz)
    Source code(zip)
  • v2.1.3(Sep 27, 2022)

    New Methods

    • radon: 2D/3D Radon transformation around an axis pointing any direction.
    • iradon: 2D/3D inverse Radon transformation pointing any direction.
    • sel, isel: An xarray like slicing.
    • inpaint: Inpainting of missing value using "biharmonic" or "mean" method.

    Improvements

    • Use scipy.fft instead of np.fft in some places.
    • Print scale unit in ScaleView.

    Bug Fixes

    • Could not properly read png and jpg.
    • rolling_ball returned pre-filtered image.
    • smooth_mask did not work with very small values.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.2(Aug 2, 2022)

    New Features

    • ip.aslabel function for Label array creation.
    • Add overwrite guard to imsave function. img.imsave(..., overwrite=False) to avoid unexpected overwrite of images.

    Changes

    • The default behavior of unmix is changed. Background intensity will be set to 0 (was minimum value before) by default.

    Bug fixes

    • map_coordinates did not work in cupy environment.
    • ImportError with numpy>=1.23.
    • "μ" in scale unit caused error in imsave.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Jun 30, 2022)

    Important Change

    • Axes.replace now does not change axes in-place. Instead of img.axes.replace("t", "z"), you'll have to do img.axes = img.axes.replace("t", "z").

    New Features

    • Add plugin argument in imshow for visualization with different backends.
    • New mask option in gaussfit.
    • Implemented array covariates. The labels attribute of LabeledArray is now one of the covariates.
    • Initial support of ImageJ-like ROI object as an array covariate. Accordingly, implement ip.roiread function.
    • New chapter "Gallery" in documentation.
    • Add random generator and its API ip.random.default_rng.

    Bug Fixes

    • Scale unit was wrong when reading a MRC image.
    • Some filters didn't work for binary images.
    • Try/except in reading OME-TIFF.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Jun 6, 2022)

    Highlights

    • Design of Axes is thoroughly revised. Now img.axes returns Axes object and a Axes object is a list-like sequence of Axis object. For more information see documentation.
      • If a part of the image axes cannot be determined, such as the returned array of np.stack and np.expand_dims, their axes information used to be lost. From this version, only unknown ones are substituted with UndefAxis object and represented as "#".
      • The very strict or very flexible broadcasting rule can be applied. By default, arrays with axes "yx" and "zx" cannot be added even if their shape is the same. On the other hand, ip.broadcast_arrays can wisely reshape arrays with different shapes and axes.
      • Symbol of axis can be more than one letter. To make clearer, axes of arrays returned from some functions are renamed (e.g. "l" and "r" are renamed to "base" and "dim" in hessian_eig).
    • Slicer object for safer axis-targeted-slicing. See documentation.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(May 15, 2022)

    New Features

    • Initial zarr support. Currently only support reading and writing at local directories in a specific format.
    • Read .map.gz file using mrcfile.
    • Multi-positional drift correction.

    Improvements

    • Refactor I/O submodule for better maintainability.
    • Updates in DataList and DataDict (move UserList to ABC).
    • LabeledArray always has labels attribute .
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Apr 22, 2022)

    v2.0.0

    This new version has a lot of refactoring of arrays. These changes largely improves code maintenance and usage of impy in other packages.

    Changes from v1.x

    • The history attribute and the relevant functionalities are completely removed.
    • The dirpath attribute is removed. To get image source path, use source attribute instead.
    • Methods no longer display progress so that ip.silent is also removed.
    • Many of the custom napari widgets are removed considering the current situation that people favor napari plugins.
    Source code(tar.gz)
    Source code(zip)
  • v1.26.1(Mar 27, 2022)

    New Features

    • Shift correction in real space using ip.zncc_maximum.

    Bug Fixes

    • Bug fix in lowpass_filter for cupy.
    • Lock global constants when using ip.SetConst for safer parallel processing.
    Source code(tar.gz)
    Source code(zip)
  • v1.26.0(Feb 28, 2022)

    New Features

    • Whether use numpy or cupy can be switched at any time.
      with ip.use("cupy"):
          out = img.gaussian_filter()
      
    • max_shifts in ip.pcc_maximum now supports float value.
    • Initial support of map_coordinates in ImgArray.

    Other changes

    • Bug fix in ip.fsc.
    • Default dask chunking is same as chunks="auto".
    Source code(tar.gz)
    Source code(zip)
  • v1.25.2(Feb 16, 2022)

    Updates

    • max_shifts argument in ip.pcc_maximum. Using this argument you can control the maximum shift of phase cross correlation.
    • The axes arguments in numpy functions are overloaded. Now you can call like np.rot90(img, axes="yx").
    • Cache .shape property.
    Source code(tar.gz)
    Source code(zip)
  • v1.25.1(Jan 25, 2022)

    Improvements

    • Avoid using functions from dask-image for better performance on multi-dimensional images (gaussian_filter and convolve).
    • Performance improvements on binning using GPU.
    • Set depth correctly in LazyImgArray.
    Source code(tar.gz)
    Source code(zip)
  • v1.25.0(Jan 20, 2022)

    Highlight

    • CLI (command line interface) is supported now. Instead of launching Python, you can just use the terminal. See documentation for the details.
    • Performance of parallel calculation on GPU is largely improved.

    New Features

    • ImgArray.imsave now can save .mrc file if file extension is specified.
    • New method smooth_mask in ImgArray for creating soft masks.
    • CLI support.

    Improvements

    • Read .map file using mrcfile.
    • Check scale values when any of them is set.
    • Clearer error and caching on axis-targeted slicing.
    • Clearer docstrings of numpy-like functions such as ip.zeros.
    • Make read_meta faster.
    • Do not rechunk in proj and binning for better performance.
    • Improve performance using cupy.
    • Lazy loading of pandas and dask.
    • Update for napari==0.4.13

    Deprecations

    • In LazyImgArray, img.compute() should be used in place of img.data because there is no reason to use different name as dask.
    • In LazyImgArray, img.value should be used in place of img.img for compatibility with ImgArray.
    Source code(tar.gz)
    Source code(zip)
  • v1.24.4(Jan 9, 2022)

    Bug Fixes

    • Fourier transformation fft and ifft returned wrong results if image has axes other than spatial dimensions.

    Changes

    • impy.random is no longer an Random object but now its a submodule. No API change.
    • New random functions, random_uint8 and random_uint16, for easier random image generation.
    • Clearer error handling in imsave.
    • Set scale_unit to "px" if exception happened.
    Source code(tar.gz)
    Source code(zip)
  • v1.24.3(Dec 24, 2021)

    New Features

    • In Fourier transformation methods such as fft, power_spectra and local_dft, you can set double_precision=True to force float64 and complex128 calculation because single precision sometimes causes non-negligible errors.
    • Floating error in local_dft is minimized by considering periodicity of exponential function. The error between local_dft and fft are now completely even.

    Bug Fixes

    • lowpass_filter, highpass_filter did not work on such as "tyx" and "zcyx" images.
    • __turediv__ was incompatible with complex images.
    • enhance_contrast was incompatible with float images.
    • LazyImgArray behaved in slightly different ways compared to ImgArray.

    Others

    • Fixed some typings.
    • Add tests of major functions.
    Source code(tar.gz)
    Source code(zip)
  • v1.24.2(Nov 28, 2021)

    Changes

    • Don't change napari because it became incompatible with current version.
    • Bug fix in numpy inherited functions such as ip.empty.
    • Phase cross correlation function with Fourier space input.
    Source code(tar.gz)
    Source code(zip)
  • v1.24.1(Nov 11, 2021)

    Changes

    • License is changed to BSD 3-Clause.
    • Add reset button in plane clip.
    • The angle axis "<" are all changed to "a".
    • img.shape now returns namedtuple (AxesShape) object.
    • Update table widget etc. for the latest napari.
    • New low-pass filter methods.
    • Force float32 in FFT based filters.
    • Use np.memmap and tempfile in LazyImgArray's release and imsave methods and the performance is largely improved.
    • ScaleDict support __setitem__ and __setattr__.
    • Update typings.
    • Removed label_multiostu and slic methods because they are unstable.
    • Update setup.py for PyPI.

    Bug Fixes

    • ifft was not correct.
    • Some correlation functions were not compatible with cupy.
    Source code(tar.gz)
    Source code(zip)
  • v1.23.0(Sep 5, 2021)

    In this release I updated for napari==0.4.11 and improved some UI.

    New Features

    • Table widget is largely improved.
      • When a data is selected in shapes/points layer, the corresponding table row will be highlighted, both in 2D or 3D mode.
      • When a shapes/points layer is linked to a table widget, manually adding/deleting data in the viewer can at the same time adding/deleting table row(s) in the table.
      • When table items or header names are changed, the properties of linked shapes/points layer will also be changed. Now you can use table widget as property editor.
      • Some shortcuts are deleted because they usually conflict with main window.
    • You can change text layer's text in place with double click.
    • 3D plane clipper is added in "Layer" menu, owing to the clipping plane feature in napari==0.4.11.
    Source code(tar.gz)
    Source code(zip)
  • v1.22.0(Aug 25, 2021)

    Highlights

    • Image analysis protocols can be easily defined. Decorate a function with ip.gui.bind_protocol, then key bindings and parameter container are updated automatically.
    • Shapes and Points layer can be linked to table widget. You can view/edit layer properties, add/delete data etc. from linked tables.
    • Add points or shapes in a similar way to ImageJ ROI using register_point and register_shape. The layers are linked to the result tables.

    New Features

    • Results widget is implemented (similar to Jupyter's variable explorer). ip.gui.results are updated to this widgets but API does not change.
    • Editability of table widget can be changed. Default is not editable now.
    • Layer projection (Ctrl+P) supports labels projection.
    • Many functions that could only be called by key binding are callable from menu bar.
    • Axes.scale uses ScaleDict now. You can get scales by such as img.scale.x instead of img.scale["x"]. ScaleDict is also compatible with scale parameter in Affine transformation, so that it can directly passed to them like viewer.add_image(img, scale=img.scale).
    • "Add time stamp" menu in menu bar.

    Improvements

    • Zoom factor changing problem upon key binding "[" and "]" are solved.
    • Highlight warnings and errors in logger.
    • The main figure canvas and parameter container are floating by default.
    • File information in the tooltips of file explorer.
    • "Alt+Up", "Alt+Down" is overloaded to assert z-axis will be changed.
    Source code(tar.gz)
    Source code(zip)
  • v1.21.0(Aug 17, 2021)

    In this release new widgets are added and existing widgets are improved a lot.

    • Table widget now displays formatted float value, which looks better than the default setting. Also, many functions are implemented.
    • Many improvements in figure canvas. It is now highly interactive and subplots are nicely cooperating.
    • Logger widget. Opened only when ip.gui.bind is called and when logger is accessed via ip.gui.log.
    • Explorer widget. Open in "File" menu or "Ctrl+Shift+E".
    • Text file viewer widget. Added when a txt file is opened in the explorer widget.
    • Layer duplication ("Ctrl+Shift+D") and layer projection ("Ctrl+P") now work for any basic layers. However, they dropped support for the case in which multiple layers are selected.
    • ip.gui.bind now can make custom functions with parameter inputs. It automatically adds a parameter controller widget to the active viewer.
    • ip.gui.bind now has access to the table widget and the log widget in the viewer.
    • ip.gui.goto method makes it easier to change the current slice.
    • LabeledArray now inherit copy (not pointer) of metadata from previous array.
    • Call pandas.read_csv and directly convert it to table.
    • ip.imread_collection can read images from list of paths.
    • Some exception of physical scale in Micromanager 's ome.tiff is now considered in ip.imread.
    Source code(tar.gz)
    Source code(zip)
  • v1.20.0(Aug 9, 2021)

    The biggest update in v1.20 is ip.gui.bind method. You can make interactive plugins very easily now.

    New Features

    • Template Matcher
    • Rectangle editor can edit rotated rectangles.
    • Measure Region Properties.
    • Duplicate single slice.
    • Table widget can plot inside the viewer, just like Excel.
    • Bind custom function with ip.gui.bind.
    • ip.gui.get method enables getting certain type of layer's data very easily.
    • ip.gui.current_slice property enables getting slice from viewer very easily.

    Changes and Bug Fixes

    • Focusing markers with [ and ] had a bug. → fixed.
    • Scales were not properly saved by imsave. → fixed.
    • dask.cache is moved into try/except in case Cachey is not installed.
    • apply_dask had a serious bug such as when multidimensional hessian_eigval is called. → fixed.
    • LabeledArray.extract no longer supports crop=False because it is not useful and almost independent of crop=True.
    • Implementation of ImgArray.rotate and ImgArray.scale was wrong. → fixed.
    Source code(tar.gz)
    Source code(zip)
  • v1.19.0(Aug 4, 2021)

    In this release I implemented a lot of new features concerned to napari viewer. Lots of new widgets and key bindings. You can find them in the "Functions" menu in the menu bar.

    New Features in Viewer

    • Text editor widget for Shapes and Points layers. You can edit texts of selected shapes/points easily.
    • Parameter sweeping widget for most of the filtering functions, thresholding and labeling.
    • Show image's info by Alt+ right click.
    • You can directly label an image in napari viewer (change img.labels in place).
    • Text layer is available.
    • Rectangle editor is available. You can set rectangle's edge lengths with pixels.
    • Call regionprops in viewer and add the result directly to the Labels layer's properties.
    • add_surface function to convert 3D images into Surface layers.
    • You can call __getitem__ in function handler using input like ["y=10:40"].
    • You can move shapes with arrow keys → ↑ ← ↓.
    • When a Shapes or Points layer is selected, you can focus on the previous/next object by pressing [ or ].
    • Cropping bug is fixed when rectangle is larger than images.

    Others

    • You can add images from the disk directly by ip.gui.add(path).
    • Name ip is added in the global namespace by default inside napari's console if it is started from start.py.
    • LazyImgArray.drift_correction's graph construction is much faster now by moving variable shift into the local warp function.
    • threshold's argument is changed: dimsalong, for compatibility with other functions.
    • local_dft, local_power_spectra for fast up-sampling Fourier transformation.
    • opening function in Label.
    Source code(tar.gz)
    Source code(zip)
  • v1.18.0(Jul 28, 2021)

    New Functions in LazyImgArray

    • track_drift, drift_correction → Both works totally lazily with specialized implementation.
    • Morphological processings: erosion, dilation, opening and closing.
    • FFTs: fft, ifft and power_spectra.
    • Deconvolution algorithms: wiener and lucy. lucy_tv is not implemented because it evaluate total variance for every iteration.

    New Features

    • Document added in GitHub Page.
    • Show dimensionality of ongoing function to avoid 2D/3D mistakes.
    • Dask + GPU is set to single-threaded by default to avoid OutOfMemoryError in cupy.
    • Dask caching system is now utilized for fast image processing.
    • Automatic docstring generation.
    Source code(tar.gz)
    Source code(zip)
  • v1.17.0(Jul 23, 2021)

    HighLights

    • GPU/cupy are now supported! You can conduct Affine transformation, deconvolution and many filter functions with GPU. Arrays are converted inside the functions so that you don't have to care about the difference between numpy and cupy.
    • Correlation functions with masks are available. You can calculate correlation in any sub-regions between two images in either real space or Fourier space.
    • Method for_params can run same function with different parameter inputs. No for-loop anymore!

    Other Updates

    • n-dimensional Affine transformation. Affine transformation matrix is made either with skimage or napari.
    • DataList inherits UserList now. All the list methods are compatible.
    • DataDict is defined in place of ArrayDict and FrameDict.
    • DataList is returned in split.
    • You can save LazyImgArray directly with imsave method now.
    • Global variables are stored in dict now. You can update them with such as ip.Const["MAX_GB"] = 3.0 or with context manager with ip.SetConst("MAX_GB", 3.0): ....
    • Delayed import as many as possible.
    • FFT functions now take keyword arguments shape= to specify output shape.
    • Docstring auto generation.
    • Renamed nccncc_filter.

    Bug Fixes

    • mrcfile read images as read-only array, which made it incompatible with some functions. This problem is fixed by explicitly set mode="r+".
    • fill_hole did not work since dask is integrated as multiprocessing. Now fixed.
    • rotated_crop in LazyImgArray, or corresponding rotated cropping in viewers returned wrong shape of arrays. This is fixed now.
    Source code(tar.gz)
    Source code(zip)
  • v.1.16.0(Jul 17, 2021)

    New Features and Changes

    1. LazyImgArray
    • It is now implemented with many new functions similar to those in ImgArray -- rotated_crop, crop_center, binning, proj, gaussian_filter, median_filter, convolve, edge_filter and reslice. dask arrays are rechunked automatically to make function running efficiently. Some function are dependent on dask_image.
    • Changing data type with as_uint8, as_uint16. Be careful these functions do not work exactly in a same way as those in ImgArray. Because dask must be evaluated in if, they cannot check whether a float image is in range of [0, 1].
    1. ImgArray
    • proj has a new option mask=.... You can mask input image and calculate projection without the masked region. This is useful when you want to exclude outliers in the image from its projection.
    • __getitem__ is safer for images without axes.
    • All the multiprocess methods are translated to dask methods, with function apply_dask. Accordingly, parallel, parallel_eig, n_cpu are deleted.
    1. napari viewer
    • When you are drawing a rectangle, line or path, its properties are displayed on the text overlay in the upper left corner.
    • You can select an image layer just by clicking it in the viewer with Alt.
    • Image cropping now takes layer scale differences into account.
    • You can crop images in other planes. You can crop in XY and crop again in XZ.
    1. Others
    • ip.imread and ip.lazy_imread now supports squeezing arrays as an option. This is useful when there is only one image file in a folder.
    • Almost all the constant values are changed to global variables. ip.set_verbose no longer works. Change it by ip.SHOW_PROGRESS = False or ip.MAX_GB = 3.0 directly.
    • Axes handling parts of arrays are moved to AxesMixin. MetaArray and LazyImgArray inherit it.
    • ip.imread and evaluation functions in LazyImgArray always raise MemoryError if the expected size exceeds ip.MAX_GB.
    • You can run reslice in viewer to make a kymograph.
    • HTML rich output in Jupyter Notebook.
    • Many decorators are unified into @record because they are redundant.
    • Argument mapping in ip.bind is deprecated because it is useless.
    Source code(tar.gz)
    Source code(zip)
  • v1.15.0(Jul 8, 2021)

    Important Changes

    • Old imread_collection and imread_stack cannot be called now. Use imread instead. Also, how to recursively read images is changed to pims-like format, i.e., write the wildcard string directly as a path e.g. >>> ip.imread(r"C:\...\**\*.tif").
    • imread_collection now works as an I/O function for reading images with different shapes and storing them in DataList.

    New Features

    • I/O functions now support mrc and rec files, if mrcfile is installed. Metadata is stored in tif-friendly format.
    • Image cropping in napari viewer (Ctrl + Shift + X) can use rotated rectangles. It is achieved by ndi.map_coordinates rather than rotating the whole image.
    • You can select image layer(s) just by clicking them with Alt or Ctrl+Alt, similar to PowerPoint.
    • imread(..., key="..."), lazy_imread for reading large datasets.
    • DataList for batch processing images with different shapes.
    • LazyImgArray for handling lazy reading and previewing using dask.
    • radial_profile can calculate radial profile P(r) of images.
    • power_spectra can calculate FFT power spectra image directly.

    Improvements

    • Some functions, like gaussian_filter, are faster with single thread so that they are never conducted with multi-processing.
    • Large scales caused edge width of shape layers being too thin. Edge widths will be calculated every time shape layers are added.
    • napari viewer now support handling LazyImgArray as dask input, and DataList by adding all the contents.

    Bug Fixes

    • regionprops could have not be calculated since numpy function is overloaded for ImgArray. This problem is fixed.
    • binning was not true binning because affine transformation is not same as binning. Now binning returns correct results, and you can also use other reduce functions such as np.median for binning.
    • Image cropping aborted such as dirpath and scale of images. This problem is now fixed for both MetaArrays and dask.arrays.core.Array.
    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(Jul 3, 2021)

    New Functions

    • tile function for image tiling. Overlap is not considered for now.
    • lowpass_filter and highpass_filter. Similar functions will be imported from skimage.filters after v0.19 is available.
    • binning function for image binning like 2x2 or 4x4. Divisibility is required unlike rescale.
    • for_each_channel enables different parameter inputs for different channel. Until v1.13, you needed to split channels, apply function for each channel, and stack them again. Now you only have to call for_each_channel.
    • kalman_filter for smoothing of time-series image stacks. This function is identical to "Kalman Stack Filter" in ImageJ.
    • PathFrame that contains paths, similar to TrackFrame.
    • pathprops can measure path properties like regionprops.

    Improvements

    • imread can call imread_collection or imread_stack to open folder instead of raising errors. With default settings you don't have to call imread_collection or imread_stack anymore.
    • Call TiffFile just once in imread.
    • In some functions, such as lucy, rfftn and irfftn are used instead of fftn and ifftn. This change makes them ~2 times faster.
    • Some numpy functions, such as np.allclose, did not support MetaArray input. Now fixed.
    • reslice now supports reslicing a path.
    • napari's viewer can automatically add a table widget when a PropArray is given.
    • napari's viewer can automatically add a Shapes layer when a PathFrame is given.
    Source code(tar.gz)
    Source code(zip)
  • v1.13.0(Jun 18, 2021)

    This release contains many new functions and function improvements.

    New Functions

    • rof_filter for total variance denoising.
    • pearson_coloc and manders_coloc to calculate colocalization coefficient.
    • crop_kernel to make small kernel array.
    • ncc for template matching using NCC (normalized cross correlation).
    • You can make Gaussian kernel images with impy.gaussina_kernel for deconvolution and template matching.
    • track_template for template tracking based on NCC.

    Improvements

    • Viewer widget function_handler now accept list and numpy as input.
    • Link (Ctrl + G) and unlink (Ctrl + Shift + G) layer shortcuts: .
    • Defocusing padding in yx-direction with defocus.
    • find_sm has a new option method="ncc". This method is based on template matching of Gaussian particle.
    • find_sm has a new keyword argument cutoff. Filtered images are clipped by this value.
    • lucy and lucy_tv takes new argument eps=... to avoid near-zero division.
    • You can call imsave inside napari.
    • Many typings are added for future integration of function_handler and magicgui.

    Bug Fixes

    • Cropping (Ctrl + Shift + X) works fine now.
    • random_walker works fine now.

    Changes

    • Ctrl + Shift + X removes the original image. Duplicate it if you want.
    • ImgArray object made by imread_stack now have dirpath attribute at the deepest directory of path argument, which does not contain either "$" or "*".
    • defocus also pad in yx-direction by default. If it is not needed, you need to set width = 0.
    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Jun 11, 2021)

    This Release is mainly focused on viewer.

    New Features in Viewer

    • Custom key bindings (crop, duplicate, labeling, reset etc.).
    • Translation , rescaling within layers using mouse.
    • Table, notepad widgets.
    • Call impy.imread function inside viewers. Unlike the original one, this can read tiff metadata.

    Improvements

    • centroid_sm now works for "zcyx"-images.
    • Layer-to-impy-object conversion is smarter now. Axes & scale information are recorded in metadata attributes so that AxesFrame remembers the initial states.
    • Label determines dtype upon construction.
    • rolling_ball can return background with keyword return_bg=True. Also, median filter is available for prefiltering.

    Changes

    • Argument name in rolling_ball is changed: smoothprefilter.
    • impy.windowimpy.gui because it is no longer a single window.
    Source code(tar.gz)
    Source code(zip)
  • v1.11.0(Jun 6, 2021)

    This release contains many improvements for general usage.

    New Features and Functions

    1. Direct use of numpy functions.

    • With __array_function__, we can overload numpy functions in a single-dispatch-like way (see here). Now you can use numpy functions directly in a impy style, like np.mean(img, axis="t"), np.expand_dims(img, axis="pz"), np.stack([img1, img2], axis="z"). Those functions that may change the dimensions of arrays are individually re-implemented.
    • Other numpy functions like np.array or np.random.rand cannot know if you are to generate np.ndarray or ImgArray. These functions are implemented in ip.array, ip.random.rand style.

    2. Custom function binder.

    • ip.bind decorator class can interpret custom defined functions for batch processing. This decorator add dims keyword argument and convert the function into an ImgArray-like format. As long as the custom function returns images or labels with same shape as input, or single property per image, almost any function can be extended for batch processing.

    3. napari viewer is improved as lot.

    • ip.window can deal with multiple windows. Previous codes still works, while new window is created by ip.window["new name"].add(X)..
    • You can crop image with Ctrl+Shift+X.
    • Many methods can be called inside napari.Viewer.
    • Manually selected layers can be obtained by ip.window.selection. They are in ImgArray, MarkerFrame, ... form.

    4. Others

    • In accordance with the release of napari==0.4.8, scale unit can be displayed beside the scale bar. impy can automatically read scale unit from the metadata of such as ImgArray so that you don't need to add scale unit all the way.
    • lucy_tv, Richardson-Lucy with total variance regularization is now available. This is a little bit slower than lucy but is widely used for deconvolution.

    Important Changes

    • Functions that deal with labels while keep original image untouched, such as label and watershed, returned LabeledArray before. Hereafter they'll return Label instead.
    • ip.stack, ip.zeros_like, ip.empty_like no longer works. Use np.stack, np.zeros_like, np.empty_like instead.

    Buf Fixes

    • AxesFrame.iter method sometimes raises error because of inconsistency between iteration took place or not. This is fixed now.
    • dims_to_spatial_axes now works for AxesFrame as well.
    • estimate_sigma method did not work due to wrong implementation. This is fixed now.
    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Jun 3, 2021)

    This release mainly focused on bug fixes and improvements.

    Improvements

    1. Reading/writing xy- or z-scales.

    Previously impy could not automatically deal with scale (or image resolution) so that users must set it by set_scale method. Now you don't need to do that!

    • ip.imread can read scales from tiff metadata and store it into scale property of ImgArray.
    • imsave method can write scales of LabeledArray into tiff files. It is compatible with ImageJ so that you can confirm in ImageJ by Ctrl+Shift+P.

    2. More flexible reading functions.

    impy now supports more flexible file handling.

    • In ip.imread_collection, ext argument is deprecated. Instead, wildcard can be defined in more detailed way by filename argument and image shape, axes or scale you want to read can be filtered by template argument.
    • The new function ip.imread_stack suits for practical image stacking for real microscopy. You may want to save multiple tiff files in different folders, and make a image stack from such as fr"~\XX{i}\YY{j}.tif" for i in [10,20,30] for j in [0,1,2,3] format, followed by defining i-direction as t-axis and j-direction as p-axis. This task can be achieved by a very simple code: img = ip.imread_stack(fr"~\XX$t\YY$p.tif").

    3. Axis-targeted broadcasting

    Previously, when img1 has zcyx-axes and img2 has zyx-axes, img1/img2 raised broadcasting error due to numpy's broadcasting rules. However, MetaArray should know how to broadcast because apparently img1 and img2 have common axes "zyx". Now axis-targeted broadcasting is working. Accordingly, previous broadcasting-like parts in __getitem__ method is replaced with common function _broadcast.

    4. Others

    • set_scale can take "xy" or "yx" arguments to set yx-scale at the same time, like img.set_scale(yx=0.217).
    • You can access skimage's sample data with such as ip.sample_image("camera"). Image axes of RGB images will always be transposed so that they are cyx-order.
    • crop_center, remove_edges accepts sequence as parameters.
    • defocus now can take any array as a defocusing kernel. Default Gaussian kernel is also supported.
    • lucy is ~30% faster now, achieved by recycling array objects during iterations.
    • ip.squeeze can squeeze ImgArray in a flexible way.
    • imsave can automatically change axes symbols if possible when any symbols are not compatible with ImageJ (e.g. pyx -> tyx).
    • proj can calculate projection along multiple axes, like img.proj(axis="ptz").

    Bug Fixes

    • track_drift and drift_correction had wrong default settings so they always raised errors without explicit along argument. → Fixed, and the error messages are also improved.
    • Axes.replace(old, new) did not change scale attribute at the same time. This caused inconsistency between axes and scale and raised KeyError in many situations (especially imsave). → Fixed, and to prevent unexpected overwriting, scale will be copied every time upon this function call.
    Source code(tar.gz)
    Source code(zip)
Owner
Department of Biological Sciences, School of Science, The University of Tokyo. My major is biophysics, especially microtubule and motor proteins.
Remove Background from Image With Python

Install Library pypi $ pip3 install xremovebg

krypton 4 May 26, 2022
ScreenTeX is a tool that grabs all text when taking a screenshot rather than getting an image.

The ScreenTeX project By: Seanpm2001 / ScreenTeX, Et; Al. Top README.md Read this article in a different language 🌐 List of languages Sorted by: A-Z

Sean P. Myrick V19.1.7.2 3 Oct 25, 2022
Hacking github graph with a easy python script

Hacking-Github-Graph Hacking github graph with a easy python script Requirements git latest version installed. A text editor (eg: vs code, sublime tex

SENPAI LEGEND 1 Nov 01, 2021
A pure python implementation of the GIMP XCF image format. Use this to interact with GIMP image formats

Pure Python implementation of the GIMP image formats (.xcf projects as well as brushes, patterns, etc)

FHPyhtonUtils 8 Dec 30, 2022
Converting Images Into Minecraft Houses

Converting Images Into Minecraft Houses In this particular project, we turned a 2D Image into Minecraft pixel art and then scaled it in 3D such that i

Mathias Oliver Valdbjørn Jørgensen 1 Feb 02, 2022
PyPixelArt - A keyboard-centered pixel editor

PyPixelArt - A keyboard-centered pixel editor The idea behind PyPixelArt is uniting: a cmdpxl inspired pixel image editor applied to pixel art. vim 's

Douglas 18 Nov 14, 2022
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Kizdude 2 Jan 22, 2022
Fast Image Retrieval (FIRe) is an open source image retrieval project

Fast Image Retrieval (FIRe) is an open source image retrieval project release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This project implements most of the major bi

CISiP Lab 39 Nov 25, 2022
CadQuery is an intuitive, easy-to-use Python module for building parametric 3D CAD models.

A python parametric CAD scripting framework based on OCCT

1.9k Dec 30, 2022
python app to turn a photograph into a cartoon

Draw This. Draw This is a polaroid camera that draws cartoons. You point, and shoot - and out pops a cartoon; the camera's best interpretation of what

Dan Macnish 2k Dec 19, 2022
A small Python module for BMP image processing.

micropython-microbmp A small Python module for BMP image processing. It supports BMP image of 1/2/4/8/24-bit colour depth. Loading supports compressio

Quan Lin 4 Nov 02, 2022
Simple AI app that is guessing color of apple in picture

Apple Color Determinant Application that is guessing color of apple from image Install Pillow, sklearn and numpy, using command for your package manag

Gleb Nikitin 1 Oct 25, 2021
LSB Image Steganography Using Python

Steganography is the science that involves communicating secret data in an appropriate multimedia carrier, e.g., image, audio, and video files

Mahmut Can Gönül 2 Nov 04, 2021
An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C.

vizh An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C. Overview Her

Sy Brand 228 Dec 17, 2022
ImageStrike是一款用于CTF中图片隐写的综合利用工具

🎈 简介 ImageStrike是一款使用PyQT5开发,用于CTF中图片隐写的综合利用工具

zR00t1 133 Dec 27, 2022
Python pygame project that turns your images to matrix rain

Matrix-Rain-An-Image This project implements the classic Matrix digital rain effect in python with pygame to build up an image provided with multiple

7 Dec 11, 2022
Gallery written in Python to manage your photos

GalleryMan Gallery written in Python to manage your photos Installation

Asian Cat 24 Dec 18, 2022
Python Interface of P3D

pyp3d 介绍: pyp3d是一个可在python上使用的工具包,它提供了一种可使用python脚本驱动创建模型的方法,为三维建模提供了全新的思路。 pyp3d中定义了一系列建模相关的必要的数据类型,例如球体、圆锥台、四棱锥台、 拉伸体、圆角管等几何体,pyp3d还提供了许多函数来实现放置集合体、

20 Sep 07, 2022
Art directed cropping, useful for responsive images

Art direction sets a focal point and can be used when you need multiple copies of the same Image but also in in different proportions.

Daniel 1 Aug 16, 2022
Create a 2D mesh for an airfoil in GMSH using python.

GMSHFoil A simple class to create a 2D mesh for an airfoil in GMSH using python. Requirements pip install airfoils

Charilaos Mylonas 1 May 16, 2022