copyViewerWindow function: support for 4D datasets