junkie_picasso adds abstract functionality to the junkie JUpyter NotebooK Image Explorer
Project description
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.
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:
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
Built Distribution
Hashes for junkie_picasso-2024.8.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4046ce2bc0e47ae6af0024663748aa403b928ed2e530b6d91aa7759d3b017caf |
|
MD5 | 2621df76f27c3687b3ea79200c07c5e6 |
|
BLAKE2b-256 | dfb4c7d8cf803b86fa60d103600a1f455a4dae162af45428ec93bf6408c2bd78 |