How to change dpi of saving pictures with vtkBMPWriter

Hello,
I know SetSpacing SetDimensions in vtkImageData, which set the pixel interval and the number of pixels number.

And the dpi means the number of pixels per 2.54cm.

If I want to set the dpi to 150, the spacing should be 25.4 / 150 = 0.169mm, and dimensions should be image length / spacing.

But the dpi of the generated picture is 96.

And no matter how I adjust spacing, the generated picture dpi always is 96,

My question is, how to set the dpi of generated pictures is correct?

Here is my code:

double spacing[3] = {0.169, 0.169, 0.169};
double bounds[6];
int dim[3];

auto circle = stripper1->GetOutput();

vtkSmartPointer<vtkImageData> whiteImage = vtkSmartPointer<vtkImageData>::New();
circle->GetBounds(bounds);
for (int i = 0; i < 3; i++)
{
    dim[i] = static_cast<int>(ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i])) + 1;
    if (dim[i] < 1)
        dim[i] = 1;
}
whiteImage->SetDimensions(dim);
whiteImage->SetOrigin(0,0,0);
whiteImage->SetSpacing(spacing);
whiteImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);

unsigned char inval = 255; 
unsigned char outval = 0;
vtkIdType count = whiteImage->GetNumberOfPoints();
for (vtkIdType i = 0; i < count; ++i)
{
    whiteImage->GetPointData()->GetScalars()->SetTuple1(i, inval);
}

vtkSmartPointer<vtkPolyDataToImageStencil> pol2stenc = vtkSmartPointer<vtkPolyDataToImageStencil>::New();
pol2stenc->SetTolerance(0); // important if extruder->SetVector(0, 0, 1) !!!
pol2stenc->SetInputConnection(circle);
pol2stenc->SetOutputOrigin(origin);
pol2stenc->SetOutputSpacing(spacing);
pol2stenc->SetOutputWholeExtent(whiteImage->GetExtent());
pol2stenc->Update();

vtkSmartPointer<vtkImageStencil> imgstenc = vtkSmartPointer<vtkImageStencil>::New();
imgstenc->SetInputData(whiteImage);
imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());
imgstenc->ReverseStencilOff();
imgstenc->SetBackgroundValue(outval);
imgstenc->Update();

vtkNew<vtkBMPWriter> writer;
writer->SetFileName("11111.bmp");
writer->SetInputConnection(imgstenc->GetOutputPort());
writer->Write();

I know that the default dpi under windows is 96.

Is this phenomenon related to the default value under windows?