You can set the AlphaData and AlphaDataMapping associated with the surface plot created by slice()
In particular you could set it to
double(~isnan(TheImage))
which would be 0 exactly where there are nan.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!