but I'm not sure how to make this happen except to return a void*. Surely there is a way to do this without relying on the Rgb class whose sole purpose is to specify the stride length of the pointer? It seems like the host should be responsible entirely for specifying how to step through the image data (this would allow you to remove all of the checks that the data is aligned correctly, etc).
Maybe something like
template
class Pixel
{
unsigned char channel[TSize];
};
In addition to stride, it also lets the energy calculation code make assumptions about the number of components, and avoid looping in the code where most of the processing time is spent.
I want to do something like this:
const PointerOfCorrectSize* ITKHostImage::GetRgb() const { return reinterpret_cast<const ITKImageType::PixelType*>(m_Image->GetBufferPointer()); }
but I'm not sure how to make this happen except to return a void*. Surely there is a way to do this without relying on the Rgb class whose sole purpose is to specify the stride length of the pointer? It seems like the host should be responsible entirely for specifying how to step through the image data (this would allow you to remove all of the checks that the data is aligned correctly, etc).
Maybe something like template
class Pixel
{
unsigned char channel[TSize];
};
?