Skip to content

Commit 928b15c

Browse files
authored
Merge pull request #46 from OmooLab/feature/dev
fix: the as color button's text is incorrectly written as "as label"
2 parents 92f85ff + 487cea4 commit 928b15c

38 files changed

+241
-25
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:213a99f77511d03133780bb9056f39dd2bf57b75cf12810cc4957f6b74450abb
3-
size 9002987
2+
oid sha256:991e02177a1f2c9c6b3f83b016bacb38801381ae0c3e21fba60967e0d6a84073
3+
size 9143436

bioxelnodes/blender_manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
schema_version = "1.0.0"
22

33
id = "bioxelnodes"
4-
version = "1.0.2"
4+
version = "1.0.3"
55
name = "Bioxel Nodes"
66
tagline = "For scientific volumetric data visualization in Blender"
77
maintainer = "Ma Nan <[email protected]>"

bioxelnodes/constants.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22

3-
VERSIONS = [{"label": "Latest", "node_version": (1, 0, 2)},
3+
VERSIONS = [{"label": "Latest", "node_version": (1, 0, 3)},
44
{"label": "v0.3.x", "node_version": (0, 3, 3)},
55
{"label": "v0.2.x", "node_version": (0, 2, 9)}]
66

@@ -165,7 +165,13 @@
165165
'icon': 'PROP_CON',
166166
'name': 'ReCenter',
167167
'description': ''
168-
}
168+
},
169+
{
170+
'label': 'Extract Transform',
171+
'icon': 'EMPTY_AXIS',
172+
'name': 'ExtractTransform',
173+
'description': ''
174+
},
169175
]
170176
},
171177
{

bioxelnodes/operators/io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ class ImportAsLabel(bpy.types.Operator, ImportVolumetricData):
9696

9797
class ImportAsColor(bpy.types.Operator, ImportVolumetricData):
9898
bl_idname = "bioxelnodes.import_as_color"
99-
bl_label = "Import as Label"
100-
bl_description = "Import Volumetric Data to Container as Label"
99+
bl_label = "Import as Color"
100+
bl_description = "Import Volumetric Data to Container as Color"
101101
bl_icon = "EVENT_C"
102102
read_as = "COLOR"
103103

@@ -505,7 +505,7 @@ class ImportVolumetricDataDialog(bpy.types.Operator):
505505
label_count: bpy.props.IntProperty() # type: ignore
506506

507507
smooth: bpy.props.IntProperty(name="Smooth Size (Larger takes longer time)",
508-
default=3) # type: ignore
508+
default=0) # type: ignore
509509

