vedo.visual
runtime
CommonVisual
Class to manage the visual aspects common to all objects.
Source code in vedo/visual/runtime.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
LUT
property
writable
Return the lookup table of the object as a numpy object.
add_observer(event_name, func, priority=0)
Add a callback function that will be called when an event occurs.
Source code in vedo/visual/runtime.py
120 121 122 123 124 | |
add_scalarbar(title='', pos=(), size=(80, 400), font_size=14, title_yoffset=15, nlabels=None, c=None, horizontal=False, use_alpha=True, label_format=':6.3g')
Add a 2D scalar bar for the specified object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
scalar bar title |
''
|
pos
|
list
|
position coordinates of the bottom left corner. Can also be a pair of (x,y) values in the range [0,1] to indicate the position of the bottom left and top right corners. |
()
|
size
|
(float, float)
|
size of the scalarbar in number of pixels (width, height) |
(80, 400)
|
font_size
|
float
|
size of font for title and numeric labels |
14
|
title_yoffset
|
float
|
vertical space offset between title and color scalarbar |
15
|
nlabels
|
int
|
number of numeric labels |
None
|
c
|
list
|
color of the scalar bar text |
None
|
horizontal
|
bool
|
lay the scalarbar horizontally |
False
|
use_alpha
|
bool
|
render transparency in the color bar itself |
True
|
label_format
|
str
|
c-style format string for numeric labels |
':6.3g'
|
Examples:
Source code in vedo/visual/runtime.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
add_scalarbar3d(title='', pos=None, size=(0, 0), title_font='', title_xoffset=-1.2, title_yoffset=0.0, title_size=1.5, title_rotation=0.0, nlabels=9, label_font='', label_size=1, label_offset=0.375, label_rotation=0, label_format='', italic=0, c=None, draw_box=True, above_text=None, below_text=None, nan_text='NaN', categories=None)
Associate a 3D scalar bar to the object and add it to the scene. The new scalarbar object (Assembly) will be accessible as obj.scalarbar
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
list
|
(thickness, length) of scalarbar |
(0, 0)
|
title
|
str
|
scalar bar title |
''
|
title_xoffset
|
float
|
horizontal space btw title and color scalarbar |
-1.2
|
title_yoffset
|
float
|
vertical space offset |
0.0
|
title_size
|
float
|
size of title wrt numeric labels |
1.5
|
title_rotation
|
float
|
title rotation in degrees |
0.0
|
nlabels
|
int
|
number of numeric labels |
9
|
label_font
|
str
|
font type for labels |
''
|
label_size
|
float
|
label scale factor |
1
|
label_offset
|
float
|
space btw numeric labels and scale |
0.375
|
label_rotation
|
float
|
label rotation in degrees |
0
|
label_format
|
str
|
label format for floats and integers (e.g. |
''
|
draw_box
|
bool
|
draw a box around the colorbar |
True
|
categories
|
list
|
make a categorical scalarbar,
the input list will have the format |
None
|
Examples:
Source code in vedo/visual/runtime.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
alpha(alpha, vmin=None, vmax=None)
Assign a set of tranparencies along the range of the scalar value. A single constant value can also be assigned.
E.g.: say alpha=(0.0, 0.3, 0.9, 1) and the scalar range goes from -10 to 150.
Then all cells with a value close to -10 will be completely transparent, cells at 1/4
of the range will get an alpha equal to 0.3 and voxels with value close to 150
will be completely opaque.
As a second option one can set explicit (x, alpha_x) pairs to define the transfer function.
E.g.: say alpha=[(-5, 0), (35, 0.4) (123,0.9)] and the scalar range goes from -10 to 150.
Then all cells below -5 will be completely transparent, cells with a scalar value of 35
will get an opacity of 40% and above 123 alpha is set to 90%.
Source code in vedo/visual/runtime.py
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
color(col, alpha=None, vmin=None, vmax=None)
Assign a color or a set of colors along the range of the scalar value.
A single constant color can also be assigned.
Any matplotlib color map name is also accepted, e.g. volume.color('jet').
E.g.: say that your cells scalar runs from -3 to 6, and you want -3 to show red and 1.5 violet and 6 green, then just set:
volume.color(['red', 'violet', 'green'])
You can also assign a specific color to a aspecific value with eg.:
volume.color([(0,'red'), (0.5,'violet'), (1,'green')])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
list
|
use a list to specify transparencies along the scalar range |
None
|
vmin
|
float
|
force the min of the scalar range to be this value |
None
|
vmax
|
float
|
force the max of the scalar range to be this value |
None
|
Source code in vedo/visual/runtime.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
draggable(value=None)
Set/get the draggability property of an object.
Source code in vedo/visual/runtime.py
211 212 213 214 215 216 | |
invoke_event(event_name)
Invoke an event.
Source code in vedo/visual/runtime.py
126 127 128 129 130 | |
off()
Switch off object visibility. Object is not removed.
Source code in vedo/visual/runtime.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
on()
Switch on object visibility. Object is not removed.
Source code in vedo/visual/runtime.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
pickable(value=None)
Set/get the pickability property of an object.
Source code in vedo/visual/runtime.py
196 197 198 199 200 201 | |
print()
Print object info.
Source code in vedo/visual/runtime.py
69 70 71 72 | |
scalar_range(vmin=None, vmax=None)
Set the range of the scalar value for visualization.
Source code in vedo/visual/runtime.py
111 112 113 114 115 116 117 118 | |
show(**options)
Create on the fly an instance of class Plotter or use the last existing one to
show one single object.
This method is meant as a shortcut. If more than one object needs to be visualised
please use the syntax show(mesh1, mesh2, volume, ..., options).
Returns the Plotter class instance.
Source code in vedo/visual/runtime.py
139 140 141 142 143 144 145 146 147 148 149 | |
thumbnail(zoom=1.25, size=(200, 200), bg='white', azimuth=0, elevation=0, axes=False)
Build a thumbnail of the object and return it as an array.
Source code in vedo/visual/runtime.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
toggle()
Toggle object visibility on/off.
Source code in vedo/visual/runtime.py
254 255 256 257 258 259 260 261 | |
use_bounds(value=True)
Instruct the current camera to either take into account or ignore the object bounds when resetting.
Source code in vedo/visual/runtime.py
203 204 205 206 207 208 209 | |
PointsVisual
Bases: PointsVisualEffectsMixin, PointsVisualAnnotationsMixin, CommonVisual
Class to manage the visual aspects of a Points object.
Source code in vedo/visual/runtime.py
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | |
cellcolors
property
writable
Colorize each cell (face) of a mesh by passing a 1-to-1 list of colors in format [R,G,B] or [R,G,B,A]. Colors levels and opacities must be in the range [0,255].
A single constant color can also be passed as string or RGBA.
A cell array named "CellsRGBA" is automatically created.
Examples:

pointcolors
property
writable
Colorize each point (or vertex of a mesh) by passing a 1-to-1 list of colors in format [R,G,B] or [R,G,B,A]. Colors levels and opacities must be in the range [0,255].
A single constant color can also be passed as string or RGBA.
A point array named "PointsRGBA" is automatically created.
alpha(opacity=None)
Set/get mesh's transparency. Same as mesh.opacity().
Source code in vedo/visual/runtime.py
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | |
c(color=False, alpha=None)
Shortcut for color().
If None is passed as input, will use colors from current active scalars.
Source code in vedo/visual/runtime.py
1040 1041 1042 1043 1044 1045 | |
clone2d(size=None, offset=(), scale=None)
Turn a 3D Points or Mesh into a flat 2D actor.
Returns a Actor2D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
float
|
size as scaling factor for the 2D actor |
None
|
offset
|
list
|
2D (x, y) position of the actor in the range [-1, 1] |
()
|
scale
|
float
|
Deprecated. Use |
None
|
Examples:
Source code in vedo/visual/runtime.py
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | |
cmap(input_cmap, input_array=None, on='', name='Scalars', vmin=None, vmax=None, n_colors=256, alpha=1.0, logscale=False)
Set individual point/cell colors by providing a list of scalar values and a color map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_cmap
|
(str, list, vtkLookupTable, LinearSegmentedColormap)
|
color map scheme to transform a real number into a color. |
required |
input_array
|
(str, list, vtkArray)
|
can be the string name of an existing array, a new array or a |
None
|
on
|
str
|
either 'points' or 'cells' or blank (automatic). Apply the color map to data which is defined on either points or cells. |
''
|
name
|
str
|
give a name to the provided array (if input_array is an array) |
'Scalars'
|
vmin
|
float
|
clip scalars to this minimum value |
None
|
vmax
|
float
|
clip scalars to this maximum value |
None
|
n_colors
|
int
|
number of distinct colors to be used in colormap table. |
256
|
alpha
|
(float, list)
|
Mesh transparency. Can be a |
1.0
|
logscale
|
bool
|
Use logscale |
False
|
Examples:
- mesh_coloring.py
- mesh_alphas.py
- mesh_custom.py
-
(and many others)

Source code in vedo/visual/runtime.py
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | |
color(c=False, alpha=None)
Set/get mesh's color. Call with no argument to get the current color.
Pass None to disable a fixed color and use the active scalar array instead.
Same as mesh.c().
Source code in vedo/visual/runtime.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
copy_properties_from(source, deep=True, actor_related=True)
Copy properties from another Points object.
Source code in vedo/visual/runtime.py
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
force_opaque(value=True)
Force the Mesh, Line or point cloud to be treated as opaque
Source code in vedo/visual/runtime.py
1078 1079 1080 1081 1082 1083 | |
force_translucent(value=True)
Force the Mesh, Line or point cloud to be treated as translucent
Source code in vedo/visual/runtime.py
1085 1086 1087 1088 | |
lighting(style='', ambient=None, diffuse=None, specular=None, specular_power=None, specular_color=None, metallicity=None, roughness=None)
Set the ambient, diffuse, specular and specular_power lighting constants.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
str
|
preset style, options are |
''
|
ambient
|
float
|
ambient fraction of emission [0-1] |
None
|
diffuse
|
float
|
emission of diffused light in fraction [0-1] |
None
|
specular
|
float
|
fraction of reflected light [0-1] |
None
|
specular_power
|
float
|
precision of reflection [1-100] |
None
|
specular_color
|
color
|
color that is being reflected by the surface |
None
|

Examples:
Source code in vedo/visual/runtime.py
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | |
lut_color_at(value)
Return the color and alpha in the lookup table at given value.
Source code in vedo/visual/runtime.py
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | |
opacity(alpha=None)
Set/get mesh's transparency. Same as mesh.alpha().
Source code in vedo/visual/runtime.py
1074 1075 1076 | |
point_blurring(r=1, alpha=1.0, emissive=False)
Set point blurring.
Apply a gaussian convolution filter to the points.
In this case the radius r is in absolute units of the mesh coordinates.
With emissive set, the halo of point becomes light-emissive.
Source code in vedo/visual/runtime.py
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | |
point_size(value=None)
Set/get mesh's point size of vertices. Same as mesh.ps()
Source code in vedo/visual/runtime.py
1090 1091 1092 1093 1094 1095 1096 1097 1098 | |
ps(pointsize=None)
Set/get mesh's point size of vertices. Same as mesh.point_size()
Source code in vedo/visual/runtime.py
1100 1101 1102 | |
render_points_as_spheres(value=True)
Make points look spheric or else make them look as squares.
Source code in vedo/visual/runtime.py
1104 1105 1106 1107 | |
VolumeVisual
Bases: CommonVisual
Class to manage the visual aspects of a Volume object.
Source code in vedo/visual/runtime.py
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 | |
alpha_gradient(alpha_grad, vmin=None, vmax=None)
Assign a set of tranparencies to a volume's gradient along the range of the scalar value. A single constant value can also be assigned. The gradient function is used to decrease the opacity in the "flat" regions of the volume while maintaining the opacity at the boundaries between material types. The gradient is measured as the amount by which the intensity changes over unit distance.
The format for alpha_grad is the same as for method volume.alpha().
Source code in vedo/visual/runtime.py
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | |
alpha_unit(u=None)
Defines light attenuation per unit length. Default is 1. The larger the unit length, the further light has to travel to attenuate the same amount.
E.g., if you set the unit distance to 0, you will get full opacity. It means that when light travels 0 distance it's already attenuated a finite amount. Thus, any finite distance should attenuate all light. The larger you make the unit distance, the more transparent the rendering becomes.
Source code in vedo/visual/runtime.py
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 | |
cmap(c, alpha=None, vmin=None, vmax=None)
Same as color().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
list
|
use a list to specify transparencies along the scalar range |
None
|
vmin
|
float
|
force the min of the scalar range to be this value |
None
|
vmax
|
float
|
force the max of the scalar range to be this value |
None
|
Source code in vedo/visual/runtime.py
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 | |
hide_voxels(ids)
Hide voxels (cells) from visualization.
Examples:
from vedo import *
embryo = Volume(dataurl+'embryo.tif')
embryo.hide_voxels(list(range(400000)))
show(embryo, axes=1).close()
See also
volume.mask()
Source code in vedo/visual/runtime.py
1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | |
interpolation(itype)
Set interpolation type.
0=nearest neighbour, 1=linear
Source code in vedo/visual/runtime.py
1942 1943 1944 1945 1946 1947 1948 1949 | |
jittering(status=None)
If True, each ray traversal direction will be perturbed slightly
using a noise-texture to get rid of wood-grain effects.
Source code in vedo/visual/runtime.py
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 | |
mask(data)
Mask a volume visualization with a binary value.
Needs to specify volume.mapper = "gpu".
Examples:
from vedo import np, Volume, show
data_matrix = np.zeros([75, 75, 75], dtype=np.uint8)
# all voxels have value zero except:
data_matrix[ 0:35, 0:35, 0:35] = 1
data_matrix[35:55, 35:55, 35:55] = 2
data_matrix[55:74, 55:74, 55:74] = 3
vol = Volume(data_matrix).cmap('Blues')
vol.mapper = "gpu"
data_mask = np.zeros_like(data_matrix)
data_mask[10:65, 10:60, 20:70] = 1
vol.mask(data_mask)
show(vol, axes=1).close()
volume.hide_voxels()
Source code in vedo/visual/runtime.py
1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 | |
mode(mode=None)
Define the volumetric rendering mode following this
- 0, composite rendering
- 1, maximum projection rendering
- 2, minimum projection rendering
- 3, average projection rendering
- 4, additive mode
The default mode is "composite" where the scalar values are sampled through the volume and composited in a front-to-back scheme through alpha blending. The final color and opacity is determined using the color and opacity transfer functions specified in alpha keyword.
Maximum and minimum intensity blend modes use the maximum and minimum scalar values, respectively, along the sampling ray. The final color and opacity is determined by passing the resultant value through the color and opacity transfer functions.
Additive blend mode accumulates scalar values by passing each value through the opacity transfer function and then adding up the product of the value and its opacity. In other words, the scalar values are scaled using the opacity transfer function and summed to derive the final color. Note that the resulting image is always grayscale i.e. aggregated values are not passed through the color transfer function. This is because the final value is a derived value and not a real data value along the sampling ray.
Average intensity blend mode works similar to the additive blend mode where the scalar values are multiplied by opacity calculated from the opacity transfer function and then added. The additional step here is to divide the sum by the number of samples taken through the volume. As is the case with the additive intensity projection, the final image will always be grayscale i.e. the aggregated values are not passed through the color transfer function.
Source code in vedo/visual/runtime.py
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 | |
shade(status=None)
Set/Get the shading of a Volume.
Shading can be further controlled with volume.lighting() method.
If shading is turned on, the mapper may perform shading calculations. In some cases shading does not apply (for example, in maximum intensity projection mode).
Source code in vedo/visual/runtime.py
1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | |
MeshVisual
Bases: MeshVisualTextureMixin, PointsVisual
Class to manage the visual aspects of a Mesh object.
Source code in vedo/visual/runtime.py
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 | |
backcolor(bc=None)
Set/get mesh's backface color.
Source code in vedo/visual/runtime.py
1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 | |
backface_culling(value=True)
Set culling of polygons based on orientation of normal with respect to camera.
Source code in vedo/visual/runtime.py
1641 1642 1643 1644 | |
bc(backcolor=False)
Shortcut for mesh.backcolor().
Source code in vedo/visual/runtime.py
1679 1680 1681 | |
flat()
Set surface interpolation to flat.

Source code in vedo/visual/runtime.py
1628 1629 1630 1631 1632 1633 1634 | |
follow_camera(camera=None, origin=None)
Return an object that will follow camera movements and stay locked to it.
Use mesh.follow_camera(False) to disable it.
A vtkCamera object can also be passed.
Source code in vedo/visual/runtime.py
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 | |
frontface_culling(value=True)
Set culling of polygons based on orientation of normal with respect to camera.
Source code in vedo/visual/runtime.py
1651 1652 1653 1654 | |
lc(linecolor=None)
Set/get color of mesh edges. Same as linecolor().
Source code in vedo/visual/runtime.py
1708 1709 1710 | |
linecolor(lc=None)
Set/get color of mesh edges. Same as lc().
Source code in vedo/visual/runtime.py
1700 1701 1702 1703 1704 1705 1706 | |
linewidth(lw=None)
Set/get width of mesh edges. Same as lw().
Source code in vedo/visual/runtime.py
1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 | |
lw(linewidth=None)
Set/get width of mesh edges. Same as linewidth().
Source code in vedo/visual/runtime.py
1696 1697 1698 | |
phong()
Set surface interpolation to "phong".
Source code in vedo/visual/runtime.py
1636 1637 1638 1639 | |
render_lines_as_tubes(value=True)
Wrap a fake tube around a simple line for visualization
Source code in vedo/visual/runtime.py
1646 1647 1648 1649 | |
wireframe(value=True)
Set mesh's representation as wireframe or solid surface.
Source code in vedo/visual/runtime.py
1620 1621 1622 1623 1624 1625 1626 | |
ImageVisual
Bases: CommonVisual, Actor3DHelper
Class to manage the visual aspects of a Image object.
Source code in vedo/visual/runtime.py
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | |
alpha(a=None)
Set/get image's transparency in the rendering scene.
Source code in vedo/visual/runtime.py
1968 1969 1970 1971 1972 1973 | |
level(value=None)
Get/Set the image color level (brightness) in the rendering scene.
Source code in vedo/visual/runtime.py
1975 1976 1977 1978 1979 1980 | |
memory_size()
Return the size in bytes of the object in memory.
Source code in vedo/visual/runtime.py
1960 1961 1962 | |
scalar_range()
Return the scalar range of the image.
Source code in vedo/visual/runtime.py
1964 1965 1966 | |
window(value=None)
Get/Set the image color window (contrast) in the rendering scene.
Source code in vedo/visual/runtime.py
1982 1983 1984 1985 1986 1987 | |
Actor2D
Bases: vtkActor2D
Wrapping of vtkActor2D class.
Source code in vedo/visual/runtime.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | |
mapper
property
writable
Get the internal vtkMapper.
add_observer(event_name, func, priority=0)
Add a callback function that will be called when an event occurs.
Source code in vedo/visual/runtime.py
738 739 740 741 742 | |
alpha(value=None)
Set/Get the object opacity.
Source code in vedo/visual/runtime.py
709 710 711 712 713 714 | |
c(value=False)
Set/Get the object color. Same as color().
Source code in vedo/visual/runtime.py
705 706 707 | |
color(value=False)
Set/Get the object color. Call with no argument to get the current color.
Source code in vedo/visual/runtime.py
698 699 700 701 702 703 | |
coordinate_system(value=None)
Set/get the coordinate system which this coordinate is defined in.
Source code in vedo/visual/runtime.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |
layer(value=None)
Set/Get the layer number in the overlay planes into which to render.
Source code in vedo/visual/runtime.py
625 626 627 628 629 630 | |
lw(line_width=None)
Set/Get the line width of the object. Same as line_width().
Source code in vedo/visual/runtime.py
723 724 725 726 727 728 | |
off()
Set object visibility.
Source code in vedo/visual/runtime.py
677 678 679 680 | |
on()
Set object visibility.
Source code in vedo/visual/runtime.py
672 673 674 675 | |
ontop(value=True)
Keep the object always on top of everything else.
Source code in vedo/visual/runtime.py
730 731 732 733 734 735 736 | |
pickable(value=True)
Set object pickability.
Source code in vedo/visual/runtime.py
693 694 695 696 | |
pos(px=None, py=None)
Set/Get the screen-coordinate position.
Source code in vedo/visual/runtime.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
ps(point_size=None)
Set/Get the point size of the object. Same as point_size().
Source code in vedo/visual/runtime.py
716 717 718 719 720 721 | |
set_position_coordinates(p1, p2)
Set the position coordinates.
Source code in vedo/visual/runtime.py
666 667 668 669 670 | |
toggle()
Toggle object visibility.
Source code in vedo/visual/runtime.py
682 683 684 685 | |
visibility(value=None)
Get/Set object visibility.
Source code in vedo/visual/runtime.py
687 688 689 690 691 | |
Actor3DHelper
Helper class for 3D actors.
Source code in vedo/visual/runtime.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | |
apply_transform(LT)
Apply a linear transformation to the actor.
Source code in vedo/visual/runtime.py
749 750 751 752 753 754 755 | |
bounds()
Get the object bounds.
Returns a list in format [xmin,xmax, ymin,ymax, zmin,zmax].
Source code in vedo/visual/runtime.py
849 850 851 852 853 854 | |
diagonal_size()
Get the diagonal size of the bounding box.
Source code in vedo/visual/runtime.py
881 882 883 884 | |
origin(point=None)
Set/get origin of object. Useful for defining pivoting point when rotating and/or scaling.
Source code in vedo/visual/runtime.py
783 784 785 786 787 788 789 790 791 | |
pos(x=None, y=None, z=None)
Set/Get object position.
Source code in vedo/visual/runtime.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | |
reorient(old_axis, new_axis, rotation=0, rad=False)
Rotate object to a new orientation.
Source code in vedo/visual/runtime.py
837 838 839 840 841 842 843 844 845 846 847 | |
rotate_x(angle)
Rotate object around x axis.
Source code in vedo/visual/runtime.py
822 823 824 825 | |
rotate_y(angle)
Rotate object around y axis.
Source code in vedo/visual/runtime.py
827 828 829 830 | |
rotate_z(angle)
Rotate object around z axis.
Source code in vedo/visual/runtime.py
832 833 834 835 | |
scale(s, origin=True)
Multiply object size by s factor.
Source code in vedo/visual/runtime.py
793 794 795 796 | |
shift(dx, dy=0, dz=0)
Add a vector to the current object position.
Source code in vedo/visual/runtime.py
775 776 777 778 779 780 781 | |
x(val=None)
Set/Get object position along x axis.
Source code in vedo/visual/runtime.py
798 799 800 801 802 803 804 | |
xbounds(i=None)
Get the bounds [xmin,xmax]. Can specify upper or lower with i (0,1).
Source code in vedo/visual/runtime.py
856 857 858 859 860 861 | |
y(val=None)
Set/Get object position along y axis.
Source code in vedo/visual/runtime.py
806 807 808 809 810 811 812 | |
ybounds(i=None)
Get the bounds [ymin,ymax]. Can specify upper or lower with i (0,1).
Source code in vedo/visual/runtime.py
863 864 865 866 867 868 869 870 | |
z(val=None)
Set/Get object position along z axis.
Source code in vedo/visual/runtime.py
814 815 816 817 818 819 820 | |
zbounds(i=None)
Get the bounds [zmin,zmax]. Can specify upper or lower with i (0,1).
Source code in vedo/visual/runtime.py
872 873 874 875 876 877 878 879 | |
LightKit
A LightKit consists of three lights, a 'key light', a 'fill light', and a 'head light'.
The main light is the key light. It is usually positioned so that it appears like an overhead light (like the sun, or a ceiling light). It is generally positioned to shine down on the scene from about a 45 degree angle vertically and at least a little offset side to side. The key light usually at least about twice as bright as the total of all other lights in the scene to provide good modeling of object features.
The other lights in the kit (the fill light, headlight, and a pair of back lights) are weaker sources that provide extra illumination to fill in the spots that the key light misses. The fill light is usually positioned across from or opposite from the key light (though still on the same side of the object as the camera) in order to simulate diffuse reflections from other objects in the scene.
The headlight, always located at the position of the camera, reduces the contrast between areas lit by the key and fill light. The two back lights, one on the left of the object as seen from the observer and one on the right, fill on the high-contrast areas behind the object. To enforce the relationship between the different lights, the intensity of the fill, back and headlights are set as a ratio to the key light brightness. Thus, the brightness of all the lights in the scene can be changed by changing the key light intensity.
All lights are directional lights, infinitely far away with no falloff. Lights move with the camera.
For simplicity, the position of lights in the LightKit can only be specified using angles: the elevation (latitude) and azimuth (longitude) of each light with respect to the camera, in degrees. For example, a light at (elevation=0, azimuth=0) is located at the camera (a headlight). A light at (elevation=90, azimuth=0) is above the lookat point, shining down. Negative azimuth values move the lights clockwise as seen above, positive values counter-clockwise. So, a light at (elevation=45, azimuth=-20) is above and in front of the object and shining slightly from the left side.
LightKit limits the colors that can be assigned to any light to those of incandescent sources such as light bulbs and sunlight. It defines a special color spectrum called "warmth" from which light colors can be chosen, where 0 is cold blue, 0.5 is neutral white, and 1 is deep sunset red. Colors close to 0.5 are "cool whites" and "warm whites," respectively.
Since colors far from white on the warmth scale appear less bright, key-to-fill and key-to-headlight
ratios are skewed by key, fill, and headlight colors. If maintain_luminance is set, LightKit will
attempt to compensate for these perceptual differences by increasing the brightness of more saturated colors.
To specify the color of a light, positioning etc you can pass a dictionary with the following keys:
- intensity : (float) The intensity of the key light. Default is 1.
- ratio : (float) The ratio of the light intensity wrt key light.
- warmth : (float) The warmth of the light. Default is 0.5.
- elevation : (float) The elevation of the light in degrees.
- azimuth : (float) The azimuth of the light in degrees.
Examples:
from vedo import *
lightkit = LightKit(head={"warmth":0.6})
mesh = Mesh(dataurl+"bunny.obj")
plt = Plotter()
plt.remove_lights().add(mesh, lightkit)
plt.show().close()
Source code in vedo/visual/runtime.py
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 | |
update()
Update the LightKit properties.
Source code in vedo/visual/runtime.py
2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 | |
