Skip to content

Translate the volume to origin #6016

Answered by tkoyama010
gungui98 asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for the inconvenience, the translate method does not seem to work well with the ImageData class. We recommend updating the origin property as follows instead.

vol.origin = vol.origin - np.array(vol.center)

You can expect to get the results you request by executing the following code.

import numpy as np
import pyvista as pv
from pyvista import examples


# Download a volumetric dataset
vol = examples.download_knee_full()
center = vol.center
origin = vol.origin
print(center)
print(origin)

# vol = vol.translate(-np.array(vol.center).astype(np.float64))
vol.origin = vol.origin - np.array(vol.center)

cpos = [(-381.74, -46.02, 216.54), (74.8305, 89.2905, 100.0), (0.23, 0.072, 0.97)]
pl = 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gungui98
Comment options

@tkoyama010
Comment options

Answer selected by tkoyama010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants