This requires Module_ITKVtkGlue to be turned on in ITK’s CMake configuration.
It is nice to build be able to prototype ITK/VTK in python without having to build from scratch.
I’m wondering if it’s possible to build a Python wheel with Module_ITKVtkGlue? Is it possible to do the same thing as is done with itk-bonemorphometry? What would be involved in this?
Complications: we need to build against VTK and use its libraries at runtime. But, I think we may be able to do this if we:
Use the conda clinicalgraphics vtk packages to provide a pre-built VTK.
Use weak linking on Linux and macOS when linking the VTK libraries. Then, make sure the VTK libraries have been loaded by calling import vtk when ITKVTKGlue gets imported. This could work around finding the VTK libraries at runtime.
Repackage the generated wheels in conda-forge like we do with itk.
We will have to watch out for compiler ABI incompatibilities, but we will give it a try. I will take at getting it started next week.
I hate to make work for you. Although my skills are limited, I will follow closely so I can contribute next time. If you have any tasks I can help with or feel like holding my hand, do not hesitate to let me know.
I will read through the docs in more detail this week.
Just to follow-up with current status, no action required yet; I have started the work on the module package here. Once ready I will move to the InsightSoftwareConsortium GitHub organization. Current progress:
If VTKGlue will have its own package, maybe its useful to add there a simple image viewer executable.
I have used this piece of code in the IsotropicWavelets module to visualize 2D, and 3D images for tests with just ITK and VTK.
The interface is simple, I run it with: runViewImage /path/image.tif
it also accepts an optional string for the title of window. Nothing fancy, but way faster and convenient (at least for me) than using ImageJ or any other external software. Maybe python users with the ITKVtkGlue module might find it useful for fast visualization.
You can see three of them (3D images) open with black background at the right of the attached screenshot.
That’s a great idea @phcerdan! I write my own visualizers in VTK. I have a pain dealing with image orientation alone which is why I appreciate the VTK/ITK glue.
Hi @Besler, not sure about orientation to be honest, I just remember having to flip the camera, because the origins in VTK and ITK are different. I am creating a github repository with just the viewer, so you can give it a go.
It is not an external module, so, you just download it, use cmake point to ITK (with ITKVTKGlue Module ON) and to VTK, and compile it. There are more detailed instructions in the repository. Let me know if you find time to test it!
@phcerdan That’s excellent! Yes, we could add a few more simple viewers to the module. There is already a simple 2D viewer called QuickView by @bill.lorensen. We could extend it or add a few more. And we could add Python wrapping for the classes.
@Besler, currently VTK does not support direction/orientation information for images, but there is interest in adding it from @cory.quammen@lassoan and others.
Adding orientation to VTK images would be sorely needed for all VTK-based medical imaging applications (it would make them simpler and faster), but VTK core developers are not much interested, so it’s completely up to the community to come up with a solution and get it accepted. See a summary of the problem and proposed approach to solve it: