VMplotvoxels

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - VM/Voxels
Introduced first in SolidGeometry 5.2, Creation date: 2022-05-19, Last change: 2025-09-15

plots a voxel model as transperent cubes

Description

there is no handle to the graphics object because of speed reasons
very slow function since Matlab doe simulates a volume renderer by a surface rendering

See Also: VLplotvoxel

Example Illustration

 missing image of VMplotvoxels(VM,vs,c,ea)

Syntax

VMplotvoxels(VM,[vs,c,ea])

Input Parameter

VM: Voxel Model
vs: size of voxels; default is [1 1 1]
c: color default is 'k'
ea: edge alpha value; default is 0.5

Examples


I=zeros(10,10,10); I(4:6,4:6,3:8)=1;
VMplotvoxels(I,[1 1 1],'r',1)


[VM,vs]=VMreaddicomdir('/Volumes/LUETH-WIN/WIN AIM Matlab Libraries/SolidGeometry-Code/AIM_DICOMFILES/');
[VN,ns]=VMresize(VM,[0.1 0.1 0.1],vs);




Copyright 2022-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, VMplotvoxels, is designed to plot a voxel model as transparent cubes. It is part of the SolidGeometry library and was introduced in version 5.2. The function does not return a handle to the graphics object for speed reasons.

Input Parameters

Algorithm Steps

  1. The function begins by retrieving the optional parameters using the getfuncparams function. It assigns default values if the parameters are not provided:
    • vs is set to [1 1 1] if not specified.
    • c is set to 'r' (red) if not specified.
    • ea is set to 0.5 if not specified.
  2. The size of the voxel model VM is determined using the size function, which returns the dimensions of the matrix.
  3. A mesh grid VL is created using the VLmeshgrid function. This grid is scaled by the voxel size vs and spans the dimensions of the voxel model VM.
  4. A new figure is created using the SGfigure function, with a specified range of -30 to 30.
  5. The voxel model VM is reshaped into a column vector VML to match the size of the mesh grid VL.
  6. The VLplotvoxel function is called to plot the voxels. It takes the mesh grid VL, voxel size vs, color c, reshaped voxel model VML, and edge alpha ea as inputs.
Algorithm explaination created using ChatGPT on 2025-08-19 00:17. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21