fix: color ramp not fit

fix: skip DICOM series option not reset.
fix: combine label only combine 2 layers
This commit is contained in:
2024-08-07 09:42:25 +08:00
parent 2429eef5e0
commit 38fb888f00
6 changed files with 27 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ import numpy as np
from . import scipy
from . import skimage as ski
from . import scipy as ndi
# 3rd-party
import transforms3d
@@ -102,31 +103,38 @@ class Layer():
raise Exception("Shape must be 3 dim")
data = self.data
order = 0 if self.dtype == bool else 1
# TXYZC > TXYZ
if self.kind in ['label', 'scalar']:
data = np.amax(data, -1)
if self.kind in ['scalar']:
dtype = data.dtype
data = data.astype(np.float32)
# if self.kind in ['scalar']:
# dtype = data.dtype
# data = data.astype(np.float32)
data_frames = ()
for f in range(self.frame_count):
if progress_callback:
progress_callback(f, self.frame_count)
frame = ski.resize(data[f, :, :, :],
shape,
preserve_range=True,
anti_aliasing=data.dtype.kind != "b")
# frame = ski.resize(data[f, :, :, :],
# shape,
# preserve_range=True,
# anti_aliasing=data.dtype.kind != "b")
factors = np.divide(self.shape, shape)
zoom_factors = [1 / f for f in factors]
frame = ndi.zoom(data[f, :, :, :],
zoom_factors,
order=order)
data_frames += (frame,)
data = np.stack(data_frames)
if self.kind in ['scalar']:
data = data.astype(dtype)
# if self.kind in ['scalar']:
# data = data.astype(dtype)
# TXYZ > TXYZC
if self.kind in ['label', 'scalar']:

View File

@@ -1,7 +1,7 @@
schema_version = "1.0.0"
id = "bioxelnodes"
version = "0.3.2"
version = "0.3.3"
name = "Bioxel Nodes"
tagline = "For scientific volumetric data visualization in Blender"
maintainer = "Ma Nan <icrdr2010@outlook.com>"

View File

@@ -134,10 +134,12 @@ class ParseVolumetricData(bpy.types.Operator):
filepath: bpy.props.StringProperty(subtype="FILE_PATH") # type: ignore
skip_read_as: bpy.props.BoolProperty(name="Skip Read As",
default=False) # type: ignore
default=False,
options={"SKIP_SAVE"}) # type: ignore
skip_series_select: bpy.props.BoolProperty(name="Skip Sries Select",
default=True) # type: ignore
default=True,
options={"SKIP_SAVE"}) # type: ignore
read_as: bpy.props.EnumProperty(name="Read as",
default="scalar",

View File

@@ -232,7 +232,6 @@ class CombineLabels(bpy.types.Operator, LabelOperator):
return {'FINISHED'}
base_obj = label_objs[0]
label_objs = label_objs[1:]
container_obj = base_obj.parent
base_layer = obj_to_layer(base_obj)
modified_layer = base_layer.copy()
@@ -241,7 +240,7 @@ class CombineLabels(bpy.types.Operator, LabelOperator):
for label_obj in label_objs:
label_layer = obj_to_layer(label_obj)
label_layer.resize(base_layer.shape)
modified_layer.data = np.maximum(base_layer.data, label_layer.data)
modified_layer.data = np.maximum(modified_layer.data, label_layer.data)
label_names.append(label_layer.name)
modified_layer.name = f"{'-'.join(label_names)}-Combined"

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "bioxelnodes"
version = "0.3.2"
version = "0.3.3"
description = ""
authors = ["Ma Nan <icrdr2010@outlook.com>"]
license = "MIT"