'How to get volume height in slicer 3d using python API

I have loaded CT scan into slicer 3d, I would like to get distance from first to last slice of the scan using python interactor (or in some other way that is possible to automate).

Picture showing the distance I would like to get

Picture showing the distance I would like to get



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source