510510
read_as: bpy.props.EnumProperty(name="Read as",
511511
default="SCALAR",
@@ -624,7 +624,7 @@ def progress_callback(frame, total):
624624
progress,
625625
progress_step)
626626
label_data = data == np.full_like(data, i+1)
627-
label_data = label_data.astype(np.float32)
627+
# label_data = label_data.astype(np.float32)
628628
try:
629629
layer = Layer(data=label_data,
630630
name=name_i,

bioxelnodes/operators/layer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ class FillOperator(OutputLayerOperator):
370370
def invoke(self, context, event):
371371
layer_obj = get_selected_layer(context)
372372
if layer_obj:
373-
scalar_min = get_layer_prop_value(layer_obj, "min")
374-
self.fill_value = min(scalar_min, 0)
375373
name = get_layer_label(layer_obj)
376374
context.window_manager.invoke_props_dialog(self,
377375
title=f"Fill {name}")

docs/SARS-Cov-2.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SARS-Cov-2
2+
3+
![alt text](assets/SARS-Cov-2/image.png)
4+
5+
![alt text](assets/SARS-Cov-2/image-1.png)
6+
7+
In this tutorial, we'll make a structural visualzation of the SARS-Cov-2 Virus. Please see [step by step](step_by_step.md) to make sure you have a basic understanding of how to use the addon, and make sure the addon version is v1.0.2 or higher!
8+
9+
Research data is from paper published in September 2020 in Cell Press ([https://www.cell.com/cell/fulltext/S0092-8674(20)31159-4](<https://www.cell.com/cell/fulltext/S0092-8674(20)31159-4>)) by Li Sai team at Tsinghua University. This research revealed the molecular assembly of the authentic SARS-CoV-2 virus using cryoelectron tomography (cryo-ET) and subtomogram averaging (STA). Here is an official video of this study
10+
11+
<iframe width="560" height="315" src="https://www.youtube.com/embed/JSKl5VY4k5w?si=t4LhrCRebxrX_Saf&amp;controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
12+
13+
"It remains enigmatic how coronaviruses pack the ∼30-kb RNA into the ∼80-nm-diameter viral lumen. Are the RNPs ordered relative to each other to avoid RNA entangling, knotting, or even damage or are they involved in virus assembly?" Three assembly classes were proposed in the paper, we will make a visualzation of the "eggs-in-a-nest"-shaped RNPs assembly, based on real cryo-ET data.
14+
15+
## Download and import data
16+
17+
The data of this research is hosted on EMDB ([https://www.ebi.ac.uk/emdb](https://www.ebi.ac.uk/emdb)), and the website of SARS-Cov-2 virus is [here](https://www.ebi.ac.uk/emdb/EMD-30430). Open the page, find "Download" button and select the first selection "3D Volume (.map.gz)".
18+
19+
In case you can't download data, you can download here.
20+
21+
[SARS-Cov-2.map](https://drive.google.com/file/d/1LMybsmTVbwQ38_eqAx6hbZTc5p2fdcjK/view?usp=sharing)
22+
23+
After downloading, put it into any directory and import the data. In the import options, it is recommended to adjust the Bioxel Size to 5, in order to reduce the shape of the data to increase the speed of calculation and rendering. If you are confident in the performance of your hardware, you can leave the original 2.72 unchanged. After adjusting the Bioxel Size, the shape of the converted data will be calculated below based on the current bioxel size. The amount of data will increase exponentially with larger shape, and may result in OOM (out of memory).
24+
25+
## Cutout the Virus
26+
27+
After importing, you can get the virus by creating and connecting nodes and setting parameters as shown below
28+
29+
![alt text](assets/SARS-Cov-2/image-2.png)
30+
31+
Place the light and the camera in the way as below. The backlight is a area light, color white, intensity 500W, spread 90°, and inside the virus, place a point light, color `FFD08D`, intensity 5W. Camera focal length is 200 mm. the background color is pure black. The Look of the color management is High Contrast.
32+
33+
![alt text](assets/SARS-Cov-2/image-3.png)
34+
35+
Continue editing the node, followed by "Set Properies" and "Set Color by Ramp 4" node, the parameters of these two nodes are set as shown in the figure, where the color part, from top to bottom, is set to `E1D0FC` (1.0), `FFE42D` (0.5), `3793FF` (0.5), `FFFF8EC` (0.1) (alpha value in parentheses). Color alpha also affects density.
36+
37+
![alt text](assets/SARS-Cov-2/image-4.png)
38+
39+
If you feel that rendering is too slow, see [here](improve_performance.md) for suggestions
40+
41+
## Color the RNPs alone
42+
43+
The current rendering is pretty good, but considering that my goal is to make it clear how the RNPs are arranged within the virus, the RNPs should be colored differently than the others. So how to color the RNPs alone?
44+
45+
First of all, we have to separate the RNPs. The value of RNPs is between the membrane and S protein, so it is very difficult to separate. The good thing is that the virus is spherical, we can separate the RNPs part of the virus from the rest by using a sphere cutter. To do so, in the Geometry Nodes panel menu of the container, click **Bioxel Nodes > Add a Cutter > Sphere Cutter**, and adjust the scale and position of the newly created sphere object named "Sphere_Cutter" appropriately, so that it can just separate the internal RNPs and membrane of the virus.
46+
47+
![alt text](assets/SARS-Cov-2/image-5.png)
48+
49+
The process of changing the position of the "Sphere_Cutter" object can be very laggy, then you can turn off "With Surface" and do it in Slice Viewer mode. Once you are happy with it, you can restore the settings.
50+
51+
Then we turn on Invert in the "Sphere Cutter" node and you can see the opposite result. This way we've managed to separate the two, next let's color them separately and finally merge them with Join Component. Create and join the nodes as shown below, where the second Cutter node is copied and the color value in Set Color is `FFDDFE` (0.5). If all is well, the rendering should look like below.
52+
53+
![alt text](assets/SARS-Cov-2/image-6.png)
54+
55+
At this point, the rendering of a SARS-Cov-2 virus is complete!
56+
57+
## Render RNPs and Membranes
58+
59+
Realistic rendering is great, but Non-photorealistic rendering (NPR) is better for presenting structural information. So I will render ultrastructure of the RNPs assembly with toon shader.
60+
61+
![alt text](assets/SARS-Cov-2/image-7.png)
62+
63+
The silhouettes of RNPs uses Blender's Line Art feature, but Line Art must be based on a mesh. Select the nodes that are extruding the RNPs (i.e., the "Cut" nodes that are in charge of cutting out the RNPs), and right-click, click **Bioxel Nodes > Extract Mesh**. This gives you a new mesh object of the RNPs.
64+
65+
Extract the membrane mesh in the same way.
66+
67+
The membrane has a much higher value than the rest of the virus, so let's create a new "Cutout" node, also after the ReCenter, but with the threshold adjusted to 0.13. After the Cutout, connect to the "To Surface" node and parameterize it as shown in the figure, noting that the Remove Island Threshold is set to 1000 so that any fragments smaller than 1000 pts be eliminated. Then select the "To Surface" node, and perform the operation of extracting the mesh.
68+
69+
![alt text](assets/SARS-Cov-2/image-8.png)
70+
71+
The mesh of the membrane needs to be cut in half, this can be done with the Box Trim brush in sculpt mode or with the Boolean modifier. the mesh of the RNPs may also need some repair work, I cleaned up some of the broken surfaces of the RNPs. all the meshes are now ready to be used.
72+
73+
![alt text](assets/SARS-Cov-2/image-9.png)
74+
75+
For Line Art, please see the video tutorial from Blender Secrets.
76+
77+
<iframe width="560" height="315" src="https://www.youtube.com/embed/aIWdBq7-ias?si=CrcStx5VVJBwDpzu&amp;controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
78+
79+
Finally, an infographic on the ultrastructure of RNPs is done!
80+
81+
![alt text](assets/SARS-Cov-2/image-1.png)
82+
83+
If you have trouble following the docs, you can download the project files.
84+
85+
[SARS-Cov-2.zip](https://drive.google.com/file/d/15GpIoIjVAE-Jr98zWo7oupuk1KfRVPmk/view?usp=sharing)
86+
87+
## Homework
88+
89+
Other data relevant to the study are provided in the paper, you could try visualizing them.
90+
91+
![alt text](assets/SARS-Cov-2/image-10.png)
92+
93+
Go to the official EMDB website https://www.ebi.ac.uk/emdb/ and enter the EMD number in the search box to get them.
94+
95+
The Electron Microscopy Data Bank (EMDB) is a public repository for cryogenic-sample Electron Microscopy (cryoEM) volumes and representative tomograms of macromolecular complexes and subcellular structures. If you want to get data on other virus, just enter their name in the search box. For example, hepatitis B virus, enter it into the search box, then select Virus in the Sample Type on the left side, and download the data you need (it is better to find the corresponding paper to clarify the data information).
96+
97+
**Try to visualize hepatitis B virus.**
98+
99+
![alt text](assets/SARS-Cov-2/image-11.png)

docs/advanced.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)