marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.05k stars 266 forks source link

Help ! Legosurface Error #1166

Closed sdhong01 closed 3 months ago

sdhong01 commented 4 months ago

My testing voxel value has 900 zeros and 100 fives. When I set (vmin=0, vmax=10), the legosurface show me reasonable result. However, when I set (vmin=1, vmax=10), error occurs as follows.


[vedo.visual:1340] ERROR: in cmap(), cannot find any CellData active array ...skip coloring. [vedo.visual:1340] ERROR: in cmap(), cannot find any CellData active array ...skip coloring. 2024-07-26 15:14:40.806 ( 0.442s) [ ]vtkDemandDrivenPipeline:754 ERR| vtkCompositeDataPipeline (000002045FEB2BA0): Input for connection index 0 on input port index 0 for algorithm vtkImageToPoints (000002045FEC15B0) is of type vtkPolyData, but a vtkImageData is required. [vedo.visual:1362] ERROR: in cmap(), nr. of input cells scalars 0 != 1 ...skip coloring.

the source code is as follows:

import numpy as np from vedo import show, Volume

nx = 11 ny = 11 nz = 11

C0 = np.zeros((nx, ny, nz)) C0[:, :, nz-1] = 5

vol = Volume(C0) vol.add_scalarbar3d()

lego = vol.legosurface(vmin=1, vmax=10) lego.cmap('jet', vmin=1, vmax=10).add_scalarbar3d()

show(lego, axes=True).close()


I only wanted to draw voxel with a value of 5.

marcomusy commented 3 months ago

Hi sorry for the late reply... try

lego = vol.legosurface(vmin=1, vmax=10, boundary=True)
sdhong01 commented 3 months ago

Wow. It is perfect !!

Thanks Marcomusy ~