darrenlafreniere / lafarren-image-completer

Implementation of the research titled: "Image Completion Using Efficient Belief Propagation via Priority Scheduling and Dynamic Pruning"
http://www.lafarren.com/image-completer/
GNU General Public License v3.0
32 stars 18 forks source link

Not relying on the Rgb class to cast #24

Closed daviddoria closed 13 years ago

daviddoria commented 13 years ago

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]; };

?

darrenlafreniere commented 13 years ago

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.

daviddoria commented 13 years ago

Done.