Using vtkImagePermute on vtkImageData with multiple scalars

We have been using vtkImagePermute to swap two axes on vtkImageData in Tomviz. We have also recently been adding support for the vtkImageData to have multiple scalars associated with it (i. e., image->GetPointData()->GetNumberOfArrays() > 1).

However, I noticed that the permute is only applied to the active scalars.

I currently have a semi-complicated workaround for this, which involves creating a vtkImageData for each of the scalars, performing a vtkImagePermute on each, and then putting the scalars back into the original vtkImageData.

But I was wondering, is there any interest in getting vtkImagePermute to work on all of the scalars? I think one option could be to loop through all of the scalars in vtkImageReslice, and perform the operation on each of the scalars. However, vtkImageReslice does call some functions that work with the active scalars. We might would either need to change these function calls, or change the active scalars in each iteration of the loop via SetActiveScalars (and I’m not sure if that’s desirable).

This is interesting. I’ve always assumed that vtkImageData only allowed to have one scalar array. Does any of the image filters or mappers can do anything with the non-active scalar arrays?

Since VTK now supports oriented image data, you can encode any voxel->physical coordinate system mapping in the vtkImageData. There should be no (or very limited) need for vtkImagePermute anymore.

I am personally not aware of any image filters or mappers that work with non-active scalar arrays. We only display the active scalars, but we allow the user to switch the active scalars via a panel.

I can look into the physical coordinate system mapping.

I think the main reason we are swapping the axes, though, is to make a particular axis (the “tilt axis” for our tilt series) to be the fast axis, so that it will be fast to loop through that axis.