VTK error: no override found for ‘vtkImageSliceMapper'

Dear all,

I am running an example in VTK and it is giving the following error:
vtkImageSliceMapper.cxx:36 WARN| Error: no override found for ‘vtkImageSliceMapper’.

1st I compiled in Windows the VTK
2nd I included the directory of the include files
3rd I copied all the dll to the program directory. Also include in compilation all the .lib.
The example is
https://vtk.org/Wiki/VTK/Examples/Cxx/IO/MetaImageReader

The error is in this figure:

Seems giving error in a “new” but I have plenty of memory (20GBytes total)

Can anyone give an advise?

Thanks,

Luis Gonçalves

Same happens in VTK 8.2.
Intel Graphics UHD 630
In Python a similar example works.

This error means that vtkOpenGLImageSliceMapper is missing. If you link the vtkRenderingOpenGL2 library into your app, the error should go away. The vtkOpenGLImageSliceMapper class is the “implementation” of the vtkImageSliceMapper class, i.e. when you call vtkImageSliceMapper::New(), a vtkOpenGLImageSliceMapper is actually created.

No, it is not the problem.

In line:

actor->GetMapper()->SetInputConnection(reader->GetOutput());

gives:

no instance of overloaded function “vtkImageMapper3D::SetInputConnection” matches the argument list.

Thanks for any help,

Luis Gonçalves

This new error that you are reporting is completely different from the first error you reported. Fortunately, it has an easy fix. Use GetOutputPort() instead of GetOutput():

actor->GetMapper()->SetInputConnection(reader->GetOutputPort());

The pattern is always one of these:

a->SetInputData(b->GetOutput());
a->SetInputConnection(b->GetOutputPort());

The first one just passes the data object from ‘a’ to ‘b’.
The second one creates a pipeline connection between ‘a’ and ‘b’.

Ok, I made some changes and I made an error. Now I corrected and returned the former error. The former error is a runtime error.

Visual 2017

The library(vtkRenderingOpenGL2 and all others of VTK) is in Properties->Linker->Input->Additional Dependencies
*.dll(s) copied to x64\Release
Properties->VC++ Directories->Library Directories = C:\Program Files (x86)\VTK\lib
Properties->VC++ Directories->Include Directories = C:\Program Files (x86)\VTK\include\vtk-9.0
Properties->Linker->General->Additional Library Directories->C:\Program Files (x86)\VTK\lib

Aha, you aren’t using cmake. With cmake, the VTK overrides are handled automatically. But since you are doing everything in Visual Studio, you will have to add some extra steps to make it work.

Unfortunately, I forget the details, but if you search for “VTK AUTOINIT” something might come up.

I generated the Visual Projects of VTK 9.0.1 with cmake-gui.

But did you add the extra library with cmake, or did you add it in the Visual Studio GUI?

First, I generated the projects (Visual 2017, x64, Release) with cmake-gui. Then I loaded the “INSTALL” project in Visual. And build ALL-BUILD. And then build INSTALL.

vtkRenderingOpenGL2 is there that way.

So you added the library with the target_link_libraries() command?

What I mean is, you’ll have to show me what you did in your CMakeLists.txt in order for me to know whether it was done correctly.

The CMakeLists.txt is the one that came with VTK package.

Right. But you didn’t make a CMakeLists.txt for your own application.

I simply configurate the Project Properties in Visual like I have in a post above.

The project is a CUDA project but I also isolated this code in an other project and gave the same error.

Windows SDK Version 10.0.17763.0

See https://vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines (the factory overrides are still done similarly in VTK 9).

The factory overrides are mostly automated if you configure your project with a CMakeLists.txt, as I’ve mentioned before in this thread. If you do the configuration within visual studio, you have to do extra steps. Again, I’m just repeating what I’ve said before.

I am following:

https://vtk.org/pipermail/vtkusers/2017-October/100123.html

trying to run WhatModulesVTK.py but requires Python 2.

I put 4 modules and stopped giving error and opens a dark Window. No picture. No error. It went out with Exit Code 0.

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
VTK_MODULE_INIT(vtkRenderingFreeType);

Is better way to find out the remaining modules?

After of above:
WhatModulesVTK.py gave:

find_package(VTK COMPONENTS
IOImage
InteractionStyle
RenderingCore
)

I added:

VTK_MODULE_INIT(vtkIOImage);
VTK_MODULE_INIT(vtkRenderingCore);

But gave linking error despite the libraries are there for linking.

It is working. The not working was a mhd color image (MET_UCHAR_ARRAY). The one that worked is MET_SHORT mha.