diff --git a/Modules/Bridge/NumPy/include/itkPyBuffer.hxx b/Modules/Bridge/NumPy/include/itkPyBuffer.hxx index fa1d4f16ae06..6a87548a219b 100644 --- a/Modules/Bridge/NumPy/include/itkPyBuffer.hxx +++ b/Modules/Bridge/NumPy/include/itkPyBuffer.hxx @@ -21,6 +21,7 @@ #include "itkImportImageContainer.h" #include // For reverse. +#include // For byte. #include // For unique_ptr. namespace itk @@ -39,17 +40,14 @@ PyBuffer::_GetArrayViewFromImage(ImageType * image) image->Update(); - ComponentType * buffer = - const_cast(reinterpret_cast(image->GetBufferPointer())); - - void * itkImageBuffer = buffer; + void * buffer = const_cast(reinterpret_cast(image->GetBufferPointer())); // Computing the length of data const unsigned int numberOfComponents = image->GetNumberOfComponentsPerPixel(); const SizeValueType numberOfPixels = image->GetBufferedRegion().GetNumberOfPixels(); const auto len = static_cast(numberOfPixels * numberOfComponents * sizeof(ComponentType)); - PyBuffer_FillInfo(&pyBuffer, nullptr, itkImageBuffer, len, 0, PyBUF_CONTIG); + PyBuffer_FillInfo(&pyBuffer, nullptr, buffer, len, 0, PyBUF_CONTIG); return PyMemoryView_FromBuffer(&pyBuffer); }