This example illustrates the basic image viewing capabilities provided by SimpleITK.
The focus of SimpleITK is on image analysis and not display. We therefor use an ad-hoc image viewing approach, relying on an external program. By default this is the Fiji/ImageJ program.
When using this functionality, SimpleITK writes the image to disc in a temporary location and then launches the viewer. Potential issues with this approach:
- The external viewer program is not found. Either it is not installed, or not installed in the expected location, for details see Why isn’t ImageJ found by the Show function (RuntimeError: Exception thrown…)?)
- Writing the image to disc fails when there isn’t enough disc space.
- The external program cannot read the image file because it was saved in a format not supported by the program.
To control viewing you have two options:
One can either set the viewing application, if you just want to change the specific viewer, or set the viewing command. The latter allows you to specify viewer specific arguments such as -z for ITK-SNAP, see below, to open in a zoomed view.