diff --git a/README.md b/README.md index 7a49539..276600e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[中文文档](https://uj6xfhbzp0.feishu.cn/wiki/Qx3VwHuNPimeI8kr6nDcvl1DnHf?from=from_copylink) +[中文文档](https://uj6xfhbzp0.feishu.cn/wiki/LPKEwjooSivxjskWHlCcQznjnNf?from=from_copylink) # Bioxel Nodes @@ -26,18 +26,18 @@ Welcome to our [discord server](https://discord.gg/pYkNyq2TjE), if you have any ## Support Multiple Formats -| Format | EXT | Test | -| ------ | ---------------------------------------- | ------- | -| DICOM | .dcm, .DCM, .DICOM, .ima, .IMA | ✅ pass | -| BMP | .bmp, .BMP | ✅ pass | -| JPEG | .jpg, .JPG, .jpeg, .JPEG | ✅ pass | -| PNG | .png, .PNG | ✅ pass | -| TIFF | .tif, .TIF, .tiff, .TIFF | ✅ pass | -| Nifti | .nia, .nii, .nii.gz, .hdr, .img, .img.gz | ✅ pass | -| Nrrd | .nrrd, .nhdr | ✅ pass | -| HDF5 | .hdf, .h4, .hdf4, .he2, .h5, .hdf5, .he5 | ✅ pass | -| OME | .ome.tiff, .ome.tif | ✅ pass | -| MRC | .mrc, .mrc.gz, .map, .map.gz | ✅ pass | +| Format | EXT | +| ------ | ---------------------------------------- | +| DICOM | .dcm, .DCM, .DICOM, .ima, .IMA | +| BMP | .bmp, .BMP | +| JPEG | .jpg, .JPG, .jpeg, .JPEG | +| PNG | .png, .PNG | +| TIFF | .tif, .TIF, .tiff, .TIFF | +| Nifti | .nia, .nii, .nii.gz, .hdr, .img, .img.gz | +| Nrrd | .nrrd, .nhdr | +| HDF5 | .hdf, .h4, .hdf4, .he2, .h5, .hdf5, .he5 | +| OME | .ome.tiff, .ome.tif | +| MRC | .mrc, .mrc.gz, .map, .map.gz | ## Support 4D volumetric data @@ -59,16 +59,6 @@ Welcome to our [discord server](https://discord.gg/pYkNyq2TjE), if you have any - Only works with Cycles CPU , Cycles GPU (OptiX), EEVEE - Section surface cannot be generated when convert to mesh (will be supported soon) -## Compatible to Newer Version - -**v0.3.x is not compatible to v0.2.x, Updating this addon may break old files. Read the following carefully before upgradation** - -Before upgradation, you need to ask yourself whether this project file will be modified again or not, if it's an archived project file, I would recommend that you run **Bioxel Nodes > Save Staged Data** to make the addon nodes permanent. In this way, there will be no potential problem with the nodes not functioning due to the addon update. - -After the addon update, your old project files may not work either, this may be because you had executed **Save Staged Data**. If so, you need to execute **Bioxel Nodes > Relink Nodes to Addon** to relink them to make sure that the addon's new functionality and the addon nodes are synchronized. - -Also, the older shaders are not based on OSL, so if you find that you can't render volumes, you need to turn on **Open Shading Language (OSL)** in the Render Settings. - ## Roadmap - Better multi-format import experience diff --git a/bioxelnodes/assets/Nodes/BioxelNodes_v0.1.x.blend b/bioxelnodes/assets/Nodes/BioxelNodes_v0.1.x.blend deleted file mode 100644 index 70cc114..0000000 --- a/bioxelnodes/assets/Nodes/BioxelNodes_v0.1.x.blend +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d6832d20cb556ff904cfd7c5574b048ea54011cb531fe6423c4689186de2c8aa -size 1749214 diff --git a/bioxelnodes/assets/Nodes/BioxelNodes_v0.2.x.blend b/bioxelnodes/assets/Nodes/BioxelNodes_v0.2.9.blend similarity index 100% rename from bioxelnodes/assets/Nodes/BioxelNodes_v0.2.x.blend rename to bioxelnodes/assets/Nodes/BioxelNodes_v0.2.9.blend diff --git a/bioxelnodes/assets/Nodes/BioxelNodes_v0.3.x.blend b/bioxelnodes/assets/Nodes/BioxelNodes_v0.3.3.blend similarity index 100% rename from bioxelnodes/assets/Nodes/BioxelNodes_v0.3.x.blend rename to bioxelnodes/assets/Nodes/BioxelNodes_v0.3.3.blend diff --git a/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.0.blend b/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.0.blend new file mode 100644 index 0000000..bd08aa5 --- /dev/null +++ b/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.0.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13ae301e135b547c9a348e2e7a0f2fbac42947e70c58a3a8b90875a23c5b0a4f +size 8976894 diff --git a/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.x.blend b/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.x.blend deleted file mode 100644 index ef7bc8b..0000000 --- a/bioxelnodes/assets/Nodes/BioxelNodes_v1.0.x.blend +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cda3a7c9f63386b6c7e48e5447a03366b51a3e2b446b53955cc42b7b98e5c504 -size 9005254 diff --git a/bioxelnodes/bioxelutils/common.py b/bioxelnodes/bioxelutils/common.py index e2d2a4e..b7e0011 100644 --- a/bioxelnodes/bioxelutils/common.py +++ b/bioxelnodes/bioxelutils/common.py @@ -2,7 +2,7 @@ from pathlib import Path import bpy -from ..constants import NODE_LIB_FILEPATH, VERSION +from ..constants import NODE_LIB_DIRPATH, VERSIONS from ..utils import get_cache_dir @@ -215,31 +215,46 @@ def get_file_prop(prop): return props.get(prop) +def get_node_version(): + node_version = get_file_prop("node_version") + return literal_eval(node_version) if node_version else None + + def is_incompatible(): - if get_file_prop("addon_version") is None: + node_version = get_node_version() + if node_version is None: for node_group in bpy.data.node_groups: if node_group.name.startswith("BioxelNodes"): return True else: - addon_version = literal_eval(get_file_prop("addon_version")) - if addon_version[0] != VERSION[0]\ - or addon_version[1] != VERSION[1]: + addon_version = VERSIONS[0]["node_version"] + if node_version[0] != addon_version[0]\ + or node_version[1] != addon_version[1]: return True return False + +def get_node_lib_path(node_version): + version_str = "v"+".".join([str(i) for i in list(node_version)]) + lib_filename = f"BioxelNodes_{version_str}.blend" + return Path(NODE_LIB_DIRPATH, + lib_filename).resolve() + + def local_lib_not_updated(): + addon_version = VERSIONS[0]["node_version"] + addon_lib_path = get_node_lib_path(addon_version) + use_local = False for node_group in bpy.data.node_groups: if node_group.name.startswith("BioxelNodes"): - node_group_lib = node_group.library - if node_group_lib: - abs_filepath = bpy.path.abspath(node_group_lib.filepath) - _local_lib_file = Path(abs_filepath).resolve().as_posix() - if _local_lib_file != NODE_LIB_FILEPATH.as_posix(): + lib = node_group.library + if lib: + lib_path = Path(bpy.path.abspath(lib.filepath)).resolve() + if lib_path != addon_lib_path: use_local = True break - - addon_version = literal_eval(get_file_prop("addon_version")) - not_update = addon_version != VERSION - return use_local and not_update \ No newline at end of file + + not_update = get_node_version() != addon_version + return use_local and not_update diff --git a/bioxelnodes/bioxelutils/container.py b/bioxelnodes/bioxelutils/container.py index 3be1f4c..f8cb3d3 100644 --- a/bioxelnodes/bioxelutils/container.py +++ b/bioxelnodes/bioxelutils/container.py @@ -92,7 +92,7 @@ def add_layers(layers: list[Layer], layer_obj = layer_to_obj(layer, container_obj, cache_dir) fetch_node = add_node_to_graph("FetchLayer", node_group, - get_use_link()) + use_link=get_use_link()) fetch_node.label = get_layer_prop_value(layer_obj, "name") fetch_node.inputs[0].default_value = layer_obj diff --git a/bioxelnodes/bioxelutils/layer.py b/bioxelnodes/bioxelutils/layer.py index 14a0df7..0bebe84 100644 --- a/bioxelnodes/bioxelutils/layer.py +++ b/bioxelnodes/bioxelutils/layer.py @@ -172,7 +172,9 @@ def layer_to_obj(layer: Layer, socket_type="NodeSocketGeometry") modifier.node_group = node_group - layer_node = add_node_to_graph("_Layer", node_group, get_use_link()) + layer_node = add_node_to_graph("_Layer", + node_group, + use_link=get_use_link()) layer_node.inputs['name'].default_value = layer.name layer_node.inputs['shape'].default_value = layer.shape diff --git a/bioxelnodes/bioxelutils/node.py b/bioxelnodes/bioxelutils/node.py index 7279116..f642ea6 100644 --- a/bioxelnodes/bioxelutils/node.py +++ b/bioxelnodes/bioxelutils/node.py @@ -1,11 +1,10 @@ from pathlib import Path -import shutil import bpy -from .common import get_file_prop, set_file_prop +from .common import get_file_prop, get_node_lib_path, set_file_prop from ..exceptions import Incompatible, NoFound -from ..constants import NODE_LIB_FILEPATH, VERSION +from ..constants import VERSIONS def get_node_group(node_type: str, use_link=True): @@ -13,26 +12,27 @@ def get_node_group(node_type: str, use_link=True): # node_group = bpy.data.node_groups[node_type] # return node_group - if get_file_prop("addon_version") is None: - set_file_prop("addon_version", VERSION) + # added node is always from latest node version + addon_version = VERSIONS[0]["node_version"] + addon_lib_path = get_node_lib_path(addon_version) - local_lib_file = None - addon_lib_file = NODE_LIB_FILEPATH.as_posix() + if get_file_prop("node_version") is None: + set_file_prop("node_version", addon_version) + local_lib_path = None for node_group in bpy.data.node_groups: if node_group.name.startswith("BioxelNodes"): - node_group_lib = node_group.library - if node_group_lib: - abs_filepath = bpy.path.abspath(node_group_lib.filepath) - _local_lib_file = Path(abs_filepath).resolve().as_posix() - if _local_lib_file != addon_lib_file: - local_lib_file = _local_lib_file + lib = node_group.library + if lib: + lib_path = Path(bpy.path.abspath(lib.filepath)).resolve() + if lib_path != addon_lib_path: + local_lib_path = lib_path break # local lib first - lib_file = local_lib_file or addon_lib_file + lib_path = local_lib_path or addon_lib_path bpy.ops.wm.append('EXEC_DEFAULT', - directory=f"{lib_file}/NodeTree", + directory=f"{lib_path.as_posix()}/NodeTree", filename=node_type, link=use_link, use_recursive=True, @@ -52,8 +52,9 @@ def assign_node_group(node, node_type: str): return node -def add_node_to_graph(node_name: str, node_group, use_link=True): +def add_node_to_graph(node_name: str, node_group, node_label=None, use_link=True): node_type = f"BioxelNodes_{node_name}" + node_label = node_label or node_name # Deselect all nodes first for node in node_group.nodes: @@ -64,5 +65,6 @@ def add_node_to_graph(node_name: str, node_group, use_link=True): node = node_group.nodes.new("GeometryNodeGroup") assign_node_group(node, node_type) + node.label = node_label node.show_options = False return node diff --git a/bioxelnodes/blender_manifest.toml b/bioxelnodes/blender_manifest.toml index a166bb9..20c5057 100644 --- a/bioxelnodes/blender_manifest.toml +++ b/bioxelnodes/blender_manifest.toml @@ -19,10 +19,10 @@ wheels = [ "./wheels/SimpleITK-2.3.1-cp311-cp311-macosx_10_9_x86_64.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/lxml-5.2.2-cp311-cp311-win_amd64.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-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", + "./wheels/lxml-5.3.0-cp311-cp311-win_amd64.whl", + "./wheels/lxml-5.3.0-cp311-cp311-macosx_10_9_arm64.whl", + "./wheels/lxml-5.3.0-cp311-cp311-macosx_10_9_x86_64.whl", + "./wheels/lxml-5.3.0-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-macosx_11_0_arm64.whl", "./wheels/h5py-3.11.0-cp311-cp311-macosx_10_9_x86_64.whl", @@ -34,4 +34,4 @@ wheels = [ ] [permissions] -files = "Import/export volume data from/to disk" +files = "Import/export volume data from/to disk" \ No newline at end of file diff --git a/bioxelnodes/constants.py b/bioxelnodes/constants.py index e93018e..53692f7 100644 --- a/bioxelnodes/constants.py +++ b/bioxelnodes/constants.py @@ -1,9 +1,11 @@ from pathlib import Path -VERSION = (1, 0, 0) -NODE_LIB_FILENAME = "BioxelNodes_v1.0.x" -NODE_LIB_FILEPATH = Path(Path(__file__).parent, - f"assets/Nodes/{NODE_LIB_FILENAME}.blend").resolve() +VERSIONS = [{"label": "Current", "node_version": (1, 0, 0)}, + {"label": "v0.3.x", "node_version": (0, 3, 3)}, + {"label": "v0.2.x", "node_version": (0, 2, 9)}] + +NODE_LIB_DIRPATH = Path(Path(__file__).parent, + "assets/Nodes").resolve() MENU_ITEMS = [ { @@ -23,9 +25,9 @@ 'description': '' }, { - 'label': 'Cutout by Color', + 'label': 'Cutout by Hue', 'icon': 'COLOR', - 'name': 'CutoutByColor', + 'name': 'CutoutByHue', 'description': '' }, "separator", @@ -50,7 +52,7 @@ ] }, { - 'label': 'Properties', + 'label': 'Property', 'icon': 'PROPERTIES', 'items': [ { @@ -148,7 +150,7 @@ ] }, { - 'label': 'Cutters', + 'label': 'Cut', 'icon': 'MOD_BEVEL', 'items': [ { @@ -173,31 +175,31 @@ ] }, { - 'label': 'Utils', + 'label': 'Extra', 'icon': 'MODIFIER', 'items': [ { - 'label': 'Pick Surface', + 'label': 'Fetch Surface', 'icon': 'OUTLINER_OB_MESH', - 'name': 'PickSurface', + 'name': 'FetchSurface', 'description': '' }, { - 'label': 'Pick Volume', + 'label': 'Fetch Volume', 'icon': 'OUTLINER_OB_VOLUME', - 'name': 'PickVolume', + 'name': 'FetchVolume', 'description': '' }, { - 'label': 'Pick Shape Wire', + 'label': 'Fetch Shape Wire', 'icon': 'FILE_VOLUME', - 'name': 'PickShapeWire', + 'name': 'FetchShapeWire', 'description': '' }, { - 'label': 'Pick Bbox Wire', + 'label': 'Fetch Bbox Wire', 'icon': 'MESH_CUBE', - 'name': 'PickBboxWire', + 'name': 'FetchBboxWire', 'description': '' }, "separator", diff --git a/bioxelnodes/menus.py b/bioxelnodes/menus.py index a120844..2323026 100644 --- a/bioxelnodes/menus.py +++ b/bioxelnodes/menus.py @@ -1,11 +1,11 @@ import bpy -from .constants import MENU_ITEMS, NODE_LIB_FILENAME +from .constants import MENU_ITEMS, VERSIONS from .node_menu import NodeMenu from .bioxelutils.common import (get_container_obj, get_container_layer_objs, get_layer_label, - get_layer_prop_value) + get_layer_prop_value, get_node_version, is_incompatible) from .operators.layer import (FetchLayer, RelocateLayer, RetimeLayer, RenameLayer, RemoveSelectedLayers, SaveSelectedLayersCache, ResampleLayer, SignScalar, CombineLabels, @@ -22,6 +22,39 @@ ReLinkNodeLib, RemoveAllMissingLayers, RenderSettingPreset, SaveAllLayersCache, SaveNodeLib, SliceViewer) +class IncompatibleMenu(bpy.types.Menu): + bl_idname = "BIOXELNODES_MT_INCOMPATIBLE" + bl_label = "Bioxel Nodes" + + def draw(self, context): + tip_text = "please downgrade addon version." + node_version = get_node_version() + if node_version: + version_str = "v"+".".join([str(i) for i in list(node_version)]) + tip_text = f"please downgrade addon version to {version_str}." + + layout = self.layout + layout.label(text="Incompatible node version detected.") + layout.separator() + layout.label( + text="If you still want to edit this file with bioxel nodes, ") + layout.label(text=tip_text) + layout.separator() + layout.label(text="If this file is archived, " + "please relink node library, ") + layout.label(text="check if it still works, " + "then save node library.") + layout.separator() + layout.menu(ReLinkNodeLibMenu.bl_idname) + layout.operator(SaveNodeLib.bl_idname) + + layout.separator() + layout.menu(DangerZoneMenu.bl_idname) + + layout.separator() + layout.menu(RenderSettingMenu.bl_idname) + + class FetchLayerMenu(bpy.types.Menu): bl_idname = "BIOXELNODES_MT_ADD_LAYER" bl_label = "Fetch Layer" @@ -122,18 +155,11 @@ class ReLinkNodeLibMenu(bpy.types.Menu): def draw(self, context): layout = self.layout - versions = [{"label": "v0.3.x", "filename": "BioxelNodes_v0.3.x"}, - {"label": "v0.2.x", "filename": "BioxelNodes_v0.2.x"}, - {"label": "v0.1.x", "filename": "BioxelNodes_v0.1.x"}] - op = layout.operator(ReLinkNodeLib.bl_idname, - text="Current Version") - op.node_lib_filename = NODE_LIB_FILENAME - layout.separator() - for version in versions: + for index, version in enumerate(VERSIONS): op = layout.operator(ReLinkNodeLib.bl_idname, text=version["label"]) - op.node_lib_filename = version["filename"] + op.index = index class RenderSettingMenu(bpy.types.Menu): @@ -185,7 +211,11 @@ def draw(self, context): def TOPBAR(self, context): layout = self.layout - layout.menu(BioxelNodesTopbarMenu.bl_idname) + + if is_incompatible(): + layout.menu(IncompatibleMenu.bl_idname) + else: + layout.menu(BioxelNodesTopbarMenu.bl_idname) class NodeHeadMenu(bpy.types.Menu): @@ -248,6 +278,9 @@ def draw(self, context): def NODE_CONTEXT(self, context): + if is_incompatible(): + return + container_obj = context.object is_geo_nodes = context.area.ui_type == "GeometryNodeTree" is_container = get_container_obj(container_obj) @@ -261,6 +294,9 @@ def NODE_CONTEXT(self, context): def NODE_HEAD(self, context): + if is_incompatible(): + return + container_obj = context.object is_geo_nodes = context.area.ui_type == "GeometryNodeTree" is_container = get_container_obj(container_obj) @@ -274,6 +310,9 @@ def NODE_HEAD(self, context): def NODE_PROP(self, context): + if is_incompatible(): + return + container_obj = context.object is_geo_nodes = context.area.ui_type == "GeometryNodeTree" is_container = get_container_obj(container_obj) @@ -354,8 +393,7 @@ def NODE_PROP(self, context): def VIEW3D_TOPBAR(self, context): layout = self.layout - layout.operator(SliceViewer.bl_idname, - icon=SliceViewer.bl_icon, text="") + layout.operator(SliceViewer.bl_idname) node_menu = NodeMenu( diff --git a/bioxelnodes/operators/container.py b/bioxelnodes/operators/container.py index ba9fc01..df4c347 100644 --- a/bioxelnodes/operators/container.py +++ b/bioxelnodes/operators/container.py @@ -100,7 +100,8 @@ def execute(self, context): output_node = get_nodes_by_type(node_group, 'NodeGroupOutput')[0] fetch_mesh_node = add_node_to_graph(f"Fetch{self.object_type}", node_group, - get_use_link()) + node_label=f"Fetch {self.object_type}", + use_link=get_use_link()) fetch_mesh_node.inputs[0].default_value = container_obj node_group.links.new(fetch_mesh_node.outputs[0], output_node.inputs[0]) @@ -220,7 +221,7 @@ def execute(self, context): # center = [find_center(axis) for axis in [x, y, z]] # cutter_obj.location = center - name = self.cutter_type.capitalize() + name = f"{self.cutter_type.capitalize()}_Cutter" cutter_obj.name = name cutter_obj.data.name = name cutter_obj.visible_camera = False @@ -243,13 +244,14 @@ def execute(self, context): if len(cut_nodes) == 0: cutter_node = add_node_to_graph("ObjectCutter", node_group, - get_use_link()) + node_label=name, + use_link=get_use_link()) cutter_node.inputs[0].default_value = self.cutter_type.capitalize() cutter_node.inputs[1].default_value = cutter_obj cut_node = add_node_to_graph("Cut", node_group, - get_use_link()) + use_link=get_use_link()) output_node = get_nodes_by_type(node_group, 'NodeGroupOutput')[0] @@ -362,7 +364,7 @@ def execute(self, context): slice_node = add_node_to_graph("Slice", node_group, - get_use_link()) + use_link=get_use_link()) slice_node.inputs[1].default_value = slicer_obj @@ -412,7 +414,8 @@ def execute(self, context): parent_node = add_node_to_graph("TransformParent", node_group, - get_use_link()) + node_label="Transform Parent", + use_link=get_use_link()) parent_node.inputs[1].default_value = locator_obj diff --git a/bioxelnodes/operators/io.py b/bioxelnodes/operators/io.py index 7819256..9e90a73 100644 --- a/bioxelnodes/operators/io.py +++ b/bioxelnodes/operators/io.py @@ -828,7 +828,7 @@ def modal(self, context, event): container = Container(name=name, layers=self.layers) - step_size = container.layers[0].bioxel_size[0]*5 + step_size = container.layers[0].bioxel_size[0]*10 container_obj = container_to_obj(container, scene_scale=self.scene_scale, step_size=step_size, @@ -839,8 +839,8 @@ def modal(self, context, event): # Change render setting for better result if is_first_import: bpy.ops.bioxelnodes.render_setting_preset('EXEC_DEFAULT', - preset="preview_c") - # bpy.ops.bioxelnodes.slice_viewer('EXEC_DEFAULT') + preset="balance") + bpy.context.scene.render.engine = 'CYCLES' self.report({"INFO"}, "Successfully Imported") return {'FINISHED'} diff --git a/bioxelnodes/operators/layer.py b/bioxelnodes/operators/layer.py index 16c8c0e..49da89f 100644 --- a/bioxelnodes/operators/layer.py +++ b/bioxelnodes/operators/layer.py @@ -3,14 +3,17 @@ import numpy as np + + from ..exceptions import NoContent from ..bioxel.layer import Layer +from ..bioxelutils.node import add_node_to_graph from ..bioxelutils.common import (get_container_obj, get_layer_kind, get_layer_label, get_layer_name, get_layer_prop_value, get_container_layer_objs, - get_node_type, is_missing_layer, set_layer_prop_value) + get_node_type, is_missing_layer, move_node_to_node, set_layer_prop_value) from ..bioxelutils.layer import layer_to_obj, obj_to_layer -from ..utils import get_cache_dir, copy_to_dir +from ..utils import get_cache_dir, copy_to_dir, get_use_link def get_label_layer_selection(self, context): @@ -105,12 +108,17 @@ def operate(self, orig_layer: Layer, context): return orig_layer def add_layer_node(self, context, layer): + orig_node = context.selected_nodes[0] layer_obj = layer_to_obj(layer, container_obj=context.object, cache_dir=get_cache_dir()) - - bpy.ops.bioxelnodes.fetch_layer('INVOKE_DEFAULT', - layer_obj_name=layer_obj.name) + node_group = context.space_data.edit_tree + fetch_node = add_node_to_graph("FetchLayer", + node_group, + use_link=get_use_link()) + fetch_node.label = get_layer_prop_value(layer_obj, "name") + fetch_node.inputs[0].default_value = layer_obj + move_node_to_node(fetch_node, orig_node, (0, -100)) def execute(self, context): layer_obj = get_selected_layer(context) diff --git a/bioxelnodes/operators/misc.py b/bioxelnodes/operators/misc.py index 52e848b..8b11151 100644 --- a/bioxelnodes/operators/misc.py +++ b/bioxelnodes/operators/misc.py @@ -2,10 +2,10 @@ from pathlib import Path import shutil -from ..bioxelutils.common import get_all_layer_objs, is_missing_layer, set_file_prop +from ..bioxelutils.common import get_all_layer_objs, get_node_lib_path, get_node_version, is_missing_layer, set_file_prop from .layer import RemoveLayers, SaveLayersCache -from ..constants import NODE_LIB_FILEPATH, VERSION +from ..constants import NODE_LIB_DIRPATH, VERSIONS from ..utils import get_cache_dir @@ -15,13 +15,12 @@ class ReLinkNodeLib(bpy.types.Operator): bl_description = "Relink all nodes to addon library source" bl_options = {'UNDO'} - node_lib_filename: bpy.props.StringProperty( - default="" - ) # type: ignore + index: bpy.props.IntProperty() # type: ignore def execute(self, context): - lib_filepath = Path(NODE_LIB_FILEPATH.parent, - f"{self.node_lib_filename}.blend") + node_version = VERSIONS[self.index]['node_version'] + lib_path = get_node_lib_path(node_version) + node_libs = [] for node_group in bpy.data.node_groups: if node_group.name.startswith("BioxelNodes"): @@ -32,10 +31,12 @@ def execute(self, context): node_libs = list(set(node_libs)) for node_lib in node_libs: - node_lib.filepath = str(lib_filepath) + node_lib.filepath = str(lib_path) # FIXME: may cause crash node_lib.reload() + set_file_prop("node_version", node_version) + self.report({"INFO"}, f"Successfully relinked.") return {'FINISHED'} @@ -54,13 +55,22 @@ class SaveNodeLib(bpy.types.Operator): ) # type: ignore def execute(self, context): + node_version = get_node_version() + if node_version is None: + node_version = VERSIONS[0]["node_version"] + else: + if node_version not in [v["node_version"] for v in VERSIONS]: + node_version = VERSIONS[0]["node_version"] + + lib_path = get_node_lib_path(node_version) + lib_dir = bpy.path.abspath(self.lib_dir) - local_lib_path: Path = Path(lib_dir, NODE_LIB_FILEPATH.name).resolve() - addon_lib_path: Path = NODE_LIB_FILEPATH + local_lib_path: Path = Path(lib_dir, lib_path.name).resolve() + node_lib_path: Path = lib_path blend_path = Path(bpy.path.abspath("//")).resolve() - if local_lib_path != addon_lib_path: - shutil.copy(addon_lib_path, local_lib_path) + if local_lib_path != node_lib_path: + shutil.copy(node_lib_path, local_lib_path) libs = [] for node_group in bpy.data.node_groups: @@ -73,8 +83,6 @@ def execute(self, context): lib.filepath = bpy.path.relpath(str(local_lib_path), start=str(blend_path)) - set_file_prop("addon_version", VERSION) - return {'FINISHED'} def invoke(self, context, event): @@ -116,55 +124,64 @@ class RenderSettingPreset(bpy.types.Operator): bl_options = {'UNDO'} PRESETS = { - "preview_e": "Preview (EEVEE)", - "preview_c": "Preview (Cycles)", - "production_e": "Production (EEVEE)", - "production_c": "Production (Cycles)" + "performance": "Performance", + "balance": "Balance", + "quality": "Quality", } preset: bpy.props.EnumProperty(name="Preset", - default="preview_c", + default="balance", items=[(k, v, "") for k, v in PRESETS.items()]) # type: ignore def execute(self, context): - if self.preset == "preview_e": - bpy.context.scene.render.engine = 'BLENDER_EEVEE_NEXT' + if self.preset == "performance": + # EEVEE bpy.context.scene.eevee.use_taa_reprojection = False - bpy.context.scene.eevee.taa_samples = 16 bpy.context.scene.eevee.volumetric_tile_size = '2' - bpy.context.scene.eevee.volumetric_shadow_samples = 128 + bpy.context.scene.eevee.volumetric_shadow_samples = 32 + bpy.context.scene.eevee.volumetric_samples = 64 + bpy.context.scene.eevee.volumetric_ray_depth = 1 + bpy.context.scene.eevee.use_volumetric_shadows = True + + # Cycles + bpy.context.scene.cycles.shading_system = True + bpy.context.scene.cycles.volume_bounces = 0 + bpy.context.scene.cycles.transparent_max_bounces = 4 + bpy.context.scene.cycles.volume_preview_step_rate = 4 + bpy.context.scene.cycles.volume_step_rate = 4 + + elif self.preset == "balance": + # EEVEE + bpy.context.scene.eevee.use_taa_reprojection = False + bpy.context.scene.eevee.volumetric_tile_size = '2' + bpy.context.scene.eevee.volumetric_shadow_samples = 64 bpy.context.scene.eevee.volumetric_samples = 128 - bpy.context.scene.eevee.volumetric_ray_depth = 16 + bpy.context.scene.eevee.volumetric_ray_depth = 8 bpy.context.scene.eevee.use_volumetric_shadows = True - elif self.preset == "production_e": - bpy.context.scene.render.engine = 'BLENDER_EEVEE_NEXT' + # Cycles + bpy.context.scene.cycles.shading_system = True + bpy.context.scene.cycles.volume_bounces = 4 + bpy.context.scene.cycles.transparent_max_bounces = 8 + bpy.context.scene.cycles.volume_preview_step_rate = 1 + bpy.context.scene.cycles.volume_step_rate = 1 + + elif self.preset == "quality": + # EEVEE bpy.context.scene.eevee.use_taa_reprojection = False - bpy.context.scene.eevee.taa_samples = 16 - bpy.context.scene.eevee.volumetric_tile_size = '1' + 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.volumetric_ray_depth = 16 bpy.context.scene.eevee.use_volumetric_shadows = True - elif self.preset == "preview_c": - bpy.context.scene.render.engine = 'CYCLES' + # Cycles bpy.context.scene.cycles.shading_system = True - bpy.context.scene.cycles.volume_bounces = 12 + bpy.context.scene.cycles.volume_bounces = 8 bpy.context.scene.cycles.transparent_max_bounces = 16 - bpy.context.scene.cycles.volume_preview_step_rate = 1 - bpy.context.scene.cycles.volume_step_rate = 1 - # bpy.context.scene.cycles.use_fast_gi = True - - elif self.preset == "production_c": - bpy.context.scene.render.engine = 'CYCLES' - bpy.context.scene.cycles.shading_system = True - bpy.context.scene.cycles.volume_bounces = 16 - bpy.context.scene.cycles.transparent_max_bounces = 32 bpy.context.scene.cycles.volume_preview_step_rate = 0.5 bpy.context.scene.cycles.volume_step_rate = 0.5 - # bpy.context.scene.cycles.use_fast_gi = False return {'FINISHED'} @@ -177,7 +194,6 @@ class SliceViewer(bpy.types.Operator): def execute(self, context): bpy.context.scene.eevee.use_taa_reprojection = False - bpy.context.scene.eevee.taa_samples = 4 bpy.context.scene.eevee.volumetric_tile_size = '2' bpy.context.scene.eevee.volumetric_shadow_samples = 128 bpy.context.scene.eevee.volumetric_samples = 128 diff --git a/bioxelnodes/operators/node.py b/bioxelnodes/operators/node.py index 8ba94ce..f831e94 100644 --- a/bioxelnodes/operators/node.py +++ b/bioxelnodes/operators/node.py @@ -1,8 +1,6 @@ import bpy -from ..bioxelutils.common import get_file_prop, is_incompatible, local_lib_not_updated -from ..constants import VERSION -from ast import literal_eval +from ..bioxelutils.common import is_incompatible, local_lib_not_updated from ..bioxelutils.node import assign_node_group, get_node_group from ..utils import get_use_link @@ -57,6 +55,6 @@ def execute(self, context): if local_lib_not_updated(): self.report({"WARNING"}, - "Local library version does not match the current addon version, which may cause problems, please save the node library again.") + "Local node library version does not match the current addon version, which may cause problems, please save the node library again.") return {"FINISHED"} diff --git a/docs/advanced.md b/docs/advanced.md new file mode 100644 index 0000000..518035f --- /dev/null +++ b/docs/advanced.md @@ -0,0 +1,3 @@ +# Advanced + +WIP diff --git a/docs/assets/cover.png b/docs/assets/cover.png index a740192..300118a 100644 Binary files a/docs/assets/cover.png and b/docs/assets/cover.png differ diff --git a/docs/assets/features_as-scalar.png b/docs/assets/features_as-scalar.png deleted file mode 100644 index 4644982..0000000 Binary files a/docs/assets/features_as-scalar.png and /dev/null differ diff --git a/docs/assets/features_concept.png b/docs/assets/features_concept.png deleted file mode 100644 index 31e2a4f..0000000 Binary files a/docs/assets/features_concept.png and /dev/null differ diff --git a/docs/assets/features_container.png b/docs/assets/features_container.png deleted file mode 100644 index d25ae7b..0000000 Binary files a/docs/assets/features_container.png and /dev/null differ diff --git a/docs/assets/features_import-others.png b/docs/assets/features_import-others.png deleted file mode 100644 index 4a179f6..0000000 Binary files a/docs/assets/features_import-others.png and /dev/null differ diff --git a/docs/assets/features_resample.png b/docs/assets/features_resample.png deleted file mode 100644 index 35ded07..0000000 Binary files a/docs/assets/features_resample.png and /dev/null differ diff --git a/docs/assets/gallery.png b/docs/assets/gallery.png deleted file mode 100644 index eac61da..0000000 Binary files a/docs/assets/gallery.png and /dev/null differ diff --git a/docs/assets/getting-started_convert_to_mesh.png b/docs/assets/getting-started_convert_to_mesh.png deleted file mode 100644 index db02f09..0000000 Binary files a/docs/assets/getting-started_convert_to_mesh.png and /dev/null differ diff --git a/docs/assets/getting-started_cutting.png b/docs/assets/getting-started_cutting.png deleted file mode 100644 index d5d0911..0000000 Binary files a/docs/assets/getting-started_cutting.png and /dev/null differ diff --git a/docs/assets/getting-started_graph.png b/docs/assets/getting-started_graph.png deleted file mode 100644 index acc90e8..0000000 Binary files a/docs/assets/getting-started_graph.png and /dev/null differ diff --git a/docs/assets/getting-started_importing.png b/docs/assets/getting-started_importing.png deleted file mode 100644 index ffd4978..0000000 Binary files a/docs/assets/getting-started_importing.png and /dev/null differ diff --git a/docs/assets/getting-started_masking.png b/docs/assets/getting-started_masking.png deleted file mode 100644 index 919465c..0000000 Binary files a/docs/assets/getting-started_masking.png and /dev/null differ diff --git a/docs/assets/getting-started_result.png b/docs/assets/getting-started_result.png deleted file mode 100644 index 2628cb5..0000000 Binary files a/docs/assets/getting-started_result.png and /dev/null differ diff --git a/docs/assets/getting-started_save_staged_data.png b/docs/assets/getting-started_save_staged_data.png deleted file mode 100644 index 56a5f48..0000000 Binary files a/docs/assets/getting-started_save_staged_data.png and /dev/null differ diff --git a/docs/assets/getting-started_shading.png b/docs/assets/getting-started_shading.png deleted file mode 100644 index 647bc40..0000000 Binary files a/docs/assets/getting-started_shading.png and /dev/null differ diff --git a/docs/assets/getting-started_share-file.png b/docs/assets/getting-started_share-file.png deleted file mode 100644 index 8d4e67c..0000000 Binary files a/docs/assets/getting-started_share-file.png and /dev/null differ diff --git a/docs/assets/improve_performance/image-1.png b/docs/assets/improve_performance/image-1.png new file mode 100644 index 0000000..08fde44 Binary files /dev/null and b/docs/assets/improve_performance/image-1.png differ diff --git a/docs/assets/improve_performance/image-2.png b/docs/assets/improve_performance/image-2.png new file mode 100644 index 0000000..abc4534 Binary files /dev/null and b/docs/assets/improve_performance/image-2.png differ diff --git a/docs/assets/improve_performance/image.png b/docs/assets/improve_performance/image.png new file mode 100644 index 0000000..1f81956 Binary files /dev/null and b/docs/assets/improve_performance/image.png differ diff --git a/docs/assets/installation_extension.png b/docs/assets/installation/image.png similarity index 100% rename from docs/assets/installation_extension.png rename to docs/assets/installation/image.png diff --git a/docs/assets/installation_dependency.png b/docs/assets/installation_dependency.png deleted file mode 100644 index e88e1c3..0000000 Binary files a/docs/assets/installation_dependency.png and /dev/null differ diff --git a/docs/assets/nodes_bake.png b/docs/assets/nodes_bake.png deleted file mode 100644 index 71b245d..0000000 Binary files a/docs/assets/nodes_bake.png and /dev/null differ diff --git a/docs/assets/nodes_color-presets.png b/docs/assets/nodes_color-presets.png deleted file mode 100644 index d4c2908..0000000 Binary files a/docs/assets/nodes_color-presets.png and /dev/null differ diff --git a/docs/assets/nodes_color-ramp-2.png b/docs/assets/nodes_color-ramp-2.png deleted file mode 100644 index 58eda88..0000000 Binary files a/docs/assets/nodes_color-ramp-2.png and /dev/null differ diff --git a/docs/assets/nodes_color-ramp-3.png b/docs/assets/nodes_color-ramp-3.png deleted file mode 100644 index f3b4a7b..0000000 Binary files a/docs/assets/nodes_color-ramp-3.png and /dev/null differ diff --git a/docs/assets/nodes_color-ramp-4.png b/docs/assets/nodes_color-ramp-4.png deleted file mode 100644 index 8619525..0000000 Binary files a/docs/assets/nodes_color-ramp-4.png and /dev/null differ diff --git a/docs/assets/nodes_color-ramp-5.png b/docs/assets/nodes_color-ramp-5.png deleted file mode 100644 index 22022c8..0000000 Binary files a/docs/assets/nodes_color-ramp-5.png and /dev/null differ diff --git a/docs/assets/nodes_concept.png b/docs/assets/nodes_concept.png deleted file mode 100644 index 6f5c149..0000000 Binary files a/docs/assets/nodes_concept.png and /dev/null differ diff --git a/docs/assets/nodes_cut.png b/docs/assets/nodes_cut.png deleted file mode 100644 index 99ac754..0000000 Binary files a/docs/assets/nodes_cut.png and /dev/null differ diff --git a/docs/assets/nodes_example.png b/docs/assets/nodes_example.png deleted file mode 100644 index eb0a5d9..0000000 Binary files a/docs/assets/nodes_example.png and /dev/null differ diff --git a/docs/assets/nodes_join-component.png b/docs/assets/nodes_join-component.png deleted file mode 100644 index ddfeb4a..0000000 Binary files a/docs/assets/nodes_join-component.png and /dev/null differ diff --git a/docs/assets/nodes_mask-by-label.png b/docs/assets/nodes_mask-by-label.png deleted file mode 100644 index 6afc39b..0000000 Binary files a/docs/assets/nodes_mask-by-label.png and /dev/null differ diff --git a/docs/assets/nodes_mask-by-range.png b/docs/assets/nodes_mask-by-range.png deleted file mode 100644 index 53f43e4..0000000 Binary files a/docs/assets/nodes_mask-by-range.png and /dev/null differ diff --git a/docs/assets/nodes_mask-by-threshold.png b/docs/assets/nodes_mask-by-threshold.png deleted file mode 100644 index 04d247f..0000000 Binary files a/docs/assets/nodes_mask-by-threshold.png and /dev/null differ diff --git a/docs/assets/nodes_plane-cutter.png b/docs/assets/nodes_plane-cutter.png deleted file mode 100644 index 4b1c8da..0000000 Binary files a/docs/assets/nodes_plane-cutter.png and /dev/null differ diff --git a/docs/assets/nodes_plane-object-cutter.png b/docs/assets/nodes_plane-object-cutter.png deleted file mode 100644 index 0840884..0000000 Binary files a/docs/assets/nodes_plane-object-cutter.png and /dev/null differ diff --git a/docs/assets/nodes_separate-component.png b/docs/assets/nodes_separate-component.png deleted file mode 100644 index 9f8da9c..0000000 Binary files a/docs/assets/nodes_separate-component.png and /dev/null differ diff --git a/docs/assets/nodes_slime-shader.png b/docs/assets/nodes_slime-shader.png deleted file mode 100644 index fb055f3..0000000 Binary files a/docs/assets/nodes_slime-shader.png and /dev/null differ diff --git a/docs/assets/nodes_solid-shader.png b/docs/assets/nodes_solid-shader.png deleted file mode 100644 index b8cb875..0000000 Binary files a/docs/assets/nodes_solid-shader.png and /dev/null differ diff --git a/docs/assets/nodes_universal-shader.png b/docs/assets/nodes_universal-shader.png deleted file mode 100644 index 5a5b605..0000000 Binary files a/docs/assets/nodes_universal-shader.png and /dev/null differ diff --git a/docs/assets/nodes_volume-shader.png b/docs/assets/nodes_volume-shader.png deleted file mode 100644 index 1352190..0000000 Binary files a/docs/assets/nodes_volume-shader.png and /dev/null differ diff --git a/docs/assets/step_by_step/image-1.png b/docs/assets/step_by_step/image-1.png new file mode 100644 index 0000000..6da5ea1 Binary files /dev/null and b/docs/assets/step_by_step/image-1.png differ diff --git a/docs/assets/step_by_step/image-2.png b/docs/assets/step_by_step/image-2.png new file mode 100644 index 0000000..58ed84b Binary files /dev/null and b/docs/assets/step_by_step/image-2.png differ diff --git a/docs/assets/step_by_step/image-3.png b/docs/assets/step_by_step/image-3.png new file mode 100644 index 0000000..ec8b203 Binary files /dev/null and b/docs/assets/step_by_step/image-3.png differ diff --git a/docs/assets/step_by_step/image-4.png b/docs/assets/step_by_step/image-4.png new file mode 100644 index 0000000..df8a855 Binary files /dev/null and b/docs/assets/step_by_step/image-4.png differ diff --git a/docs/assets/step_by_step/image-5.png b/docs/assets/step_by_step/image-5.png new file mode 100644 index 0000000..30d4f7a Binary files /dev/null and b/docs/assets/step_by_step/image-5.png differ diff --git a/docs/assets/step_by_step/image-6.png b/docs/assets/step_by_step/image-6.png new file mode 100644 index 0000000..a4dfece Binary files /dev/null and b/docs/assets/step_by_step/image-6.png differ diff --git a/docs/assets/step_by_step/image-7.png b/docs/assets/step_by_step/image-7.png new file mode 100644 index 0000000..d3f3e41 Binary files /dev/null and b/docs/assets/step_by_step/image-7.png differ diff --git a/docs/assets/step_by_step/image-8.png b/docs/assets/step_by_step/image-8.png new file mode 100644 index 0000000..7a99002 Binary files /dev/null and b/docs/assets/step_by_step/image-8.png differ diff --git a/docs/assets/step_by_step/image-9.png b/docs/assets/step_by_step/image-9.png new file mode 100644 index 0000000..3540f03 Binary files /dev/null and b/docs/assets/step_by_step/image-9.png differ diff --git a/docs/assets/step_by_step/image.png b/docs/assets/step_by_step/image.png new file mode 100644 index 0000000..2d1ba8a Binary files /dev/null and b/docs/assets/step_by_step/image.png differ diff --git a/docs/benchmark.md b/docs/benchmark.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/color.md b/docs/color.md deleted file mode 100644 index a78060c..0000000 --- a/docs/color.md +++ /dev/null @@ -1 +0,0 @@ -This type of node is responsible for setting the color properties of the shader diff --git a/docs/concept.md b/docs/concept.md deleted file mode 100644 index a44f471..0000000 --- a/docs/concept.md +++ /dev/null @@ -1,46 +0,0 @@ -# Concepts & Pipeline - -## Container, Layer, Component - -Bioxel Nodes imports volumetric data and put it into a **Container** as a **Layer**. One container may has more than one layer, and each layer stores the information of different fields under the same location, which is similar to the view layers in map app, except that here it is in 3D space. - -In order to visualize the volumetric data the way we want it to, we need to build renderable objects from layers. We call those objects **Component**. The following diagram shows the relationship of **Container**, **Layer**, and **Component**: - -![alt text](assets/features_concept.png) - -### Container Structure - -In Blender, container structure is like this: - -```bash -Case_0000 # Container -|-- Case_0000_CT # Layer -|-- Case_0000_Label_1 # Layer -`-- Case_0000_Label_2 # Layer -``` - -The container also stores the build process in geometry nodes: - -![alt text](assets/features_container.png) - -### Layer Type -The layer is categorized into these by data type: - -- Scalar -- Label -- Vector (Not implemented yet) -- Color (Not implemented yet) - -## Component Building Pipline - -In order to build a component, the general process is to first use a "Mask Method" node to build the surface of the component based on its layers, and then connect to a "Assign Shader" node to add the physical properties. Finally, if you need to cut the cross-section, then connect to a "Cut" node. The whole process is shown in the following diagram - -![alt text](assets/nodes_concept.png) - -A typical example looks like this: - -![alt text](assets/nodes_example.png) - -The "Mask Method" node tends to be very computationally intensive, and if it consumes too much time, then you can bake it with a "Bake" node after it (but you need to save the Blender file first). - -![alt text](assets/nodes_bake.png) diff --git a/docs/cut.md b/docs/cut.md deleted file mode 100644 index ef6b0ad..0000000 --- a/docs/cut.md +++ /dev/null @@ -1 +0,0 @@ -This type of node is responsible for cutting components to present cross-section \ No newline at end of file diff --git a/docs/import.md b/docs/import.md deleted file mode 100644 index 699fafb..0000000 --- a/docs/import.md +++ /dev/null @@ -1,41 +0,0 @@ - -## First Time Import Volume Data - -File > Import > Volume Data as Bioxel Layer - -### Resample - -![alt text](assets/features_resample.png) - -Sometimes the original data is too big, or the spacing in the original data is not reasonable, you can modify the `Bioxel Size` and `Original Spacing` to adjust the Shape of the layer. - -A bioxel is like a pixel, the larger the `Bioxel Size`, the lower the resolution of the image, Original Spacing will be read from the original data record, but sometimes the image doesn't have original spacing, you may need to input it manually to get the correct shape. - -### Read as - -- as Scalar - - ![alt text](assets/features_as-scalar.png) - - In some cases the environment value is higher than the value of the target object, you can check `Invert Scalar` to adjust the value for better result. - -- as Labels - - Many AI segmentation task datasets, provide segmentation data, which are often an integer value representing a layer of segmentation labels. You can set it to `Labels` to load them. - -- _as Vector (Not implemented yet)_ - -- _as Color (Not implemented yet)_ - -### Others - -![alt text](assets/features_import-others.png) - -`Scene Scale` determines how many units of length in the Blender world correspond to one unit of length in the Bioxel world. Since Blender defaults to meters, and the default size of blender primitives are around 1 blender unit. Therefore `Scene Scale` set to 0.01 is appropriate. - -`Orient to RAS` determines whether the layer should be converted to the RAS coordinate system. Regardless of the format of the medical image data, the coordinate system is mostly the LPS coordinate system. Bioxel, however, are in the RAS coordinate system and therefore need to be transformed in most cases. - -## Adding Volume Data to an existing container - -In 3D view or outliner panel, select the container and right click, Bioxel Nodes > Add Volume Data to Container. -The import settings are the same as for the first time import. \ No newline at end of file diff --git a/docs/improve_performance.md b/docs/improve_performance.md new file mode 100644 index 0000000..380ddf0 --- /dev/null +++ b/docs/improve_performance.md @@ -0,0 +1,39 @@ +# Improve Performance + +Volume reconstruction and volume rendering are very consuming computation, I believe that this add-on's experience is terrible on poorly hardware. here are tips to improve the add-on performance. + +## Use Low-Res Data as Preview + +The addon provides data resample function, the operation is as follows. First, in the container's geometry node, select the layer you need to resample, right-click **Bioxel Nodes > Resample Value**, in the dialog box, change the "Bioxel Size" value to twice or more than the current value, click OK. the addon will create a low-res version of the layer and load it into the container's geometry node. + +![alt text](assets/improve_performance/image.png) + +You can see that the speed of the reconstruction has been reduced from 240 ms to 37 ms, making it possible to compute in almost real-time, and improving the speed of the feedback of the changing the parameters. Once you are satisfied with the adjustment, you can then connect the original layer to the nodes. This tip can greatly improve the operation experience of the node. + +## Raise the Step Rate of a Container + +Step rate is a key setting in volume rendering. The higher the step rate, the faster the rendering will be, but at the same time, the thinner the volume will look. If you want to have a very thin effect, or if you don't need to cut through component, you can always set the step rate high, you can adjust step rate in the render settings globaly. However, I recommend you to adjust the step rate of the container separately, so that it doesn't affect the rendering of the other volume in the Blender file, do as follows. + +In the container's geometry nodes panel menu, click **Bioxel Nodes > Change Container Properties**, in the dialog box, raise the "Step Rate" value (up to 100) and click OK. + +![alt text](assets/improve_performance/image-1.png) + +You can see that the rendering speed is much higher, but at the same time the cuts look blurry and transparent. + +## Balance rendering settings + +I list some of the settings that affect the volume rendering most, so you can find the most balanced settings for your needs. + +- **Light Paths > Max Bounces > Volume** affects the number of bounces a volume has, the higher the value, the more transparent it will look. + +- **Light Paths > Max Bounces > Transparent** affects the number of times transparent surfaces are transmitted, the higher the value, the more transparent it will look. + +- **Volumes > Step Rate Render | Viewport** affects the volume rendering step, the smaller the value, the more detailed the volume will look + +Bioxel Nodes provides some render setting presets for quick setup. In the top menu, click **Bioxel Nodes > Render Setting Presets**, including Performance (left), Balance (center), and Quality (right). Here is a comparison of them. + +![alt text](assets/improve_performance/image-2.png) + +## Rendering with EEVEE + +EEVEE doesn't render volume as well as Cycles, but it does have the advantage of rendering the volumetric data, and is even a better choice if you want to get a clear view of slice. And EEVEE's real-time rendering make it possible to create interactive stuff in Blender. diff --git a/docs/index.md b/docs/index.md index 7a49539..276600e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -[中文文档](https://uj6xfhbzp0.feishu.cn/wiki/Qx3VwHuNPimeI8kr6nDcvl1DnHf?from=from_copylink) +[中文文档](https://uj6xfhbzp0.feishu.cn/wiki/LPKEwjooSivxjskWHlCcQznjnNf?from=from_copylink) # Bioxel Nodes @@ -26,18 +26,18 @@ Welcome to our [discord server](https://discord.gg/pYkNyq2TjE), if you have any ## Support Multiple Formats -| Format | EXT | Test | -| ------ | ---------------------------------------- | ------- | -| DICOM | .dcm, .DCM, .DICOM, .ima, .IMA | ✅ pass | -| BMP | .bmp, .BMP | ✅ pass | -| JPEG | .jpg, .JPG, .jpeg, .JPEG | ✅ pass | -| PNG | .png, .PNG | ✅ pass | -| TIFF | .tif, .TIF, .tiff, .TIFF | ✅ pass | -| Nifti | .nia, .nii, .nii.gz, .hdr, .img, .img.gz | ✅ pass | -| Nrrd | .nrrd, .nhdr | ✅ pass | -| HDF5 | .hdf, .h4, .hdf4, .he2, .h5, .hdf5, .he5 | ✅ pass | -| OME | .ome.tiff, .ome.tif | ✅ pass | -| MRC | .mrc, .mrc.gz, .map, .map.gz | ✅ pass | +| Format | EXT | +| ------ | ---------------------------------------- | +| DICOM | .dcm, .DCM, .DICOM, .ima, .IMA | +| BMP | .bmp, .BMP | +| JPEG | .jpg, .JPG, .jpeg, .JPEG | +| PNG | .png, .PNG | +| TIFF | .tif, .TIF, .tiff, .TIFF | +| Nifti | .nia, .nii, .nii.gz, .hdr, .img, .img.gz | +| Nrrd | .nrrd, .nhdr | +| HDF5 | .hdf, .h4, .hdf4, .he2, .h5, .hdf5, .he5 | +| OME | .ome.tiff, .ome.tif | +| MRC | .mrc, .mrc.gz, .map, .map.gz | ## Support 4D volumetric data @@ -59,16 +59,6 @@ Welcome to our [discord server](https://discord.gg/pYkNyq2TjE), if you have any - Only works with Cycles CPU , Cycles GPU (OptiX), EEVEE - Section surface cannot be generated when convert to mesh (will be supported soon) -## Compatible to Newer Version - -**v0.3.x is not compatible to v0.2.x, Updating this addon may break old files. Read the following carefully before upgradation** - -Before upgradation, you need to ask yourself whether this project file will be modified again or not, if it's an archived project file, I would recommend that you run **Bioxel Nodes > Save Staged Data** to make the addon nodes permanent. In this way, there will be no potential problem with the nodes not functioning due to the addon update. - -After the addon update, your old project files may not work either, this may be because you had executed **Save Staged Data**. If so, you need to execute **Bioxel Nodes > Relink Nodes to Addon** to relink them to make sure that the addon's new functionality and the addon nodes are synchronized. - -Also, the older shaders are not based on OSL, so if you find that you can't render volumes, you need to turn on **Open Shading Language (OSL)** in the Render Settings. - ## Roadmap - Better multi-format import experience diff --git a/docs/installation.md b/docs/installation.md index 9d023b2..3b7d645 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,27 +1,19 @@ # Installation -> **Currently only support Blender 4.1 or above, make sure you have the correct version of Blender.** +**Currently only support Blender 4.2 or above, make sure you have the correct version of Blender.** -## For Blender 4.2 or higher +## Install in Blender (recommended) -The most recommended way is to open **Edit > Preferences > Extension**, enter "bio" in the search box and click **Install**. since the addon is quite large (20MB) you may need to wait a while! +This is the most recommended way, in the top menu, click **Edit > Preferences**, in "Get Extensions" Section, enter "bio" in the search box, then click Install. due to the add-on size (25MB~50MB) you may need to wait a while. -![extension](assets/installation_extension.png) +![alt text](assets/installation/image.png) -Thats it! +## Blender Official Extensions Website -> If it cannot be enable, reboot blender or install again as administrator +Or you can visit the Blender official extensions website at [https://extensions.blender.org/add-ons/bioxelnodes/](https://extensions.blender.org/add-ons/bioxelnodes/) +Click Get Add-on, open Blender, drag in Blender and follow the instructions to install. -Also, you can do it maually. Download the **Extension** version `BioxelNodes_Extension_{version}.zip` from https://github.com/OmooLab/BioxelNodes/releases/latest -In Blender, **Edit > Preferences > Extensions > Install from Disk**, select the zip file you just downloaded. +## Manual Install -## For Blender 4.1 - -Download the **Addon** version `BioxelNodes_Addon_{version}.zip` from https://github.com/OmooLab/BioxelNodes/releases/latest -In Blender, Edit > Preferences > Add-ons > Install, select the zip file you just downloaded. - -The add-on requires a third-party python dependency called SimpleITK, click `Install SimpleITK` button below to install the dependency. After clicking, blender may get stuck, it is downloading and installing, just wait for a moment. After that, click `Reboot Blender` button. - -![dependency](assets/installation_dependency.png) - -This step may have failed due to network factors, just click "Set PyPI Mirror" to change the mirror. +You can also install _BioxelNodes\_{version}.zip_ manually by downloading from [bere](https://github.com/OmooLab/BioxelNodes/releases/latest). +In the top menu, click **Edit > Preferences**, **Add-ons > Install from Disk** and select the Zip file you just downloaded. diff --git a/docs/intergration.md b/docs/intergration.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/mask.md b/docs/mask.md deleted file mode 100644 index c723f85..0000000 --- a/docs/mask.md +++ /dev/null @@ -1 +0,0 @@ -This type of node is responsible for culling out the extent of the component that does not need to be rendered, forming the interface between the object and the object, or the surface of the object (i.e., the interface between the object and the air) diff --git a/docs/nodes.md b/docs/nodes.md deleted file mode 100644 index cc54ab0..0000000 --- a/docs/nodes.md +++ /dev/null @@ -1,350 +0,0 @@ -# Nodes - -## Mask Methods - -### ⬆️ Mask by Threshold - -