zixinyang9109 / LiverMatch

Learning Feature Descriptors for Pre- and Intra-operative Point Cloud Matching for Laparoscopic Liver Registration
MIT License
10 stars 1 forks source link

Deformation Simulation Input Format #2

Closed AhmedAyman1 closed 10 months ago

AhmedAyman1 commented 10 months ago

Hello,

The V2S-net pipeline takes .stl files as input. However, the 3D-IRCADb-01 dataset is in .vtk format. What have you used to make the conversion? or am I missing something? :)

Thanks

YueDai0514 commented 10 months ago

Hi,Are you also replicating this work? I also have some questions about data set generation, can you share with me

AhmedAyman1 commented 10 months ago

Hi,

Yes, I am trying to reproduce the results and later test my data. Happily, I can share with you what I have understood so far. I think we should use the V2S-NET on the dataset to apply deformation. I have already downloaded the 3D-IRCADb-01 dataset and extracted only the liver mesh files in the .vtk. I excluded data numbers 11, 18, 19, and 20 from the dataset, as explained in the paper. Now, I am trying to apply deformation to the meshes using VS2-NET. The V2S-NET should be able to skip unnecessary steps with .stl files if you already have the .vtk meshes, which is our case. It will just require you to place the .vtk files in directories where V2S-NET normally stores the files from previous steps. Or you can modify the generate.py script to match your directories. I have not done it yet myself, but hopefully everything will work.

zixinyang9109 commented 10 months ago

Hello, I used the VTK python library to do this format transformation. Other libraries like meshio and pyvista can do this too.

zixinyang9109 commented 10 months ago

For using VTK:

mesh_file = "" reader = vtkSTLReader() reader.SetFileName(mesh_file) reader.Update() mesh = reader.GetOutput() mesh = unstructuredGridToPolyData(mesh) surface = extractSurface(mesh)

plyWriter = vtkPLYWriter() plyWriter.SetFileTypeToASCII() plyWriter.SetColorModeToOff() plyWriter.SetInputData(surface) out_file = mesh_file.replace("vtk", "ply") plyWriter.SetFileName(out_file) plyWriter.Write()

YueDai0514 commented 7 months ago

Hello

Yes, I'm trying to reproduce the results and then test my data. It's a pleasure that I can share with you what I understand so far. I think we should use V2S-NET on the dataset to apply the morph. I've downloaded the 3D-IRCADb-01 dataset and only extracted the liver grid file in the .vtk. I excluded data numbers 11, 18, 19, and 20 from the dataset, as described in the paper. Right now, I'm trying to deform the mesh using VS2-NET. If you already have a .vtk grid, V2S-NET should be able to skip unnecessary steps for .stl files, and that's our case. It only requires you to place the .vtk file in the directory where V2S-NET usually stores the files from the previous steps. Alternatively, you can modify the generate.py script to match your directory. I haven't done it myself, but hopefully everything will be fine.

Hi, have you generated your own deformation data, when I run the generated data it fails, I'd like to ask if it's something to do with libraries such as mathutils vs. bpy, and I'd like to ask you how you handle adding blender as a python extension to the conda environment?

AhmedAyman1 commented 7 months ago

Hello,

That was a long time ago. But I remember struggling a little bit to make everything right. Here are some of the relavent packages I used to get the results with versions.

gmsh 4.11.1
hdf5 1.10.6
matplotlib 3.0.3
numpy 1.18.5
pcl 0.0.0.post1
python 3.5.6
python-dateutil 2.8.2
pyyaml 5.3.1
tk 8.6.12
vtk 8.1.2
zlib 1.2.13

I installed bpy using snap version 2.79b.

Best of luck!

YueDai0514 commented 7 months ago

Hello,

That was a long time ago. But I remember struggling a little bit to make everything right. Here are some of the relavent packages I used to get the results with versions.

gmsh 4.11.1 hdf5 1.10.6 matplotlib 3.0.3 numpy 1.18.5 pcl 0.0.0.post1 python 3.5.6 python-dateutil 2.8.2 pyyaml 5.3.1 tk 8.6.12 vtk 8.1.2 zlib 1.2.13

I installed bpy using snap version 2.79b.

Best of luck!

Thank you very much for your help and reply. I installed the binary versions of blender and gmsh, and created the virtual environment under conda, but I still can't show the import of bpy, mathutils, bmesh and other libraries in the IDE, how do you deal with it? I can't seem to find similar tutorials and documentation online, are these libraries downloaded separately, but there are many errors when I install with pip.

AhmedAyman1 commented 7 months ago

The package versions I have sent you should work. So I advise you to install the same versions exactly normally using pip and start with python.

On Mon, Feb 19, 2024 at 3:52 PM daddj1 @.***> wrote:

Hello,

That was a long time ago. But I remember struggling a little bit to make everything right. Here are some of the relavent packages I used to get the results with versions.

gmsh 4.11.1 hdf5 1.10.6 matplotlib 3.0.3 numpy 1.18.5 pcl 0.0.0.post1 python 3.5.6 python-dateutil 2.8.2 pyyaml 5.3.1 tk 8.6.12 vtk 8.1.2 zlib 1.2.13

I installed bpy using snap version 2.79b.

Best of luck!

Thank you very much for your help and reply. I installed the binary versions of blender and gmsh, and created the virtual environment under conda, but I still can't show the import of bpy, mathutils, bmesh and other libraries in the IDE, how do you deal with it? I can't seem to find similar tutorials and documentation online, are these libraries downloaded separately, but there are many errors when I install with pip.

— Reply to this email directly, view it on GitHub https://github.com/zixinyang9109/LiverMatch/issues/2#issuecomment-1952614739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJB3ZSKDDZDFR6RKQEYFR7LYUNRLXAVCNFSM6AAAAABACPKYLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSGYYTINZTHE . You are receiving this because you authored the thread.Message ID: @.***>

YueDai0514 commented 7 months ago

The package versions I have sent you should work. So I advise you to install the same versions exactly normally using pip and start with python.

Thank you very much for your help, I have solved the above confusion, it was my problem, I should have gone through the code first instead of obsessing about configuring the environment.