From 05a61527e76e30205a2204851c52175e33240080 Mon Sep 17 00:00:00 2001 From: Ma Nan Date: Tue, 14 May 2024 10:57:43 +0800 Subject: [PATCH] fix: vector as label --- README.md | 2 +- bioxelnodes/io.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c01e8c..68481a1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Before us, there have been many tutorials and add-ons for importing volumetric d Below are some examples with Bioxel Nodes. Thanks to Cycles Render, the volumetric data can be rendered with great detail: -![gallery](assets/gallery.png) +![gallery](docs/assets/gallery.png) The "Bioxel" in "BioxelNodes", is a combination of the words "Bio-" and "Voxel". Bioxel is a voxel that stores biological data. The volumetric data made up of Bioxel is called Bioxels. We are developing a toolkit around Bioxels for better biological data visualization. but before its release, we made this Blender version of bioxels toolkit first, in order to let more people to have fun with volumetric data. [Getting Started](https://omoolab.github.io/BioxelNodes/latest/getting-started) diff --git a/bioxelnodes/io.py b/bioxelnodes/io.py index 3285caa..4a3fea0 100644 --- a/bioxelnodes/io.py +++ b/bioxelnodes/io.py @@ -139,6 +139,8 @@ def rgb2gray(image): return sitk.Cast(I, sitk.sitkFloat32) +def x2gray(image): + return sitk.VectorIndexSelectionCast(image, 0, sitk.sitkUInt16) class ImportVolumeDataDialog(bpy.types.Operator): bl_idname = "bioxelnodes.import_volume_data_dialog" @@ -225,7 +227,11 @@ class ImportVolumeDataDialog(bpy.types.Operator): bioxel_size, image_shape, orig_spacing) if self.read_as == "labels": - image = sitk.Cast(image, sitk.sitkUInt16) + if "vector" in image.GetPixelIDTypeAsString(): + print("Convet to Grayscale...") + image = x2gray(image) + else: + image = sitk.Cast(image, sitk.sitkUInt16) default_value = 0 elif self.read_as == "scalar": if "vector" in image.GetPixelIDTypeAsString():