Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
088d9c1edb | ||
| a6ec769a9b |
@@ -77,14 +77,18 @@ class Layer():
|
|||||||
raise Exception("Mask frame count is not same as ")
|
raise Exception("Mask frame count is not same as ")
|
||||||
for f in range(self.frame_count):
|
for f in range(self.frame_count):
|
||||||
mask_frame = mask[f, :, :, :]
|
mask_frame = mask[f, :, :, :]
|
||||||
mask_frame = scipy.median_filter(
|
mask_frame = scipy.minimum_filter(
|
||||||
mask_frame.astype(np.float32), size=2)
|
mask_frame.astype(np.float32), size=3)
|
||||||
|
# mask_frame = scipy.median_filter(
|
||||||
|
# mask_frame.astype(np.float32), size=2)
|
||||||
mask_frames += (mask_frame,)
|
mask_frames += (mask_frame,)
|
||||||
elif mask.ndim == 3:
|
elif mask.ndim == 3:
|
||||||
for f in range(self.frame_count):
|
for f in range(self.frame_count):
|
||||||
mask_frame = mask[:, :, :]
|
mask_frame = mask[:, :, :]
|
||||||
mask_frame = scipy.median_filter(
|
mask_frame = scipy.minimum_filter(
|
||||||
mask_frame.astype(np.float32), size=2)
|
mask_frame.astype(np.float32), size=3)
|
||||||
|
# mask_frame = scipy.median_filter(
|
||||||
|
# mask_frame.astype(np.float32), size=2)
|
||||||
mask_frames += (mask_frame,)
|
mask_frames += (mask_frame,)
|
||||||
else:
|
else:
|
||||||
raise Exception("Mask shape order should be TXYZ or XYZ")
|
raise Exception("Mask shape order should be TXYZ or XYZ")
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
from ._interpolation import zoom
|
from ._interpolation import zoom
|
||||||
from ._filters import gaussian_filter, median_filter
|
from ._filters import (gaussian_filter,
|
||||||
|
median_filter,
|
||||||
|
maximum_filter,
|
||||||
|
minimum_filter)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
schema_version = "1.0.0"
|
schema_version = "1.0.0"
|
||||||
|
|
||||||
id = "bioxelnodes"
|
id = "bioxelnodes"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
name = "Bioxel Nodes"
|
name = "Bioxel Nodes"
|
||||||
tagline = "For scientific volumetric data visualization in Blender"
|
tagline = "For scientific volumetric data visualization in Blender"
|
||||||
maintainer = "Ma Nan <icrdr2010@outlook.com>"
|
maintainer = "Ma Nan <icrdr2010@outlook.com>"
|
||||||
@@ -20,7 +20,7 @@ wheels = [
|
|||||||
"./wheels/SimpleITK-2.3.1-cp311-cp311-macosx_11_0_arm64.whl",
|
"./wheels/SimpleITK-2.3.1-cp311-cp311-macosx_11_0_arm64.whl",
|
||||||
"./wheels/SimpleITK-2.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
|
"./wheels/SimpleITK-2.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
|
||||||
"./wheels/lxml-5.2.2-cp311-cp311-win_amd64.whl",
|
"./wheels/lxml-5.2.2-cp311-cp311-win_amd64.whl",
|
||||||
"./wheels/lxml-5.2.2-cp311-cp311-macosx_10_9_universal2.whl",
|
"./wheels/lxml-5.2.2-cp311-cp311-macosx_10_9_arm64.whl",
|
||||||
"./wheels/lxml-5.2.2-cp311-cp311-macosx_10_9_x86_64.whl",
|
"./wheels/lxml-5.2.2-cp311-cp311-macosx_10_9_x86_64.whl",
|
||||||
"./wheels/lxml-5.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
|
"./wheels/lxml-5.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
|
||||||
"./wheels/h5py-3.11.0-cp311-cp311-win_amd64.whl",
|
"./wheels/h5py-3.11.0-cp311-cp311-win_amd64.whl",
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
import bmesh
|
import bmesh
|
||||||
|
|
||||||
from ..nodes import custom_nodes
|
from ..nodes import custom_nodes
|
||||||
from ..bioxel.io import load_container, save_container
|
from ..bioxel.io import load_container, save_container
|
||||||
|
from ..bioxelutils.layer import get_all_layer_objs
|
||||||
from ..bioxelutils.container import (container_to_obj, obj_to_container,
|
from ..bioxelutils.container import (container_to_obj, obj_to_container,
|
||||||
get_container_objs_from_selection)
|
get_container_objs_from_selection)
|
||||||
from ..bioxelutils.node import get_nodes_by_type, move_node_between_nodes, move_node_to_node
|
from ..bioxelutils.node import get_nodes_by_type, move_node_between_nodes, move_node_to_node
|
||||||
from .utils import get_cache_dir, select_object
|
from .utils import change_render_setting, get_cache_dir, get_preferences, select_object
|
||||||
|
|
||||||
|
|
||||||
class SaveContainer(bpy.types.Operator):
|
class SaveContainer(bpy.types.Operator):
|
||||||
@@ -59,11 +61,16 @@ class LoadContainer(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
load_path = self.filepath
|
load_path = self.filepath
|
||||||
container = load_container(self.filepath)
|
container = load_container(self.filepath)
|
||||||
|
is_first_import = len(get_all_layer_objs()) == 0
|
||||||
|
|
||||||
container_obj = container_to_obj(container,
|
container_obj = container_to_obj(container,
|
||||||
scene_scale=0.01,
|
scene_scale=0.01,
|
||||||
cache_dir=get_cache_dir(context))
|
cache_dir=get_cache_dir(context))
|
||||||
select_object(container_obj)
|
select_object(container_obj)
|
||||||
|
|
||||||
|
if is_first_import:
|
||||||
|
change_render_setting(context)
|
||||||
|
|
||||||
self.report({"INFO"}, f"Successfully load {load_path}")
|
self.report({"INFO"}, f"Successfully load {load_path}")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from ..bioxelutils.container import (Container,
|
|||||||
get_container_objs_from_selection)
|
get_container_objs_from_selection)
|
||||||
from ..bioxel.parse import (DICOM_EXTS, SUPPORT_EXTS,
|
from ..bioxel.parse import (DICOM_EXTS, SUPPORT_EXTS,
|
||||||
get_ext, parse_volumetric_data)
|
get_ext, parse_volumetric_data)
|
||||||
from .utils import (get_cache_dir, get_preferences,
|
from .utils import (change_render_setting, get_cache_dir, get_preferences,
|
||||||
progress_update, progress_bar, select_object)
|
progress_update, progress_bar, select_object)
|
||||||
|
|
||||||
# 3rd-party
|
# 3rd-party
|
||||||
@@ -674,26 +674,8 @@ class ImportVolumetricDataDialog(bpy.types.Operator):
|
|||||||
select_object(container_obj)
|
select_object(container_obj)
|
||||||
|
|
||||||
# Change render setting for better result
|
# Change render setting for better result
|
||||||
preferences = get_preferences(context)
|
if is_first_import:
|
||||||
if preferences.do_change_render_setting and is_first_import:
|
change_render_setting(context)
|
||||||
bpy.context.scene.render.engine = 'CYCLES'
|
|
||||||
try:
|
|
||||||
bpy.context.scene.cycles.shading_system = True
|
|
||||||
bpy.context.scene.cycles.volume_bounces = 12
|
|
||||||
bpy.context.scene.cycles.transparent_max_bounces = 16
|
|
||||||
bpy.context.scene.cycles.volume_preview_step_rate = 10
|
|
||||||
bpy.context.scene.cycles.volume_step_rate = 10
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
bpy.context.scene.eevee.use_taa_reprojection = False
|
|
||||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
|
||||||
bpy.context.scene.eevee.volumetric_shadow_samples = 128
|
|
||||||
bpy.context.scene.eevee.volumetric_samples = 256
|
|
||||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
self.report({"INFO"}, "Successfully Imported")
|
self.report({"INFO"}, "Successfully Imported")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|||||||
@@ -3,6 +3,29 @@ from pathlib import Path
|
|||||||
from .. import __package__ as base_package
|
from .. import __package__ as base_package
|
||||||
|
|
||||||
|
|
||||||
|
def change_render_setting(context):
|
||||||
|
preferences = get_preferences(context)
|
||||||
|
if preferences.do_change_render_setting:
|
||||||
|
bpy.context.scene.render.engine = 'CYCLES'
|
||||||
|
try:
|
||||||
|
bpy.context.scene.cycles.shading_system = True
|
||||||
|
bpy.context.scene.cycles.volume_bounces = 12
|
||||||
|
bpy.context.scene.cycles.transparent_max_bounces = 16
|
||||||
|
bpy.context.scene.cycles.volume_preview_step_rate = 10
|
||||||
|
bpy.context.scene.cycles.volume_step_rate = 10
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
bpy.context.scene.eevee.use_taa_reprojection = False
|
||||||
|
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||||
|
bpy.context.scene.eevee.volumetric_shadow_samples = 128
|
||||||
|
bpy.context.scene.eevee.volumetric_samples = 256
|
||||||
|
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def select_object(target_obj):
|
def select_object(target_obj):
|
||||||
for obj in bpy.data.objects:
|
for obj in bpy.data.objects:
|
||||||
obj.select_set(False)
|
obj.select_set(False)
|
||||||
|
|||||||
23
build.py
23
build.py
@@ -53,6 +53,11 @@ def build_extension(platform: Platform, python_version="3.11") -> None:
|
|||||||
if any([package in f.name for package in packages_to_remove]):
|
if any([package in f.name for package in packages_to_remove]):
|
||||||
f.unlink(missing_ok=True)
|
f.unlink(missing_ok=True)
|
||||||
|
|
||||||
|
elif platform.blender_tag == "macos-arm64" and \
|
||||||
|
"lxml" in f.name and "universal2" in f.name:
|
||||||
|
f.rename(Path(f.parent,
|
||||||
|
f.name.replace("universal2", "arm64")))
|
||||||
|
|
||||||
for ndimage_filepath in scipy_ndimage_dirpath.iterdir():
|
for ndimage_filepath in scipy_ndimage_dirpath.iterdir():
|
||||||
to_filepath = Path("./bioxelnodes/bioxel/scipy", ndimage_filepath.name)
|
to_filepath = Path("./bioxelnodes/bioxel/scipy", ndimage_filepath.name)
|
||||||
shutil.copy(ndimage_filepath, to_filepath)
|
shutil.copy(ndimage_filepath, to_filepath)
|
||||||
@@ -61,14 +66,18 @@ def build_extension(platform: Platform, python_version="3.11") -> None:
|
|||||||
with toml_filepath.open("r") as file:
|
with toml_filepath.open("r") as file:
|
||||||
manifest = tomlkit.parse(file.read())
|
manifest = tomlkit.parse(file.read())
|
||||||
|
|
||||||
build = tomlkit.table(True)
|
manifest["platforms"] = [platform.blender_tag]
|
||||||
generated = tomlkit.table()
|
manifest["wheels"] = [f"./wheels/{f.name}"
|
||||||
generated["platforms"] = [platform.blender_tag]
|
for f in wheel_dirpath.glob('*.whl')]
|
||||||
generated["wheels"] = [f"./wheels/{f.name}"
|
|
||||||
for f in wheel_dirpath.glob('*.whl')]
|
|
||||||
|
|
||||||
build.append('generated', generated)
|
# build = tomlkit.table(True)
|
||||||
manifest.append('build', build)
|
# generated = tomlkit.table()
|
||||||
|
# generated["platforms"] = [platform.blender_tag]
|
||||||
|
# generated["wheels"] = [f"./wheels/{f.name}"
|
||||||
|
# for f in wheel_dirpath.glob('*.whl')]
|
||||||
|
|
||||||
|
# build.append('generated', generated)
|
||||||
|
# manifest.append('build', build)
|
||||||
|
|
||||||
# Write the updated TOML file
|
# Write the updated TOML file
|
||||||
with toml_filepath.open("w") as file:
|
with toml_filepath.open("w") as file:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "bioxelnodes"
|
name = "bioxelnodes"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Ma Nan <icrdr2010@outlook.com>"]
|
authors = ["Ma Nan <icrdr2010@outlook.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
Reference in New Issue
Block a user