Hello, I am just trying to get VTK up and running for the first time, so please forgive the simplicity of this question.
I have run all the instructions on this page --> https://vtk.org/Wiki/VTK/Building/Windows , and it seems to have correctly installed all the files into C:/Program Files (x86)/VTK/.
I am trying to run this example --> https://vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries, since I will eventually be needing to take in a stack of Dicom images and convert to a volume.
I’ve followed the steps at the bottom of the page, but after running cmake, there is no makefile, so I’m not sure how to run “make”. (In case there was an issue with C:/Program Files (x86)/VTK/ having spaces, I copied the installation into a different directory and tried again)
I’ve been troubleshooting for a couple of hours, so I figure this is the time to ask for help.
This is what I see in ReadDicomSeries/build after running cmake
EDIT: After some reading, I see that it created the .sln file in lieu of the makefile, but when building in Visual Studio, I only see two projects, and after building, neither one seems to have produced any binaries or executables:
If you just use existing VTK filters and not modify them then it may be easier to use VTK from Python. Installation is easy, you don’t need to build anything, and usage is simpler, too (memory management is trivial, no need to rebuild and restart if you change your code, easier to interface with other libraries, etc).
I will likely need to be changing the filters. But for now, is there an easy way to use Python to turn a stack of Dicom images into a VTK volume? I was looking and could not find an easy example.
VTK’s built-in DICOM support is quite poor, but @dgobbi’s vtkDICOM library is excellent. I could not quickly find Python examples, but there are C++ examples that can convert images.
Dcm2niix is a great conversion tool, too.
If you need DICOM segmentation object, RT structure set, structured reports, etc. support then you need to use higher-level tools, such as 3D Slicer (see Python example here).
I did manage to get it working. (I had to use the CMake GUI, for whatever reason it was not working from the command line). For the time being, I’m going to continue trying to get it working in C++, since I will likely need to modify the filters at that level.
However, now I’m having another problem. I’ve tried reading a Dicom folder into a different example, by adding
// This code has been copied in directly from the other example.
vtkSmartPointer<vtkDICOMImageReader> readerIn =
I’m getting linker errors. (It’s not just in this case, when I try to reference any classes in a new header, I’m getting linker errors as well)
The Include directories list seems to be pointed at the correct folder
And the linker’s “Additional Dependencies” path is identical between all the examples that I’ve looked at, so I don’t believe it is that either.
The linker errors are shown:
Do you build your code by modifying an example in the VTK build tree?
I would not recommend to use the vtkDICOMReader that is built into VTK. It has many serious limitations and issues. Use vtkDICOM library instead.
I did. I took one of the examples that writes a file and tried to see if I could load a Dicom and then write it. Even if that doesn’t work, I’m trying to figure out the general pipeline and workflow. But I’m not sure why I can’t load any other classes without getting linker errors, especially because the linker settings seem to be the same between examples.
Can you check Linker->Input->Additional Dependencies in your project properties to see whether the vtkIOImage-8.2.lib and vtkInteractionImage-8.2.lib are linked or not?
Great, that seems to have solved it. Is it documented somewhere which libraries need to be linked for a specific class? I just did a quick search, and I can’t find anything.