diff --git a/.gitignore b/.gitignore index 793f139..35131dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ poetry.lock +tmp* +dist/* src/microjson/__pycache__/ tests/__pycache__/ tiles/ @@ -7,3 +9,4 @@ tiles/ */__pycache__/ *.pyc .vscode/ + diff --git a/README.md b/README.md index db2ba71..c53e0a5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ MicroJSON is a JSON-based format inspired by [GeoJSON](https://geojson.org), designed to encode a variety of data structures related to microscopy images. It can handle representations of reference points, regions of interest, and other annotations, making it an ideal solution for conveying complex microscopy data in a straightforward, easy-to-use format. +For more extensive documentation, please refer to the [online documentation](https://polusai.github.io/microjson/). + + ## Features MicroJSON offers a range of features designed to meet the needs of microscopy data representation: @@ -19,9 +22,23 @@ There are two additional functionalities added which supports binary and label i - **MicrojsonBinaryModel:** Reconstruct binary images using polygon coordinates from json file. +## Installation + +To install MicroJSON, you can use the following command: + +```bash +pip install microjson +``` +This will install the default version of MicroJSON with the basic functionalities and minimal dependencies. If you want to use the additional functionalities, such as provided by the ```utils``` module, you can install the package with the following command: + +```bash +pip install microjson[all] +``` + + ## Usage -MicroJSON can be used with any application or tool that can process JSON data. Due to its design, it is particularly suited to applications related to the analysis, visualization, and manipulation of microscopy images. +MicroJSON is compatible with any application or tool that process JSON data. Its design makes it especially well-suited for applications involving analysis, visualization, and manipulation of microscopy images. ## Examples diff --git a/README_short.md b/README_short.md index 3cc9714..e650905 100644 --- a/README_short.md +++ b/README_short.md @@ -17,6 +17,15 @@ There are two additional functionalities added which supports binary images. **BinaryMicrojsonModel:** Converts objects in a binary image into polygon coordinates (rectangle, encoding) and save them in json file format using microjson package. **MicrojsonBinaryModel:** Reconstruct binary images using polygon coordinates from json file. +## Installation + +To install MicroJSON, you can use the following command: + +```pip install microjson``` +This will install the default version of MicroJSON with the basic functionalities and minimal dependencies. If you want to use the additional functionalities, such as provided by the ```utils``` module, you can install the package with the following command: + +```pip install microjson[all]``` + ## Usage MicroJSON can be used with any application or tool that can process JSON data. Due to its design, it is particularly suited to applications related to the analysis, visualization, and manipulation of microscopy images. @@ -31,10 +40,7 @@ We welcome contributions to the development and enhancement of MicroJSON. Whethe ## License -MicroJSON is licensed under MIT License, (c) 2023 Polus AI & Nextonic Solutions LLC. - -## Authors -Bengt Ljungquist [bengt.ljungquist@nextonicsolutions.com](bengt.ljungquist@nextonicsolutions.com) +MicroJSON is licensed under MIT License. --- diff --git a/pyproject.toml b/pyproject.toml index e52f8fe..c59083d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "microjson" -version = "0.1.11" +version = "0.2.0" description = "MicroJSON is a library for validating, parsing, and manipulating MicroJSON data." readme = "README_short.md" authors = ["Bengt Ljungquist "] @@ -28,15 +28,17 @@ where = ["src"] [tool.poetry.dependencies] python = ">=3.9.15,<3.12" pydantic = "^2.3.0" -scikit-image = "0.20.0" geojson-pydantic = "^1.0.2" +jsonschema = "^4.0.0" geojson2vt = "^1.0.1" vt2pbf = "^0.1.5" protobuf = "^4.25.3" geojson = "^3.1.0" shapely = "^2.0.6" - +[tool.poetry.dependencies.scikit-image] +version = "^0.20.0" +optional = true [tool.poetry.dependencies.bfio] version = "2.4.3" @@ -44,15 +46,19 @@ extras = ["all"] optional = true [tool.poetry.dependencies.scipy] -version = ">=1.8,<1.9.2" +version = "^1.9.1" optional = true [tool.poetry.dependencies.filepattern] version = "^2.0.1" optional = true -[tool.poetry.dependencies.vaex] -version = "^4.17.0" +[tool.poetry.dependencies.vaex-core] +version = "^4.8.0" +optional = true + +[tool.poetry.dependencies.matplotlib] +version = "^3.5.1" optional = true [tool.poetry.extras] @@ -60,7 +66,9 @@ all = [ "bfio", "scipy", "filepattern", - "vaex" + "vaex-core", + "scikit-image", + "matplotlib", ] [tool.poetry.dev-dependencies] @@ -80,7 +88,7 @@ mkdocstrings = "^0.23.0" testpaths = ["tests/"] [tool.bumpver] -current_version = "0.1.11" +current_version = "0.2.0" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "Bump version {old_version} -> {new_version}" commit = true diff --git a/src/microjson/__init__.py b/src/microjson/__init__.py index 5582637..93ccfc1 100644 --- a/src/microjson/__init__.py +++ b/src/microjson/__init__.py @@ -2,5 +2,5 @@ from .tilemodel import TileJSON # noqa: F401 from .microjson2vt.microjson2vt import microjson2vt # noqa: F401 +__version__ = "0.2.0" -__version__ = "0.1.11" \ No newline at end of file diff --git a/src/microjson/model.py b/src/microjson/model.py index 0a01bb8..4d3f0b6 100644 --- a/src/microjson/model.py +++ b/src/microjson/model.py @@ -63,6 +63,14 @@ class Unit(Enum): PIXEL = "pixel" RADIAN = "radian" DEGREE = "degree" + MILLISECOND = "millisecond" + SECOND = "second" + MINUTE = "minute" + HOUR = "hour" + DAY = "day" + WEEK = "week" + MONTH = "month" + YEAR = "year" class AxisType(Enum): diff --git a/src/microjson/utils.py b/src/microjson/utils.py index a8421b8..f4637aa 100644 --- a/src/microjson/utils.py +++ b/src/microjson/utils.py @@ -28,6 +28,8 @@ from microjson.model import Feature from typing import Union import pydantic +import matplotlib.pyplot as plt + #define conditional imports try: diff --git a/tests/test_utils.py b/tests/test_utils.py index 4287d5c..fd657c4 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,14 +6,14 @@ import tempfile from pathlib import Path from typing import Union -import numpy as np -from pydantic import ValidationError import pytest -import skimage as sk + HAS_BFIO = False try: import bfio HAS_BFIO = True + import numpy as np + import skimage as sk except ImportError: pass