Issue with Visualizing predictions and Groundtruths after numpy to sitk conversion


I am running into an error whenever I try to visualize the predictions vs ground-truths with sitk .

I have a probability map correspinding to the out put of the model, and a binary groundtruth (resamppled) and a PET scan (also resampled).

Whenever I try to visualize the predictions and groundtruths together sitk flips can visualize the grooundtruth on the pet but when it does the probability the axis is overlaped.

Hello @rosanajurdi,

Without the data it is all but impossible to guess what is causing the issue.

If you are using SimpleITK to perform the overlays then look at the meta-data for all of these images (GetOrigin(), GetSpacing(), GetDirection()). The meta-data needs to match so that the overlay works as expected. If using numpy, SimpleITK and numpy indexing access is in opposite order (image[x,y,z], image_numpy_array[z,y,x]).

1 Like

Thank you,

It was the issue you have mentioned( image[x,y,z] , image_numpy_array[z,y,x]).
It got resolved by simply transposing the channels.

BIg Thanks for the help :slight_smile:

1 Like