CERN / CERN/TIGRE

Python geometry order of axes

Open
#191 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
MATLAB
Stars
803
Forks
262
Avg merge
9d 13h
Merged PRs (30d)
8

Description

This issue is related to #157, #189

I would like to confirm the order of x, y, z for geometry. In othrer words, I would like to know which is expected, for example, nVoxel=np.array([nVoxelZ, nVoxelY, nVoxelX]) or nVoxel=np.array([nVoxelX, nVoxelY, nVoxelZ])?

```
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import tigre
from tigre.demos.Test_data import data_loader

nangles=30
nVoxelX=256
nVoxelY=128
nVoxelZ=64
print("nVoxelX, nVoxelY, nVoxelZ = {}, {}, {}".format(nVoxelX, nVoxelY, nVoxelZ))
geo=tigre.geometry(mode='cone', nVoxel=np.array([nVoxelZ, nVoxelY, nVoxelX]), default=True)
print("geo.nVoxel = {}".format(geo.nVoxel))
angles=np.linspace(0,2*np.pi-2*np.pi/nangles,nangles)
head=data_loader.load_head_phantom(geo.nVoxel)

listIdxZ = [0, nVoxelZ*3//8, nVoxelZ//2, nVoxelZ*5//8, nVoxelZ-1]

fig, axes = plt.subplots(len(listIdxZ),1, figsize=(5, 8/0.97), sharey=True)
fig.suptitle('Inisotropic volume, Head, geo.nVoxel = {}'.format(geo.nVoxel))

for idx in range(len(listIdxZ)):
idxZ = listIdxZ[idx]
axis = axes[idx]
axis.set_ylabel("z={}".format(idxZ))
mappable = axis.imshow(head[idxZ])
divider = make_axes_locatable(axis)
cax = divider.append_axes("right", size="5%", pad=0.05)
fig.colorbar(mappable, cax=cax)

plt.tight_layout(rect=[0,0,1,0.97])
fig.savefig("InosotropicVolumeHead_Python.png")
```
results

![InosotropicVolumeHead_Python](https://user-images.githubusercontent.com/25704789/98075481-cfd6c100-1eaf-11eb-8cca-0d7dcb890bbe.png)

and if modified to nVoxel=np.array([nVoxelX, nVoxelY, nVoxelZ] is passed to tigre.geometry, the result is

![InosotropicVolumeHead_XYZ](https://user-images.githubusercontent.com/25704789/98075792-5c817f00-1eb0-11eb-8dc5-06314dfbadb2.png)

This means that data_loader.load_head_phantom() assumes geo.nVoxel is ZYX order. Is this correct?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.