Vertical flip with the vtkImageData

Hi all.

I have a question about vertical flip with the vtkImageData.

I would like to display the image buffer received from the camera on the vtkImageViewer2.

By referring to some example code, I made a sample code and it works well when it loads an image from the file.
https://lorensen.github.io/VTKExamples/site/Cxx/Images/StaticImage/
https://lorensen.github.io/VTKExamples/site/Cxx/IO/PNGReader/

But when I load the image from the camera buffer it flips the image vertically.
My code:
image
Original file:
Bubbles.bmp (257.1 KB)

And I referred to the sample code and I got an error.
https://lorensen.github.io/VTKExamples/site/Cxx/Images/Flip/

Is there any way to flip an image vertically with the vtkImageData?

Thank you.

Best regards,
William

I solved this issue by modifying the code as below:

vtkNew flipYFilter;
flipYFilter->SetFilteredAxis(1);
flipYFilter->SetInputData(imageData);

vtkNew castYFilter;
castYFilter->SetOutputScalarTypeToUnsignedChar();
castYFilter->SetInputConnection(flipYFilter->GetOutputPort());

m_imageViewer->SetInputConnection(castYFilter->GetOutputPort());
m_imageViewer->GetRenderer()->ResetCamera();
m_imageViewer->GetRenderWindow()->Render();