ker wrote:
I don't quite get how the Hilbert curve might aid cache usage... would't simply running along the axis in zyx order perfectly follow the array as it is in memory?
Sorry, yes, I think you are right. I had Hilbert curves on my mind as I'd been thinking of storing the data in Hilbert curve order to improve compression. Again, something that is completely untested

ker wrote:
Well, for iterators like mine (that return Vectors which may then be used as wished), processing by Blocks would be rather simple. They'd only need to get the Block size from the Volume.
Yep, and I'd still say that this was useful (especially for the LargeVolume). I can imagine that in the future we might want something like an octree volume (or at least we shouldn't rule it out) so I guess there could be an iterator for each volume type, so that it knows how the data is stored. Perhaps a default iterator as well.
ker wrote:
For iterators that can access the volume through VolumeSampler everything might get a little messier, as someone might use get/setVoxelAt and compress block containing the voxel which the iterator points at in that moment.
Right, this is a problem with using the sampler with LargeVolume at the moment. We've mentioned this previously of course, but even if the sampler is read only it can still lose it's data if other operations on the volume cause the sampler's current block to become compressed. This is on my list of known problems to be thought about, though it seems no one has encountered it.
If you don't find any performance problems you might find it easiest to just access the volume directly. But I can still imagine that once the samplers are improved so that they do have write access then there won't be a need for a separate iterator class (we can make the samplers implement std::iterator?).
ker wrote:
Also, have you done any performance tests of looping over coordinates and using get/setVoxelAt against using VolumeSampler?
I did see benefits of using the VolumeSampler when implementing the new cubic surface extractor. The profiler actually showed getVoxelAt() being the bottleneck and using the sampler fixed this. However, a lot more testing should be done.
But it's imporant to realise that pointing the iterator at a voxel and then reading it's value is no faster than accessing the voxel directly with getVoxelAt(). The real performance benefit of the sampler occurs when:
- You can position the sampler using one of the 'move' functions, as these should be faster than calling setPosition().
- You need access to the neighbours and can get this through the 'peek' functions. This happens a lot in PolyVox when performing surface extraction and normal calculation. A good test for this could be code which blurs the volume, by averaging each voxel with it's neighbours.
ker wrote:
Oh, and could you add .inl files to the permitted attachements?
I split the iterator into .hpp and .inl and the forum does not like the latter.
It looks like Matt has fixed this for you, try it again.