VLofVM

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - VM/Voxels
Introduced first in SolidGeometry 2.1, Creation date: 2015-01-14, Last change: 2025-09-14

returns the voxel coordinates as point list (can be long)

Description


VL=VLofVM(V>0.5); returns all voxel coordinates of V(:,:,:)>0.5
I=V(V>0.5); contains all voxel intensities for the VL
VL=VLofVM(V>0.5,[0.4 0.4 1]) returns all cartesian coordinates using vs


See Also: VLplot , VLscatter , VLofimage , VMofVL

Example Illustration

 missing image of VLofVM(VM,vs)

Syntax

VL=VLofVM(VM,[vs])

Input Parameter

VM: Voxel model (mxmxn) or image stack
vs: optional voxel size

Output Parameter

VL: Vertex list

Examples

VL=VLofVM(V(:,:,64)>1400); VLplot(VL,'m.')
[VL,EL,FL]=VLofimage(:,:,64)>1200, 1 , 2);

[VL,C]=VLofVM(V(:,:,1:10)>1400); C=V(V(:,:,1:10)>1400);




Copyright 2015-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, VLofVM, is designed to extract voxel coordinates from a 3D voxel model or image stack. It can also convert these coordinates into Cartesian coordinates if a voxel size is provided.

Input Parameters

Output Results

Algorithm Steps

  1. Use the find function to locate non-zero elements in the voxel model VM. This returns row indices r and column indices c.
  2. Determine the number of columns n in VM.
  3. Calculate the z-coordinates by dividing the column indices c by n and taking the ceiling of the result.
  4. Adjust the column indices c using the modulus operation to ensure they are within the correct range.
  5. Construct the vertex list VL using the row, column, and z-coordinates.
  6. If a voxel size vs is provided, convert the voxel coordinates to Cartesian coordinates by scaling each dimension accordingly.
  7. Extract the voxel intensities C from VM using the indices of non-zero elements.
  8. If no output arguments are specified, plot the vertex list using VLplot with specific visualization settings.
Algorithm explaination created using ChatGPT on 2025-08-19 01:29. (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