Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microjson light doc #18

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
tests/__pycache__/
src/microjson/__pycache__/
poetry.lock
tmp*
dist/*
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -19,6 +22,16 @@ 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:

```pip install microjson```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve the visiblity of the bash command

pip install microjson

Please do see the command in the edit mode

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]```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do the same as I suggested above



## 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be rewritten if you want
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

Expand Down
14 changes: 10 additions & 4 deletions README_short.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 [[email protected]]([email protected])
MicroJSON is licensed under MIT License.


---
Expand Down
28 changes: 19 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
Expand All @@ -28,33 +28,43 @@ 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"


[tool.poetry.dependencies.scikit-image]
version = "^0.20.0"
optional = true


[tool.poetry.dependencies.bfio]
version = "2.3.6"
extras = ["all"]
version = "0.2.0"
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]
all = [
"bfio",
"scipy",
"filepattern",
"vaex"
"vaex-core",
"scikit-image",
"matplotlib",
]

[tool.poetry.dev-dependencies]
Expand All @@ -74,7 +84,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
Expand Down
2 changes: 1 addition & 1 deletion src/microjson/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .model import MicroJSON, GeoJSON


__version__ = "0.1.11"
__version__ = "0.2.0"
8 changes: 8 additions & 0 deletions src/microjson/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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):
Expand Down
11 changes: 0 additions & 11 deletions src/microjson/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@
import pydantic
import matplotlib.pyplot as plt

#define conditional imports
try:
from bfio import BioReader
import filepattern as fp
from scipy import ndimage
import vaex
except ImportError as e:
print("""Packages bfio, filepattern, scipy, vaex not installed
please install using pip install microjson[all]""")
raise e


#define conditional imports
try:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import tempfile
from pathlib import Path
from typing import Union
import numpy as np
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

Expand Down