alexhunsley/numpy-vox-io

Axes are transposed and Z inverted

alexhunsley opened this issue · 1 comments

Warning: Opinion ahead.

Assuming we want to use the axes order convention in numpy a[x, y, z], the coordinates in the saved vox model are transposed, coming out as (y, Z_max - z, x) where Z_max is the maximum z coordinate.

When loading a vox model, we get the opposite tranposition: (x, y, z) -> a[z, x, Y_max - y].

(Based on gromgull#4 in the original project)

Hi Alex, the convention I follow in numpy is similar; a[(z,y,x)] where I assume z to be top-to-bottom axes and the other vars axes for lateral sides. According to the graphical notation of py-vox-io i.e. (y,z[::-1],x[::-1]) [x is also reverted], I do the following operation model = np.fliplr(np.swapaxes(model,0,1)) to do the axes swapping and flipping the reverted axes before Vox.from_dense() and writing with VoxWriter(). Note that it is np.fliplr and not np.flip to only do flip along a specific direction.