vtkActor::SetUserMatrix make the vtkPolyData incorrect

I am using vtkContourFilter in my application, and the result is correct:

image

Then, I use vtkActor::SetUserMatrix to correct the direction, and my code is:

	double ele[16] = {
		1, 0, 0, 0,
		0, -1, 0, 0,
		0, 0, 1, 0,
		0, 0, 0, 1
	};
	vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
	matrix->DeepCopy(ele);
	actor->SetUserMatrix(matrix);

Then, the result is incorrect:

image

My complete code is:

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkDICOMImageReader.h"
#include "vtkSmartPointer.h"
#include "vtkContourFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkImageData.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkMatrix4x4.h"
void main()
{
	vtkSmartPointer<vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New();
	reader->SetDirectoryName(".\\TOF");
	reader->Update();

	vtkSmartPointer<vtkImageData> image = reader->GetOutput();

	vtkSmartPointer<vtkContourFilter> cf = vtkSmartPointer<vtkContourFilter>::New();
	cf->SetInputData(image);
	cf->UseScalarTreeOn();
	cf->ComputeNormalsOn();
	cf->SetValue(0, 500);
	cf->Update();

	vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	mapper->SetInputData(cf->GetOutput());
	mapper->ScalarVisibilityOff();
	vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
	actor->SetMapper(mapper);

	// -----------------the user matrix setting
	double ele[16] = {
		1, 0, 0, 0,
		0, -1, 0, 0,
		0, 0, 1, 0,
		0, 0, 0, 1
	};
	vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
	matrix->DeepCopy(ele);
	actor->SetUserMatrix(matrix);
	// -------------------

	vtkSmartPointer<vtkRenderer> render = vtkSmartPointer<vtkRenderer>::New();
	render->AddActor(actor);
	vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
	renWin->AddRenderer(render);
	renWin->Render();
	vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
	iren->SetRenderWindow(renWin);
	iren->Initialize();
	iren->SetInteractorStyle(vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New());
	iren->Start();
}

Any suggestion is appreciated~~~

The problem is that the matrix has a negative determinant:

double ele[16] = {
	1, 0, 0, 0,
	0, -1, 0, 0,
	0, 0, 1, 0,
	0, 0, 0, 1
};

Any transformation that generates a mirror-image of the data will also reverse the orientation of the polygons, which causes the lighting calculations to fail. Hence, the rendering is black.

I’m not sure what outcome you are looking for, but I think you will get a better result if you either
a) move the camera so that you are looking at the data from the opposite side, or
b) flip the image before you apply vtkContourFilter