-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.2.2. Repository rehaul, application now supports build, distributi…
…on and install.
- Loading branch information
1 parent
d937c4c
commit 9bae30f
Showing
37 changed files
with
368 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
*.pyc | ||
__pycache__/ | ||
dist/ | ||
test_data/ | ||
*.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2021, Jan Kukačka | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include src/image_viewer_mk2/resources/* | ||
include README.md |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,41 @@ | ||
# image_viewer_mk2 | ||
Simple image viewer | ||
# Image viewer mk2 | ||
Viewer for spectral images, in particular suitable from multispectral optoacoustic tomography. | ||
|
||
## Dependencies | ||
![Screenshot of the image viewer.](doc/screenshot.png) | ||
|
||
**Non-standard libraries**: happy | ||
|
||
**Standard libraries**: PIL, matplotlib, numpy, (optional: PyTorch, pywin32) | ||
## Installation | ||
|
||
``` | ||
pip install image-viewer-mk2 | ||
``` | ||
|
||
Additional dependencies must be installed separately: `happy` (currently not publicly available), optional: `PyTorch` (for GPU-based rendering), `pywin32` (Windows clipboard functionality) | ||
|
||
## Usage | ||
|
||
From python script | ||
**From within python scripts and interactive sessions.** Image viewer returns the rendered image back so that it can be further used inside the script. | ||
``` | ||
import image_viewer_mk2.app as imv | ||
img = np.zeros((height, width, channels)) | ||
imv.main(image=img) | ||
render = imv.start(image=img) | ||
``` | ||
|
||
**From command line as a standalone application.** | ||
``` | ||
> imvmk2 [-i filename] [-c config_filename] [--gpu | --no_gpu] [--debug] | ||
``` | ||
|
||
From command line | ||
## Credits | ||
This software reuses code and icons produced by: cilame, Benjamin Johnson, Remin Emonet, Icon home, Gregor Cresnar, Freepik, Google, and Pancracysdh | ||
|
||
## License | ||
|
||
The software is provided under the [MIT open license](LICENSE.txt). | ||
|
||
## Citation | ||
If you use this software for your research, please cite it as: | ||
``` | ||
> python -m image_viewer_mk2.app [filename] | ||
Kukačka, Jan (2021). Image Viewer MK2 (v0.2.1) [Computer software]. https://github.com/jankukacka/image_viewer_mk2 | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[metadata] | ||
name = image-viewer-mk2 | ||
author = Jan Kukacka | ||
version = 0.2.2 | ||
description = Image viewer for spectral images | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
|
||
url = https://github.com/jankukacka/image_viewer_mk2 | ||
license = MIT | ||
classifiers = | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.7 | ||
License :: OSI Approved :: MIT License | ||
Operating System :: OS Independent | ||
|
||
[options] | ||
package_dir = | ||
= src | ||
packages=find: | ||
python_requires = >=3.7 | ||
|
||
install_requires = | ||
matplotlib | ||
numpy | ||
Pillow | ||
|
||
include_package_data = True | ||
|
||
[options.packages.find] | ||
where = src | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
imvmk2 = image_viewer_mk2.__main__:main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import setuptools | ||
setuptools.setup() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ------------------------------------------------------------------------------ | ||
# File: event.py | ||
# Author: Remi Emonet | ||
# Date: 8/2019 | ||
# Source: https://github.com/twitwi/vuejs-python/tree/master/vuejspython/observablecollections | ||
# License: MIT | ||
# ------------------------------------------------------------------------------ | ||
|
||
class Event: | ||
def __init__(self, action, source): | ||
self._action = action | ||
self._source = source | ||
|
||
@property | ||
def action(self): | ||
return self._action | ||
|
||
@property | ||
def source(self): | ||
return self._source |
8 changes: 8 additions & 0 deletions
8
ObservableCollections/observable.py → ...r_mk2/ObservableCollections/observable.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ObservableCollections/observabledict.py → ...2/ObservableCollections/observabledict.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ObservableCollections/observablelist.py → ...2/ObservableCollections/observablelist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ObservableCollections/observableset.py → ...k2/ObservableCollections/observableset.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import sys | ||
import argparse | ||
|
||
try: | ||
from importlib import metadata | ||
except ImportError: # for Python<3.8 | ||
import importlib_metadata as metadata | ||
__version__ = metadata.version('image-viewer-mk2') | ||
|
||
# argument parsing | ||
parser = argparse.ArgumentParser(description='Image Viewer MKII: Spectral image viewer') | ||
parser.add_argument('-i', '--input', type=str, help='Filename of the image to open', default=argparse.SUPPRESS) | ||
parser.add_argument('-c', '--config', type=str, help='Filename of the config file to import', default=argparse.SUPPRESS) | ||
|
||
parser.add_argument('-d', '--debug', help='Print errors to console.', action='store_true', default=argparse.SUPPRESS) | ||
parser.add_argument('-g', '--gpu', help='Use GPU rendering (default)', action='store_true', default=argparse.SUPPRESS) | ||
parser.add_argument('-ng', '--no_gpu', help='Use CPU rendering', action='store_true', default=argparse.SUPPRESS) | ||
|
||
|
||
def main(args=None): | ||
from . import app | ||
kwargs = vars(parser.parse_args(sys.argv[1:])) | ||
kwargs2 = {} | ||
|
||
if 'no_gpu' in kwargs: | ||
kwargs2['gpu'] = not kwargs['no_gpu'] | ||
if 'gpu' in kwargs: | ||
kwargs2['gpu'] = kwargs['gpu'] | ||
if 'input' in kwargs: | ||
kwargs2['file'] = kwargs['input'] | ||
if 'config' in kwargs: | ||
kwargs2['config_filename'] = kwargs['config'] | ||
if 'debug' in kwargs: | ||
kwargs2['debug'] = kwargs['debug'] | ||
|
||
print(f'Image Viewer MKII (v{__version__}) Jan Kukacka, 2021.') | ||
app.start(**kwargs2) | ||
|
||
|
||
if __name__ == "__main__": | ||
try: | ||
main() | ||
sys.exit(0) | ||
except Exception: | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.