tomviz
tomviz copied to clipboard
Custom transformation - need to reshape array to (M, N, 1) to avoid problem
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?
@aaron4444 Yes, this is expected behavior. The dataset in the tomviz pipeline are either volumes or tilt series, both of which has three dimensions.