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

itkwidgets.view crashes when spacing is set in vtkimage #900

Closed
cchriste opened this issue Jan 14, 2021 · 3 comments
Closed

itkwidgets.view crashes when spacing is set in vtkimage #900

cchriste opened this issue Jan 14, 2021 · 3 comments
Assignees

Comments

@cchriste
Copy link
Contributor

Use pyvista.Plotter instead.

@cchriste cchriste self-assigned this Jan 14, 2021
@cchriste
Copy link
Contributor Author

# a helper function that converts shapeworks Image object to vtk image
def sw2vtkImage(swImg, verbose = False):
            
    # get the numpy array of the shapeworks image
    array  = swImg.toArray()
    
    # the numpy array needs to be permuted to match the shapeworks image dimensions
    array = np.transpose(array,(2,1,0))
    
    # converting a numpy array to a vtk image using pyvista's wrap function
    vtkImg = pv.wrap(array)
    
    if verbose:
        print('shapeworks image header information: ')
        print(swImg)

        print('\nvtk image header information: ')
        print(vtkImg) 
    
    return vtkImg

img = sw.Image('./../../Data/ellipsoid-v2/segmentations/ellipsoid_07.nrrd')
img.setSpacing([0.2,0.2,1])
vtkimg = sw2vtkImage(img,True)

# set spacing ***
vtkImg.spacing = img.spacing()
# Spacing:	2.000e-01, 2.000e-01, 1.000e+00

# this crashes when spacing is changed
view(vtkimg)

itkwidgets.view crashes when spacing is changed, but works fine if not.
pyvista works and displays spacing correctly.

@sheryjoe sheryjoe modified the milestones: 6.0 Leftover, 6.1 Release (May 2021) Feb 15, 2021
@cchriste
Copy link
Contributor Author

related to #899

@cchriste
Copy link
Contributor Author

Closing since issues will go away for us when #1186 is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants