Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol-G committed Jun 2, 2023
1 parent 611d27e commit af838b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 1 addition & 7 deletions mzarr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
__version__ = "0.0.5"

import numcodecs
from imagecodecs.numcodecs import JpegXl
from mzarr.mzarr import Mzarr

numcodecs.register_codec(JpegXl)
__version__ = "0.0.6"
8 changes: 7 additions & 1 deletion mzarr/mzarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
from imagecodecs.numcodecs import JpegXl
from typing import Optional, List, Union, Literal, Any
import os
import numcodecs


numcodecs.register_codec(JpegXl)

class Mzarr:
def __init__(self, store: Union[np.ndarray, str], mode: Literal['r', 'r+', 'a', 'w', 'w-'] = 'a') -> None:
"""
Expand All @@ -32,7 +35,10 @@ def __init__(self, store: Union[np.ndarray, str], mode: Literal['r', 'r+', 'a',
if isinstance(store, str):
self.load(store, mode)
else:
self.array = store
if store.dtype in [np.uint8, np.uint16, np.float16, np.float32]:
self.array = store
else:
raise RuntimeError("Currently only the dtypes 'uint8', 'uint16', 'float16', 'float32' are supported. Dtype {} is not supported".format(store.dtype))

def load(self, path: str, mode: Literal['r', 'r+', 'a', 'a'] = 'a') -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion mzarr/nifti2mzarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from natsort import natsorted
import SimpleITK as sitk
from mzarr.mzarr import Mzarr
from mzarr import Mzarr
import numpy as np
from typing import Union, Tuple

Expand Down
2 changes: 1 addition & 1 deletion mzarr/tiff2mzarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os.path import join
from natsort import natsorted
import tifffile
from mzarr.mzarr import Mzarr
from mzarr import Mzarr
import numpy as np


Expand Down

0 comments on commit af838b2

Please sign in to comment.