Unable to render image

Here is an example code i’m using:

#include vtkSmartPointer.h
#include vtkDataArray.h
#include vtkImageData.h
#include vtkImageViewer2.h
#include vtkDICOMImageReader.h
#include vtkPointData.h
#include vtkRenderWindow.h
#include vtkRenderWindowInteractor.h
#include vtkRenderer.h

int main(int argc, char argv[])
{
Verify input arguments
if ( argc != 2 )
{
stdcout Usage argv[0]
Filename(.img) stdendl;
return EXIT_FAILURE;
}

stdstring inputFilename = argv[1];

Read all the DICOM files in the specified directory.
auto reader = vtkSmartPointervtkDICOMImageReaderNew();
reader-SetFileName(inputFilename.c_str());
reader-Update();

auto image = reader-GetOutput();
double range = image-GetPointData()-GetScalars()-GetRange();

Visualize
auto imageViewer = vtkSmartPointervtkImageViewer2New();
imageViewer-SetInputConnection(reader-GetOutputPort());
auto renderWindowInteractor =
vtkSmartPointervtkRenderWindowInteractorNew();
imageViewer-SetColorLevel(0.5 (range[0] + range[1]));
imageViewer-SetColorWindow(range[1] - range[0]);
imageViewer-SetupInteractor(renderWindowInteractor);
imageViewer-GetRenderer()-ResetCamera();
imageViewer-Render();

renderWindowInter
actor-Start();

return EXIT_SUCCESS;
}

This configures, generates, and built fine. However when i attempt to open the file from the command prompt as shown:

It produces this output:

In the anonymized folder there are about 200+ dicom files. Please help me to understand why i’m getting this error.

Yeah I’m having the same problem!