Import bmp to vtk get pixels and colors problem
I don't understand why a column of pixels on the right is moved to the left, and there is also a problem with the imported colors
This is My code
`
var bmpPath="D://image002.bmp";
var myBitMap = new Bitmap(bmpPath);
byte[] bmpBytes = BmpHelper.BitmapToByte(myBitMap);
GCHandle hObject = GCHandle.Alloc(bmpBytes, GCHandleType.Pinned);
var bmpInptr = hObject.AddrOfPinnedObject();
vtkImageImport imageImport = new vtkImageImport();
imageImport.SetDataSpacing(1, 1, 0);
imageImport.SetDataOrigin(0, 0, 0);
imageImport.SetWholeExtent(0, MyBitMap.Width - 1, 0, MyBitMap.Height - 1, 0, 0);
imageImport.SetDataExtentToWholeExtent();
imageImport.SetDataScalarTypeToUnsignedChar();
imageImport.SetNumberOfScalarComponents(3);
imageImport.SetImportVoidPointer(bmpInptr);
imageImport.Update();
var actor = new vtkImageActor();
actor.SetInput(imageImport.GetOutput());
var ren = new vtkRenderer();
ren.AddActor(actor);
var renWin = new vtkRenderWindow();
renWin.SetParentId(this.Handle);
renWin.SetSize((this.Width - (this.Width / 2)), this.Height);
renWin.SetPosition(0, 0);
renWin.AddRenderer(ren);
renWin.Render();
`
original image
afterimport picture
I'm just getting started with VTK, please help me to see where I made a mistake, thank you