jupyter-compare-view


Namejupyter-compare-view JSON
Version 0.2.3 PyPI version JSON
download
home_page
SummaryBlend Between Multiple Images in JupyterLab.
upload_time2023-03-12 20:52:05
maintainer
docs_urlNone
authorOctoframes
requires_python>=3.8,<3.13
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Jupyter compare_view

![bannerFINAL](https://user-images.githubusercontent.com/44469195/179508322-ea10e22a-6dfb-47f4-8fbb-d5ce724f0127.png)

[![JupyterLight](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://octoframes.github.io/jupyter_compare_view)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Octoframes/jupyter_compare_view/HEAD?labpath=example_notebook.ipynb)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Octoframes/jupyter_compare_view/blob/main/example_notebook.ipynb)
[![PyPI version](https://badge.fury.io/py/jupyter_compare_view.svg)](https://badge.fury.io/py/jupyter_compare_view)
[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Octoframes/jupyter_compare_view/blob/main/LICENSE)


Blend between multiple images using a cell magic in JupyterLab using [compare_view](https://github.com/Octoframes/compare_view).   
*This project was called jupyter-splitview before.*  


## Installation
```py
pip install jupyter_compare_view
```
## Example
```py
import jupyter_compare_view
```

```py
%%compare  
from skimage import data
from skimage.color import rgb2gray
import matplotlib.pyplot as plt

img = data.chelsea()
grayscale_img = rgb2gray(img)

plt.imshow(img)
plt.axis("off")
plt.show()

plt.imshow(grayscale_img, cmap="gray")
plt.axis("off")
plt.show()
```

<img src="https://user-images.githubusercontent.com/44469195/179499138-65160434-11e1-4358-8e25-5b26ba9ebf4a.png" style="width: 400px;"/>

Another example:
```py
from jupyter_compare_view import compare

compare(img, grayscale_img, cmap="gray", start_mode="horizontal", start_slider_pos=0.73)
```
<img src="https://user-images.githubusercontent.com/44469195/179499350-94244408-cabf-4945-affc-fd0444d53555.png" style="width: 400px;"/>


The split view widget is still responsive after closing and reopening the notebook without running the cell again.

## Notebook arguments
(Might still change in future)
* `--config '{"start_mode": "horizontal"}'` will init the compare-view in horizontal slider mode.
* `--config '{"circle_size": 30}'`  the circle size is now 30 pixel in circle mode.
* `--config '{"show_slider": false}'` will hide the slider bar.
* `--config '{"start_slider_pos": 0.73}'` will set the slider start position to 73%. 

    * *Removed in 0.1.1: `--position 73%` will no longer the slider start position to 73%.*
* `--config '{"start_mode": "horizontal","start_slider_pos": 0.73}'` will both set the start mode to horizontal and set the slider position
* `--height 220` will set the height to 220 pixel. 
* When `--height`is not provided, the default height of the widget is 300 pixel.
* `--height auto` will set the height by the value of the first image's resolution in vertical direction.
* The widget's width will always be adjusted automatically. 

## Notebook formatting
Formatting with black can be done this way: 
1. `pip install 'black[jupyter]'`
2. `black --python-cell-magics compare compare_view_magic.ipynb`


## Developer Installation

1. `git clone --recurse https://github.com/Octoframes/jupyter_compare_view`
(Note: In case that the repo was already cloned e.g. with the GitHub Desktop client, the  GitHub submodule has to be loaded via `git submodule update --init --recursive`)
2. `poetry install`

*Note*: The IPython extension `autoreload` reloads modules before every cell execution. Very useful when debugging the `%%capture` cell magic!
Just add these lines into the first jupyter cell.
```py
%load_ext autoreload
%autoreload 2
import jupyter_compare_view
```

## Changelog


## 0.2.3

Remove setuptools dependency
## 0.2.2

* Remove python3.7 support [#46](https://github.com/Octoframes/jupyter_compare_view/pull/46)
* fix jupyterlite example
## 0.2.1

* Support python 3.11

## 0.2.0

* Implemented `capture` to display the compare view frame without calling the cell magic. This is not an ipywidget as mentioned [here](https://github.com/Octoframes/jupyter_compare_view/pull/41#pullrequestreview-1205327074). 
* Update version requirements [#42](https://github.com/Octoframes/jupyter_compare_view/pull/42/files)
## 0.1.5

* BugFix: Remove black import that was added by accident. 

## 0.1.4

* `%%compare`  is now `%%splity`. `%%splity` is deprecated.
* Update examples

## 0.1.3

* octoframes github actions setup

## 0.1.2

* Move the repo from kolibril13/jupyter-spitview to octoframes/jupyter_compare_view 
* Rename all references
## 0.1.1

* Drop the [github.com/NUKnightLab/juxtapose](https://github.com/NUKnightLab/juxtapose) backend and replace it with [github.com/Octoframes/compare_view](https://github.com/Octoframes/compare_view).  
* Implement horizontal slider
* Implement Round Mask
## 0.1.0

* Update dependencies
* Update JupyterLite version
* Fix: in JupyterLite, a figure has to be explicitly called by plt.show()
* Better installation workflow

## 0.0.8

* Fixing problem with cell id and notebook reloading
* Experimentally lowering the dependencies to
`ipython = ">=6.0.0"` and `ipykernel = ">=5.0.0"` so that  jupyterlite will work hopefully.

## 0.0.7

* Rewrite of the import of JavaScript and CSS to make it more robust when closing and opening the notebook
* First attempt to add a JupyterLite example.
## 0.0.6 

Fix poetry workflow

## 0.0.5 

* Ship the javascript directly with the package, so no internet connection is required
* use jinja2 to save HTML in separate file
* load stylesheet and javascript only once in the beginning, and not in every cell that contains the splitview widget.

## 0.0.4 

* New `--height` parameter

## 0.0.3

* default slider position
* updated minimal example
* internal code restructuring and formatting
* Handle import in non jupyter context

## 0.0.2 
* save images in base64 strings and don't load images to disk (increases package security).
## 0.0.1

* First release

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jupyter-compare-view",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.13",
    "maintainer_email": "",
    "keywords": "",
    "author": "Octoframes",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/0f/18/6dc351fe927c6a3d28e22fd966068b82ac333dbe304da8e8d815140f4dc9/jupyter_compare_view-0.2.3.tar.gz",
    "platform": null,
    "description": "# Jupyter compare_view\n\n![bannerFINAL](https://user-images.githubusercontent.com/44469195/179508322-ea10e22a-6dfb-47f4-8fbb-d5ce724f0127.png)\n\n[![JupyterLight](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://octoframes.github.io/jupyter_compare_view)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Octoframes/jupyter_compare_view/HEAD?labpath=example_notebook.ipynb)\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Octoframes/jupyter_compare_view/blob/main/example_notebook.ipynb)\n[![PyPI version](https://badge.fury.io/py/jupyter_compare_view.svg)](https://badge.fury.io/py/jupyter_compare_view)\n[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Octoframes/jupyter_compare_view/blob/main/LICENSE)\n\n\nBlend between multiple images using a cell magic in JupyterLab using [compare_view](https://github.com/Octoframes/compare_view).   \n*This project was called jupyter-splitview before.*  \n\n\n## Installation\n```py\npip install jupyter_compare_view\n```\n## Example\n```py\nimport jupyter_compare_view\n```\n\n```py\n%%compare  \nfrom skimage import data\nfrom skimage.color import rgb2gray\nimport matplotlib.pyplot as plt\n\nimg = data.chelsea()\ngrayscale_img = rgb2gray(img)\n\nplt.imshow(img)\nplt.axis(\"off\")\nplt.show()\n\nplt.imshow(grayscale_img, cmap=\"gray\")\nplt.axis(\"off\")\nplt.show()\n```\n\n<img src=\"https://user-images.githubusercontent.com/44469195/179499138-65160434-11e1-4358-8e25-5b26ba9ebf4a.png\" style=\"width: 400px;\"/>\n\nAnother example:\n```py\nfrom jupyter_compare_view import compare\n\ncompare(img, grayscale_img, cmap=\"gray\", start_mode=\"horizontal\", start_slider_pos=0.73)\n```\n<img src=\"https://user-images.githubusercontent.com/44469195/179499350-94244408-cabf-4945-affc-fd0444d53555.png\" style=\"width: 400px;\"/>\n\n\nThe split view widget is still responsive after closing and reopening the notebook without running the cell again.\n\n## Notebook arguments\n(Might still change in future)\n* `--config '{\"start_mode\": \"horizontal\"}'` will init the compare-view in horizontal slider mode.\n* `--config '{\"circle_size\": 30}'`  the circle size is now 30 pixel in circle mode.\n* `--config '{\"show_slider\": false}'` will hide the slider bar.\n* `--config '{\"start_slider_pos\": 0.73}'` will set the slider start position to 73%. \n\n    * *Removed in 0.1.1: `--position 73%` will no longer the slider start position to 73%.*\n* `--config '{\"start_mode\": \"horizontal\",\"start_slider_pos\": 0.73}'` will both set the start mode to horizontal and set the slider position\n* `--height 220` will set the height to 220 pixel. \n* When `--height`is not provided, the default height of the widget is 300 pixel.\n* `--height auto` will set the height by the value of the first image's resolution in vertical direction.\n* The widget's width will always be adjusted automatically. \n\n## Notebook formatting\nFormatting with black can be done this way: \n1. `pip install 'black[jupyter]'`\n2. `black --python-cell-magics compare compare_view_magic.ipynb`\n\n\n## Developer Installation\n\n1. `git clone --recurse https://github.com/Octoframes/jupyter_compare_view`\n(Note: In case that the repo was already cloned e.g. with the GitHub Desktop client, the  GitHub submodule has to be loaded via `git submodule update --init --recursive`)\n2. `poetry install`\n\n*Note*: The IPython extension `autoreload` reloads modules before every cell execution. Very useful when debugging the `%%capture` cell magic!\nJust add these lines into the first jupyter cell.\n```py\n%load_ext autoreload\n%autoreload 2\nimport jupyter_compare_view\n```\n\n## Changelog\n\n\n## 0.2.3\n\nRemove setuptools dependency\n## 0.2.2\n\n* Remove python3.7 support [#46](https://github.com/Octoframes/jupyter_compare_view/pull/46)\n* fix jupyterlite example\n## 0.2.1\n\n* Support python 3.11\n\n## 0.2.0\n\n* Implemented `capture` to display the compare view frame without calling the cell magic. This is not an ipywidget as mentioned [here](https://github.com/Octoframes/jupyter_compare_view/pull/41#pullrequestreview-1205327074). \n* Update version requirements [#42](https://github.com/Octoframes/jupyter_compare_view/pull/42/files)\n## 0.1.5\n\n* BugFix: Remove black import that was added by accident. \n\n## 0.1.4\n\n* `%%compare`  is now `%%splity`. `%%splity` is deprecated.\n* Update examples\n\n## 0.1.3\n\n* octoframes github actions setup\n\n## 0.1.2\n\n* Move the repo from kolibril13/jupyter-spitview to octoframes/jupyter_compare_view \n* Rename all references\n## 0.1.1\n\n* Drop the [github.com/NUKnightLab/juxtapose](https://github.com/NUKnightLab/juxtapose) backend and replace it with [github.com/Octoframes/compare_view](https://github.com/Octoframes/compare_view).  \n* Implement horizontal slider\n* Implement Round Mask\n## 0.1.0\n\n* Update dependencies\n* Update JupyterLite version\n* Fix: in JupyterLite, a figure has to be explicitly called by plt.show()\n* Better installation workflow\n\n## 0.0.8\n\n* Fixing problem with cell id and notebook reloading\n* Experimentally lowering the dependencies to\n`ipython = \">=6.0.0\"` and `ipykernel = \">=5.0.0\"` so that  jupyterlite will work hopefully.\n\n## 0.0.7\n\n* Rewrite of the import of JavaScript and CSS to make it more robust when closing and opening the notebook\n* First attempt to add a JupyterLite example.\n## 0.0.6 \n\nFix poetry workflow\n\n## 0.0.5 \n\n* Ship the javascript directly with the package, so no internet connection is required\n* use jinja2 to save HTML in separate file\n* load stylesheet and javascript only once in the beginning, and not in every cell that contains the splitview widget.\n\n## 0.0.4 \n\n* New `--height` parameter\n\n## 0.0.3\n\n* default slider position\n* updated minimal example\n* internal code restructuring and formatting\n* Handle import in non jupyter context\n\n## 0.0.2 \n* save images in base64 strings and don't load images to disk (increases package security).\n## 0.0.1\n\n* First release\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Blend Between Multiple Images in JupyterLab.",
    "version": "0.2.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b359c822213a93dd83da0b72beb0ec0ff8247f97ef6d83d84c3c0c8b455a359d",
                "md5": "d7c385533a8919e773b22d6bacee371c",
                "sha256": "b082c9d986824b6da8d15007b777c673a84797da00832cd1778cf849e549c67a"
            },
            "downloads": -1,
            "filename": "jupyter_compare_view-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d7c385533a8919e773b22d6bacee371c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.13",
            "size": 11654,
            "upload_time": "2023-03-12T20:52:03",
            "upload_time_iso_8601": "2023-03-12T20:52:03.482441Z",
            "url": "https://files.pythonhosted.org/packages/b3/59/c822213a93dd83da0b72beb0ec0ff8247f97ef6d83d84c3c0c8b455a359d/jupyter_compare_view-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f186dc351fe927c6a3d28e22fd966068b82ac333dbe304da8e8d815140f4dc9",
                "md5": "ac5f5bb80d0a01d415c7dd0887c05763",
                "sha256": "1eb8b5f1e0ffefdf8e557ff51b5abf8e094fcc1290fc903ad9d00843a96d0a05"
            },
            "downloads": -1,
            "filename": "jupyter_compare_view-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ac5f5bb80d0a01d415c7dd0887c05763",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.13",
            "size": 12153,
            "upload_time": "2023-03-12T20:52:05",
            "upload_time_iso_8601": "2023-03-12T20:52:05.077835Z",
            "url": "https://files.pythonhosted.org/packages/0f/18/6dc351fe927c6a3d28e22fd966068b82ac333dbe304da8e8d815140f4dc9/jupyter_compare_view-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-12 20:52:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "jupyter-compare-view"
}
        
Elapsed time: 0.04522s