Skip to main content

junkie_picasso adds abstract functionality to the junkie JUpyter NotebooK Image Explorer

Project description

Logo

GPLv3 License Static Badge

JuNkIE-picasso: abstract functionality for Junkie

JuNkIE-picasso adds onto the functionality of JuNkIE, allowing you to not just explore your images, but also the parameter space of your image processing pipeline.

Installing JuNkIE-picasso

To install JuNkIE-picasso, type:

$ python3 -m pip install junkie_picasso

We do most of the development and testing of JuNkIE-picasso in Jupyter Lab, so we recommend using Jupyter Lab.

A note on the Python interpreter

JuNkIE-picasso requires that you have Python 3.10 or above installed.

Using JuNkIE

For details on how to use the basic functionality of JuNkIE, visit the JuNkIE docs.

Adding abstract functions

JuNkIE-picasso allows the user to define abstract image processing functions that will be applied to the input image. This allows you to explore the parameter space of your image processing pipeline without re-writing and re-running your code!

New in version 2024.8.6! Create abstract functions using a simple function definition without the need for an entire class!

Define your image processing function. There are a few rules that it must follow:

  • The first argument must be a positional argument that takes the image numpy array
  • All following arguments must be keyword arguments and contain both type hints and defaults
  • The types of the keyword arguments can be float, int, or bool
  • The function must return the processed image as a numpy array with dtype np.uint16

For example, lets say we wanted to apply a gaussian filter and offset to our image, and have an easy way to turn processing on and off:

def gaussian_and_offset(img, offset: int = 0, sigma: float = .0, apply_flag: bool = False):
  
  if apply_flag:
    for t in range(len(img)):
      img[t] = skimage.filters.gaussian(img[t], sigma, preserve_range=True) + offset
          
  return img.astype(np.uint16)

Finally, create a JuNkIE-picasso instance using your custom class as an additional parameter:

ayim = junkie('/path/to/img.tiff', func=gaussian_and_offset)

The parameters you have defined will appear to the right of the default JuNkIE parameters in a tabbed box, with each tab corresponding to a different parameter. This allows for an arbitrary number of parameters to be added without reorganizing the widget layout.

Making a custom pipeline

Citing JuNkIE-picasso

If you use JuNkIE-picasso, please cite this repository and the repository for the original JuNkIE. We are working on the paper!

Sponsors

We are grateful for the generous support from the following agencies and institutions, which contribute to the development and maintenance of JuNkIE and JuNkIE-picasso:

Sponsors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

junkie_picasso-2024.8.6.tar.gz (19.3 kB view hashes)

Uploaded Source

Built Distribution

junkie_picasso-2024.8.6-py3-none-any.whl (19.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page