1#!/usr/bin/env python
2
3# Image pipeline
4image1 = vtk.vtkTIFFReader()
5image1.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/beach.tif")
6# "beach.tif" image contains ORIENTATION tag which is
7# ORIENTATION_TOPLEFT (row 0 top, col 0 lhs) type. The TIFF
8# reader parses this tag and sets the internal TIFF image
9# orientation accordingly.  To overwrite this orientation with a vtk
10# convention of ORIENTATION_BOTLEFT (row 0 bottom, col 0 lhs ), invoke
11# SetOrientationType method with parameter value of 4.
12image1.SetOrientationType(4)
13image1.Update()
14#
15# If the current directory is writable, then test the witers
16#
17if (catch.catch(globals(),"""channel = open(test.tmp, w)""") == 0):
18    channel.close()
19    file.delete("-force", test.tmp)
20    piw = vtk.vtkPImageWriter()
21    piw.SetInputConnection(image1.GetOutputPort())
22    piw.SetFileName(piw.raw)
23    piw.SetMemoryLimit(1)
24    piw.Write()
25    file.delete("-force", piw.raw)
26    pass
27viewer = vtk.vtkImageViewer()
28viewer.SetInputConnection(image1.GetOutputPort())
29viewer.SetColorWindow(255)
30viewer.SetColorLevel(127.5)
31viewer.Render()
32# --- end of script --
33