Skip to content

Commit

Permalink
Merge pull request #68 from sameeul/update_bioformats_710
Browse files Browse the repository at this point in the history
update bioformats to 7.1.0
  • Loading branch information
sameeul authored Jan 30, 2024
2 parents 8acbca8 + edab223 commit 8b8f2e0
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 156 deletions.
28 changes: 0 additions & 28 deletions .bumpversion.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions .codespellrc

This file was deleted.

2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
docstring-convention=google
max-line-length=88
exclude=noxfile.py,docs/*,tests/*,examples/*,.nox/*,build/*,bfio/OmeXml.py,setup.py
exclude=noxfile.py,docs/*,tests/*,examples/*,.nox/*,build/*
ignore=D105, W503, D100, D104, AZ100
extend-ignore = E203
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- uses: psf/black@stable
with:
options: "--check --color --verbose"
src: "./bfio"
src: "./src"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__pycache__
.vscode
.venv
venv
docs/build
dist
build
Expand Down
55 changes: 0 additions & 55 deletions bfio/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion codespellwords.txt

This file was deleted.

123 changes: 123 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
[build-system]
# Run dependencies are also considered as build dependencies
# due to cascading import situation in src/bfio/__init__.py
requires = [
"setuptools",
"wheel",
"imagecodecs>=2021.2.26",
"numpy",
"ome-types>=0.4.2",
"zarr>=2.6.1",
"scyjava",
"jpype1",
"tifffile>=2022.8.12"
]
build-backend = "setuptools.build_meta"


[project]
name = "bfio"
dynamic = ["version"]
dependencies = [
"imagecodecs>=2021.2.26",
"numpy",
"ome-types>=0.4.2",
"zarr>=2.6.1",
"scyjava",
"jpype1",
"tifffile>=2022.8.12"
]

description = "Simple reading and writing classes for tiled tiffs using Bioformats."
readme = "README.md"
license = {file = "LICENSE"}

authors = [
{name = "Nick Schaub", email = "nick.schaub@nih.gov"},
{name = "Sameeul Bashir Samee", email = "sameeul.samee@axleinfo.com"},
]

maintainers = [
{name = "Sameeul Bashir Samee", email = "sameeul.samee@axleinfo.com"},
]

classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

requires-python = ">=3.8"


[project.optional-dependencies]
dev = [
"ome_zarr",
"requests>=2.26.0"
]


[project.urls]
Documentation = "https://bfio.readthedocs.io/en/latest/"
Repository = "https://github.com/PolusAI/bfio"


[tool.setuptools.dynamic]
version = {attr = "bfio.__version__"}


[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = true


[tool.setuptools.packages.find]
where = ["src"]
namespaces = false


[tool.setuptools.package-data]
"*" = [
"VERSION"
]


[tool.bumpversion]
current_version = "2.3.3"
commit = true
tag = true
commit_args = "--no-verify"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+)(?P<build>\\d+))?"
serialize = [
"{major}.{minor}.{patch}-{release}{build}",
"{major}.{minor}.{patch}"
]

[tool.bumpversion.parts.release]
optional_value = "_"
first_value = "dev"
values = [
"dev",
"_"
]

[[tool.bumpversion.files]]
filename = "src/bfio/VERSION"
search = "{current_version}"
replace = "{new_version}"

[[tool.bumpversion.files]]
filename = "requirements/requirements-base.txt"
search = "bfio[all]=={current_version}"
replace = "bfio[all]=={new_version}"

[[tool.bumpversion.files]]
filename = "README.md"
search = "{current_version}"
replace = "{new_version}"


[tool.codespell]
skip = "*.svg,*.html"
ignore-words-list = "utput"
50 changes: 0 additions & 50 deletions setup.py

This file was deleted.

File renamed without changes.
29 changes: 29 additions & 0 deletions src/bfio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

import logging
import pathlib

JAR_VERSION = None

logging.basicConfig(
format="%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
)
logger = logging.getLogger("bfio.init")

log_level = logging.WARNING

try:
with open(pathlib.Path(__file__).parent.joinpath("VERSION"), "r") as fh:
__version__ = fh.read()
except FileNotFoundError:
logger.info(
"Could not find VERSION. "
+ "This is likely due to using a local/cloned version of bfio."
)
__version__ = "0.0.0"
logger.info("VERSION = {}".format(__version__))


from .bfio import BioReader, BioWriter, start # NOQA: F401, E402
6 changes: 3 additions & 3 deletions bfio/backends.py → src/bfio/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,9 @@ def _init_writer(self):

self._tags = []

self.frontend._metadata.images[
0
].id = f"Image:{Path(self.frontend._file_path).name}"
self.frontend._metadata.images[0].id = (
f"Image:{Path(self.frontend._file_path).name}"
)

if self.frontend.X * self.frontend.Y * self.frontend.bpp > 2**31:
big_tiff = True
Expand Down
File renamed without changes.
17 changes: 6 additions & 11 deletions bfio/bfio.py → src/bfio/bfio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
import typing
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from platform import processor, system

import numpy
import ome_types
import tifffile
import jpype
import scyjava

from bfio import backends
from bfio.base_classes import BioBase

import jpype
import scyjava

try:

def start() -> str:
Expand All @@ -30,10 +28,7 @@ def start() -> str:
"""

global JAR_VERSION
if system() == "Darwin" and processor() == "arm":
scyjava.config.endpoints.append("ome:formats-gpl:7.0.0")
else:
scyjava.config.endpoints.append("ome:formats-gpl:7.0.1")
scyjava.config.endpoints.append("ome:formats-gpl:7.1.0")
scyjava.start_jvm()
loci = jpype.JPackage("loci")
loci.common.DebugTools.setRootLevel("ERROR")
Expand Down Expand Up @@ -1009,9 +1004,9 @@ class if specified. *Defaults to None.*
self._metadata = metadata.model_copy(deep=True)

self._metadata.images[0].name = self._file_path.name
self._metadata.images[
0
].pixels.dimension_order = ome_types.model.Pixels_DimensionOrder.XYZCT
self._metadata.images[0].pixels.dimension_order = (
ome_types.model.Pixels_DimensionOrder.XYZCT
)
else:
self._metadata = self._minimal_xml()

Expand Down
4 changes: 3 additions & 1 deletion tests/test_read.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
import requests, io, pathlib, shutil, logging, sys
import requests, pathlib, shutil, logging, sys
import bfio
import numpy as np
import random
Expand Down Expand Up @@ -43,6 +43,8 @@ def setUpModule():
with open(TEST_DIR.joinpath(file), "wb") as fw:
fw.write(r.content)
else:
if TEST_DIR.joinpath(file).exists():
shutil.rmtree(TEST_DIR.joinpath(file))
zarr_download(url, str(TEST_DIR))

"""Load the czi image, and save as a npy file for further testing."""
Expand Down
Loading

0 comments on commit 8b8f2e0

Please sign in to comment.