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

Custom transformation - need to reshape array to (M, N, 1) to avoid problem #2264

Open
aaron4444 opened this issue Sep 14, 2022 · 1 comment

Comments

@aaron4444
Copy link

Describe the bug
Attempted to use custom transformation, using an outside library.

I see that the VTKnumpy array received is a (M, N, 1) for a (M, N) array.

Most operations outside of numpy will not conserve (M, N, 1) and will return (M, N) for 2D operations.

Before returning the result you need to use:
np.reshape( M, N, 1)

If you don't realize this you will get the following error.

_Warning, array does not have Fortran order, making deep copy and fixing...
...done.
Traceback (most recent call last):
File "Transform Data", line 15, in transform
File "C:\Users\michn\anaconda3\envs\tomviz\Library\lib\tomviz\site-packages\tomviz\internal_dataset.py", line 17, in active_scalars
utils.set_array(self.data_object, v)
File "C:\Users\michn\anaconda3\envs\tomviz\Library\lib\tomviz\site-packages\tomviz_internal.py", line 248, in wrapped
return f(*args, **kwargs)
File "C:\Users\michn\anaconda3\envs\tomviz\Library\lib\tomviz\site-packages\tomviz\utils.py", line 130, in set_array
[x + y - 1 for (x, y) in zip(minextent, vtkshape)]
ValueError: attempt to assign sequence of size 2 to extended slice of size 3
critical: In unknown, line 0
critical: Failed to execute the script.

I'm not sure this is the expected behavior?

@cjh1
Copy link
Member

cjh1 commented Sep 19, 2022

@aaron4444 Yes, this is expected behavior. The dataset in the tomviz pipeline are either volumes or tilt series, both of which has three dimensions.

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