From e7eed0bdde9204df8d990dd25496c4030f750767 Mon Sep 17 00:00:00 2001 From: oanegros Date: Mon, 8 Sep 2025 11:41:13 +0200 Subject: [PATCH 1/3] pyyaml --- build.py | 10 +++++----- microscopynodes/blender_manifest.toml | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index ed90115..7991683 100644 --- a/build.py +++ b/build.py @@ -26,8 +26,8 @@ class Platform: windows_x64 = Platform(pypi_suffix="win_amd64", metadata="windows-x64") linux_x64 = Platform(pypi_suffix="manylinux2014_x86_64", metadata="linux-x64") -macos_arm = Platform(pypi_suffix="macosx_12_0_arm64", metadata="macos-x64") -# macos_intel = Platform(pypi_suffix="macosx_10_16_x86_64", metadata="macos-x64") +macos_arm = Platform(pypi_suffix="macosx_12_0_arm64", metadata="macos-arm64") +macos_intel = Platform(pypi_suffix="macosx_10_16_x86_64", metadata="macos-x64") required_packages = [ @@ -42,8 +42,8 @@ class Platform: "zarr==3.0.8", "fsspec==2025.5.1", 'cmap==0.6.0', - 's3fs==2025.5.1' - + 's3fs==2025.5.1', + 'pyyaml==6.0.2', # needed for preference yaml loading and writing # development # "ipycytoscape" # for visualizing dask trees ] @@ -57,7 +57,7 @@ class Platform: windows_x64, linux_x64, macos_arm, - # macos_intel, + macos_intel, ] diff --git a/microscopynodes/blender_manifest.toml b/microscopynodes/blender_manifest.toml index 166f85e..5211be5 100644 --- a/microscopynodes/blender_manifest.toml +++ b/microscopynodes/blender_manifest.toml @@ -1,7 +1,7 @@ schema_version = "1.0.0" id = "microscopynodes" -version = "2.2.2" +version = "2.2.3" name = "Microscopy Nodes" tagline = "Handling microscopy data in Blender, up to 5D volumes" maintainer = "Aafke Gros " @@ -13,6 +13,7 @@ website = "https://aafkegros.github.io/MicroscopyNodes/" platforms = [ "windows-x64", "linux-x64", + "macos-arm64", "macos-x64", ] tags = [ @@ -29,31 +30,36 @@ copyright =[ # Optional: bundle 3rd party Python modules. # https://docs.blender.org/manual/en/dev/advanced/extensions/python_wheels.html wheels = [ + "./wheels/PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/PyYAML-6.0.2-cp311-cp311-win_amd64.whl", - "./wheels/aiobotocore-2.24.1-py3-none-any.whl", + "./wheels/aiobotocore-2.24.2-py3-none-any.whl", "./wheels/aiohappyeyeballs-2.6.1-py3-none-any.whl", + "./wheels/aiohttp-3.12.15-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/aiohttp-3.12.15-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/aiohttp-3.12.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/aiohttp-3.12.15-cp311-cp311-win_amd64.whl", "./wheels/aioitertools-0.12.0-py3-none-any.whl", "./wheels/aiosignal-1.4.0-py3-none-any.whl", "./wheels/attrs-25.3.0-py3-none-any.whl", - "./wheels/botocore-1.39.11-py3-none-any.whl", + "./wheels/botocore-1.40.18-py3-none-any.whl", "./wheels/click-8.2.1-py3-none-any.whl", "./wheels/cloudpickle-3.1.1-py3-none-any.whl", "./wheels/cmap-0.6.0-py3-none-any.whl", + "./wheels/crc32c-2.7.1-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/crc32c-2.7.1-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/crc32c-2.7.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/crc32c-2.7.1-cp311-cp311-win_amd64.whl", "./wheels/dask-2025.5.1-py3-none-any.whl", "./wheels/donfig-0.8.1.post1-py3-none-any.whl", + "./wheels/frozenlist-1.7.0-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/frozenlist-1.7.0-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/frozenlist-1.7.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/frozenlist-1.7.0-cp311-cp311-win_amd64.whl", "./wheels/fsspec-2025.5.1-py3-none-any.whl", "./wheels/idna-3.10-py3-none-any.whl", + "./wheels/imagecodecs-2025.3.30-cp311-cp311-macosx_10_14_x86_64.whl", "./wheels/imagecodecs-2025.3.30-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/imagecodecs-2025.3.30-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/imagecodecs-2025.3.30-cp311-cp311-win_amd64.whl", @@ -62,37 +68,45 @@ wheels = [ "./wheels/jmespath-1.0.1-py3-none-any.whl", "./wheels/lazy_loader-0.4-py3-none-any.whl", "./wheels/locket-1.0.0-py2.py3-none-any.whl", + "./wheels/multidict-6.6.4-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/multidict-6.6.4-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/multidict-6.6.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", "./wheels/multidict-6.6.4-cp311-cp311-win_amd64.whl", "./wheels/networkx-3.5-py3-none-any.whl", + "./wheels/numcodecs-0.16.2-cp311-cp311-macosx_10_13_x86_64.whl", "./wheels/numcodecs-0.16.2-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/numcodecs-0.16.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/numcodecs-0.16.2-cp311-cp311-win_amd64.whl", "./wheels/packaging-25.0-py3-none-any.whl", "./wheels/partd-1.4.2-py3-none-any.whl", + "./wheels/pillow-11.3.0-cp311-cp311-macosx_10_10_x86_64.whl", "./wheels/pillow-11.3.0-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/pillow-11.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", "./wheels/pillow-11.3.0-cp311-cp311-win_amd64.whl", + "./wheels/propcache-0.3.2-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/propcache-0.3.2-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/propcache-0.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/propcache-0.3.2-cp311-cp311-win_amd64.whl", "./wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", "./wheels/s3fs-2025.5.1-py3-none-any.whl", + "./wheels/scikit_image-0.25.2-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/scikit_image-0.25.2-cp311-cp311-macosx_12_0_arm64.whl", "./wheels/scikit_image-0.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/scikit_image-0.25.2-cp311-cp311-win_amd64.whl", + "./wheels/scipy-1.15.2-cp311-cp311-macosx_10_13_x86_64.whl", "./wheels/scipy-1.15.2-cp311-cp311-macosx_12_0_arm64.whl", "./wheels/scipy-1.15.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/scipy-1.15.2-cp311-cp311-win_amd64.whl", "./wheels/six-1.17.0-py2.py3-none-any.whl", "./wheels/tifffile-2025.6.11-py3-none-any.whl", "./wheels/toolz-1.0.0-py3-none-any.whl", - "./wheels/typing_extensions-4.14.1-py3-none-any.whl", + "./wheels/typing_extensions-4.15.0-py3-none-any.whl", "./wheels/urllib3-2.5.0-py3-none-any.whl", + "./wheels/wrapt-1.17.3-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/wrapt-1.17.3-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/wrapt-1.17.3-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", "./wheels/wrapt-1.17.3-cp311-cp311-win_amd64.whl", + "./wheels/yarl-1.20.1-cp311-cp311-macosx_10_9_x86_64.whl", "./wheels/yarl-1.20.1-cp311-cp311-macosx_11_0_arm64.whl", "./wheels/yarl-1.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", "./wheels/yarl-1.20.1-cp311-cp311-win_amd64.whl", From e989be9b5283060f085b84f2661668ccea6cf7e1 Mon Sep 17 00:00:00 2001 From: oanegros Date: Mon, 8 Sep 2025 11:43:52 +0200 Subject: [PATCH 2/3] fixes non-imagej tif does part of #144 also makes handling of non-set pixel units more explicit --- microscopynodes/file_to_array/__init__.py | 7 ++++++- microscopynodes/file_to_array/arrayloading.py | 4 ++-- microscopynodes/file_to_array/tif.py | 7 +++++-- microscopynodes/parse_inputs.py | 8 +++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/microscopynodes/file_to_array/__init__.py b/microscopynodes/file_to_array/__init__.py index e5521ea..a1f283e 100644 --- a/microscopynodes/file_to_array/__init__.py +++ b/microscopynodes/file_to_array/__init__.py @@ -27,7 +27,12 @@ def change_path(self, context): log("") context.scene.property_unset("MiN_reload") if get_loader() is not None: - get_loader().change_path(context) + try: + get_loader().change_path(context) + except Exception as e: + print(e) + log(f"Error loading file: {e}") + return bpy.context.scene.MiN_enable_ui = True return diff --git a/microscopynodes/file_to_array/arrayloading.py b/microscopynodes/file_to_array/arrayloading.py index 03fb323..b36fedc 100644 --- a/microscopynodes/file_to_array/arrayloading.py +++ b/microscopynodes/file_to_array/arrayloading.py @@ -55,8 +55,8 @@ def _set_unit(self, unit_str): try: bpy.context.scene.MiN_unit = parse_unit(unit_str) except Exception as e: - print(f'did not parse unit ({unit_str})', e) - bpy.context.scene.property_unset("MiN_unit") + # print(f'did not parse unit ({unit_str})', e) + bpy.context.scene.MiN_unit = "AU" def _set_axes_order(self, axes_order): try: diff --git a/microscopynodes/file_to_array/tif.py b/microscopynodes/file_to_array/tif.py index e249a36..9d08ec0 100644 --- a/microscopynodes/file_to_array/tif.py +++ b/microscopynodes/file_to_array/tif.py @@ -8,8 +8,11 @@ class TifLoader(ArrayLoader): def set_file_globals(self, input_file): with tifffile.TiffFile(input_file) as ifstif: self._set_axes_order(ifstif.series[0].axes.lower().replace('s', 'c').replace('q','z')) - if 'unit' in dict(ifstif.imagej_metadata): - self._set_unit(dict(ifstif.imagej_metadata)['unit']) + try: # try for non imagej tif + if 'unit' in dict(ifstif.imagej_metadata): + self._set_unit(dict(ifstif.imagej_metadata)['unit']) + except TypeError as e: + self._set_unit(None) return def fill_array_options(self, input_file): diff --git a/microscopynodes/parse_inputs.py b/microscopynodes/parse_inputs.py index 837365a..bb967a3 100644 --- a/microscopynodes/parse_inputs.py +++ b/microscopynodes/parse_inputs.py @@ -69,16 +69,18 @@ def parse_unit(string): def parse_scale(size_px, pixel_size, objs): scale = None scale_factor = 1 - + world_scale = addon_preferences(bpy.context).import_scale + print(bpy.context.scene.MiN_unit, world_scale) + print('hey') isotropic = np.array([1,1,pixel_size[-1]/pixel_size[0]]) if world_scale == "DEFAULT" or bpy.context.scene.MiN_unit == 'AU': # cm / px scale = isotropic*0.01 - if world_scale == "MOLECULAR_NODES": # cm / nm + if world_scale == "MOLECULAR_NODES" and bpy.context.scene.MiN_unit != 'AU': # cm / nm physical_size = parse_unit(bpy.context.scene.MiN_unit) * pixel_size scale = physical_size / 1e-7 - if "_SCALE" in world_scale: + if "_SCALE" in world_scale and bpy.context.scene.MiN_unit != 'AU': # m / unit physical_size = parse_unit(bpy.context.scene.MiN_unit) * pixel_size scale = physical_size / parse_unit(world_scale.removesuffix("_SCALE")) From e54be8d9999c772fa2c4fbe56a76242f7967db75 Mon Sep 17 00:00:00 2001 From: oanegros Date: Mon, 8 Sep 2025 12:01:26 +0200 Subject: [PATCH 3/3] bump version nr --- microscopynodes/blender_manifest.toml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/microscopynodes/blender_manifest.toml b/microscopynodes/blender_manifest.toml index 5211be5..76e2d8c 100644 --- a/microscopynodes/blender_manifest.toml +++ b/microscopynodes/blender_manifest.toml @@ -1,7 +1,7 @@ schema_version = "1.0.0" id = "microscopynodes" -version = "2.2.3" +version = "2.2.4" name = "Microscopy Nodes" tagline = "Handling microscopy data in Blender, up to 5D volumes" maintainer = "Aafke Gros " diff --git a/pyproject.toml b/pyproject.toml index 3e9ab6f..0ba505e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "microscopynodes" -version = "2.2.1" +version = "2.2.4" description = "Loading and handling microscopy data in Blender." authors = ["Oane Gros "] include = [