Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate using the translate method in ImageData #6017

Open
tkoyama010 opened this issue May 2, 2024 · 1 comment
Open

Deprecate using the translate method in ImageData #6017

tkoyama010 opened this issue May 2, 2024 · 1 comment
Assignees
Labels
bug Uh-oh! Something isn't working as expected.

Comments

@tkoyama010
Copy link
Member

Describe the bug, what's wrong, and what you expected.

See #6016 . I want to deprecate using the translate method in ImageData and recommend using the origin property.

Steps to reproduce the bug.

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


# Download a volumetric dataset
vol = examples.download_knee_full()
print(vol.center)
print(vol.origin)
vol = vol.translate(-np.array(vol.center).astype(np.float64))

cpos = [(-381.74, -46.02, 216.54), (74.8305, 89.2905, 100.0), (0.23, 0.072, 0.97)]
pl = pv.Plotter()
pl.add_volume(vol, cmap="bone", opacity="sigmoid")
pl.add_point_labels(vol.center, ['Center'], point_color='blue', point_size=20, text_color='black', font_size=20,)
pl.add_point_labels(vol.origin, ['Origin'], point_color='red', point_size=20, text_color='black', font_size=20,)
pl.camera_position = cpos
pl.show()

System Information

--------------------------------------------------------------------------------
  Date: Thu May 02 12:04:26 2024 SE Asia Standard Time
                OS : Windows
            CPU(s) : 12
           Machine : AMD64
      Architecture : 64bit
       Environment : IPython
        GPU Vendor : ATI Technologies Inc.
      GPU Renderer : AMD Radeon(TM) Graphics
       GPU Version : 4.5.14802 Core Profile Context 21.40.52 30.0.14052.5
  MathText Support : False
  Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)]
           pyvista : 0.43.6
               vtk : 9.3.0
             numpy : 1.26.4
        matplotlib : 3.8.2
            scooby : 0.9.2
             pooch : 1.8.1
            pillow : 9.4.0
           imageio : 2.34.1
           IPython : 8.18.1
             scipy : 1.11.4
      nest_asyncio : 1.5.8
--------------------------------------------------------------------------------

Screenshots

No response

@tkoyama010 tkoyama010 added the bug Uh-oh! Something isn't working as expected. label May 2, 2024
@tkoyama010 tkoyama010 self-assigned this May 2, 2024
@tkoyama010 tkoyama010 changed the title Translate the volume doesn't work well Translate the ImageData doesn't work well May 2, 2024
@tkoyama010 tkoyama010 changed the title Translate the ImageData doesn't work well Deprecate using the translate method in ImageData May 2, 2024
@user27182
Copy link
Contributor

cross-ref to #4659 for the use of center vs origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

2 participants