Skip to content

Commit e929013

Browse files
authored
Merge pull request #13 from OmooLab/feature/dev
Feature/dev
2 parents 2c80c9e + d380cf7 commit e929013

19 files changed

+101
-33
lines changed

bioxelnodes/io.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def rgb2gray(image):
139139

140140
return sitk.Cast(I, sitk.sitkFloat32)
141141

142+
def x2gray(image):
143+
return sitk.VectorIndexSelectionCast(image, 0, sitk.sitkUInt16)
142144

143145
class ImportVolumeDataDialog(bpy.types.Operator):
144146
bl_idname = "bioxelnodes.import_volume_data_dialog"
@@ -225,7 +227,11 @@ def execute(self, context):
225227
bioxel_size, image_shape, orig_spacing)
226228

227229
if self.read_as == "labels":
228-
image = sitk.Cast(image, sitk.sitkUInt16)
230+
if "vector" in image.GetPixelIDTypeAsString():
231+
print("Convet to Grayscale...")
232+
image = x2gray(image)
233+
else:
234+
image = sitk.Cast(image, sitk.sitkUInt16)
229235
default_value = 0
230236
elif self.read_as == "scalar":
231237
if "vector" in image.GetPixelIDTypeAsString():

docs/assets/as-labels.png

6.27 KB
Loading

docs/assets/as-scalar.png

9.14 KB
Loading
File renamed without changes.

docs/assets/before-sharing.png

49.8 KB
Loading

docs/assets/dependency.png

-30.5 KB
Loading
File renamed without changes.

docs/assets/import-dialog.png

43.5 KB
Loading

docs/assets/import-others.png

8.56 KB
Loading

0 commit comments

Comments
 (0)