Closed zyy13579 closed 1 year ago
It looks difficult to understand for me what is happening because I cannot see the axes units..
I would try to shift the mesh produced by isosurface()
by the desired amount (you can get the bounds of the volume with .bounds()
)
I mean the mesh convert by vedo,have a diffrent coordinate with the 3dslicer covert, image origin has been changed I try to use vtkjs show the mesh(by vedo convert),and draw some measureline, so I find coordinate is not right,the center of vedo have a offset compare by slicer obj_file.zip this is my obj file all_vessel.nii.gz this is my label file(volume file)
Uhm , I'm not sure why you get a different a shifted and rotated image in slicer3d, it looks correct here:
from vedo import *
vol = Volume("all_vessel.nii")
iso = vol.isosurface()
iso.write("iso.obj")
iso2 = Mesh("iso.obj") # read back
show(vol, iso, iso2, N=3, axes=1)
I think,when vedo load volume,the origin offset has been made. slicer obj is ras coordinate,vedo obj is ijk coordinate? so I try to change center of volume by this code,but failed
label_img = sitk.ReadImage(volume_path)
raw_origin = label_img.GetOrigin()
print(raw_origin)
print(label_img.GetSpacing())
print(label_img.GetSize())
vol = Volume(volume_path)
print(vol.origin())
print(vol.spacing())
print(vol.dimensions())
print(vol.center())
vol = vol.origin(raw_origin)
vol = vol.center([0,0,0])
print(vol.origin())
print(vol.center())
print(vol.origin())
thanks for drawing my attention to it... it should be now fixed in the master:
pip install -U git+https://github.com/marcomusy/vedo.git
then
import SimpleITK as sitk
from vedo import Volume, show
volume_path = 'data/all_vessel.nii'
print(" ----- SimpleITK")
label_img = sitk.ReadImage(volume_path)
raw_origin = label_img.GetOrigin()
print(label_img.GetOrigin())
print(label_img.GetSpacing())
print(label_img.GetSize())
print(" ----- vedo")
vol = Volume(volume_path)
vol.origin(raw_origin)
vol.print()
iso = vol.isosurface().print()
show(vol, iso, N=2, axes=1)
thanks a lot,great job!
I use vedo convert the nifti label volume to obj mesh,by this code
but,the coverted obj file center,is diffrent with 3DSlicer convert obj file
So I try to change the volume center,but I saw the code of fucntion center is this
the center paramter is not use. Is set center any problem?Thanks a lot