This would work in the case of the SimpleVolume and the RawVolume because the data is all fixed in memory. But I think it is more complex in the case of the LargeVolume because the data you have obtained a reference to could later become invalidated by compression, paging, etc.
We could add the methods to just the SimpleVolume and RawVolume but on the other hand it's nice when the Volumes are interchangable. It also might make it hard if we did decide that the data needs to move around for some reason. Not that we have any plans for that, but this is the advantage of encapsulation.
I do see your point though... if we want to e.g. double a voxel's value then currently you have to retrieve it, double it, and then set the new value. It would be nice to do it in-place.
|