Skip to main content

junkie_picasso adds abstract functionality to the junkie JUpyter NotebooK Image Explorer

Project description

Logo GPLv3 License

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!

First, import the abstract function base class:

from junkie_picasso.functions.abstractfunction import AbstractFunction

Next, define a class which details the parameters you want to explore using class variables and the function which updates the image using a class method "update". You will need to know a little bit about which widgets you want to use to change the parameters in the GUI. Here is an example for a simple function that adds an offset to the image:

class add_offset():
    parameters = {"offset": {"type": "intslider", "range": [0, 10000], "step": 1, "value": 0}}

    def update(self, image: numpy.ndarray) -> numpy.ndarray:
        return image + self.parameters["offset"]["value"]

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

ayim = junkie('/path/to/img.tiff', func=add_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

Possible parameter types

For all parameter types, the dict must have:

  1. a "value" key initialized with the default value
  2. a "type" key with one of the following widget names
  3. any other keys required by that widget, as follows
  • "checkbox" (bool value)
  • "intslider" (int value)
    • "range": a tuple of ints denoting the minimum and maximum extents of the slider
    • "step": an int describing the step size for when the slider is moved
  • "floatslider" (float value)
    • "range": a tuple of floats denoting the minimum and maximum extents of the slider
    • "step": a float describing the step size for when the slider is moved
  • "inttext" (int value)
  • "floattext" (float value)
  • "radiobuttons" (str value)
    • "options": a list of strings denoting the different options for each radio button

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-2023.10.1.tar.gz (20.7 kB view hashes)

Uploaded Source

Built Distribution

junkie_picasso-2023.10.1-py3-none-any.whl (19.8 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