fix: vector as label

This commit is contained in:
2024-05-14 10:57:43 +08:00
parent c1886f95f8
commit 05a61527e7
2 changed files with 8 additions and 2 deletions

View File

@@ -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)

View File

@@ -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():