# Troubleshooting one of the examples.

**URL:** https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396
**Category:** Support
**Created:** [October 11, 2020, 11:05pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396 "2020-10-11T23:05:12Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Evan\_M](https://discourse.vtk.org/user_avatar/discourse.vtk.org/evan_m/32/2445_2.png) [@Evan\_M](https://discourse.vtk.org/u/Evan_M)
#### Post date: [October 11, 2020, 11:05pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/1 "2020-10-11T23:05:12Z")

</div>

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](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](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

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e4b8bf33bb5c2b8dc3ca6bd5a70795ae2de61d5e.png)

* * *

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:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/bce3d623b5f0f7f093e7aebcd2404265471a20c3.png)  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e9988302e12319d5505ea3d2e727e48dfc0b5f36.png)  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/437b8a874ea3c74ce2b9d5af49488eee852df93c.png)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 12, 2020, 1:37am UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/2 "2020-10-12T01:37:01Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![Evan\_M](https://discourse.vtk.org/user_avatar/discourse.vtk.org/evan_m/32/2445_2.png) [@Evan\_M](https://discourse.vtk.org/u/Evan_M)
#### Post date: [October 12, 2020, 1:42am UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/3 "2020-10-12T01:42:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 12, 2020, 2:07am UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/4 "2020-10-12T02:07:01Z")

</div>

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](https://github.com/dgobbi/vtk-dicom/wiki/Command-Line-Tools) 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](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_load_DICOM_files_into_the_scene_from_a_folder)).

---

<div class="post-metadata">

### Author: ![Evan\_M](https://discourse.vtk.org/user_avatar/discourse.vtk.org/evan_m/32/2445_2.png) [@Evan\_M](https://discourse.vtk.org/u/Evan_M)
#### Post date: [October 12, 2020, 4:49pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/5 "2020-10-12T16:49:41Z")

</div>

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

```auto
#include <vtkDICOMImageReader.h>
...
  // This code has been copied in directly from the other example.
  vtkSmartPointer<vtkDICOMImageReader> readerIn =
      vtkSmartPointer<vtkDICOMImageReader>::New();
  readerIn->SetDirectoryName(folder.c_str());
  readerIn->Update();

```

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

 ![image](https://discourse.vtk.org/uploads/default/original/2X/1/1ff419b4c70e32f456c4d3591bf828c18b9985cc.png)

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:

![image](https://discourse.vtk.org/uploads/default/original/2X/1/1ee7439f75b9a02e8233409f7d2819528a62e302.png)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 12, 2020, 5:50pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/6 "2020-10-12T17:50:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Evan\_M](https://discourse.vtk.org/user_avatar/discourse.vtk.org/evan_m/32/2445_2.png) [@Evan\_M](https://discourse.vtk.org/u/Evan_M)
#### Post date: [October 12, 2020, 5:54pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/7 "2020-10-12T17:54:38Z")

</div>

> [@lassoan](#):
>
> Do you build your code by modifying an example in the VTK build tree?

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.

---

<div class="post-metadata">

### Author: ![mallikarjun49](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mallikarjun49](https://discourse.vtk.org/u/mallikarjun49)
#### Post date: [October 13, 2020, 6:52am UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/8 "2020-10-13T06:52:51Z")

</div>

Can you check **Linker-\>Input-\>Additional Dependencies** in your project properties to see whether the **vtkIOImage-8.2.lib** and v **tkInteractionImage-8.2.lib** are linked or not?

---

<div class="post-metadata">

### Author: ![Evan\_M](https://discourse.vtk.org/user_avatar/discourse.vtk.org/evan_m/32/2445_2.png) [@Evan\_M](https://discourse.vtk.org/u/Evan_M)
#### Post date: [October 13, 2020, 12:33pm UTC](https://discourse.vtk.org/t/troubleshooting-one-of-the-examples/4396/9 "2020-10-13T12:33:31Z")

</div>

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.
