about vtk SMP

ImageMapToColors = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
	ImageMapToColors->SetWindow(Window);
	ImageMapToColors->SetLevel(level);
	ImageMapToColors->SetInputData(ImageData);
	ImageMapToColors->SetEnableSMP(1);
	ImageMapToColors->SetNumberOfThreads(16);
	ImageMapToColors->Update();

Why can’t I speed up this process by using SetEnableSMP?

Like most of the VTK image filters, this filter is multithreaded by default. It will automatically use the fastest threading method available. So I recommend to not call SetEnableSMP() or SetNumberOfThreads().

Perhaps vtkImageMapToColors will be faster, since its code is less complex. The usage is slightly different:

LUT = vtkSmartPointer<vtkScalarsToColors>::New();
LUT.SetRange(Level - 0.5*Window, Level + 0.5*Window);

ImageMapToColors = vtkSmartPointer<vtkImageMapToColors>::New();
ImageMapToColors->SetLookupTable(LUT);
ImageMapToColors->SetInputData(ImageData);

Also, it’s possible your code is calling this filter in an inefficient manner, for example if you are only displaying one slice, but you are calling ImageMapToColors on the entire volume, that will greatly reduce the speed.

1 Like

ok I understand