#============================================================================== # # Project: SharpImage # Module: PathMetadata.py # Language: IronPython # Author: Dan Mueller # Date: $Date$ # Revision: $Revision$ # # Copyright (c) Queensland University of Technology (QUT) 2007. # All rights reserved. # # This software is distributed WITHOUT ANY WARRANTY; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the above copyright notices for more information. # #============================================================================== # Import the relevent class import Script from Script import * class PathMetadataScript(ScriptObject): # ------------------------------------------------------------------------- Name = "PathMetadata" Help = """Change the metadata for all paths attached to the input Renderer.""" Parameters = """(Color) Color = the colour of the paths. (Color.Red) (double) Width = the line width of the paths. (1.5)""" Renderer = None Color = Color.Red Width = 1.5 # ------------------------------------------------------------------------- def Initialise(self): """ Initialise the environment for running this script. """ """ NOTE: This function is invoked on the main UI thread. """ ScriptObject.Initialise( self ) self.Renderer = self.ParentApplication.CurrentRenderer self.ParentApplication.SetApplicationAsReady( 0 ) def DoWork(self): """ Perform the main functions of the script. """ """ NOTE: This function is invoked on the main UI thread. """ for dataobj in self.Renderer.Inputs: if ( Type.GetType("itk.itkParametricPath, ManagedITK.Common").IsInstanceOfType(dataobj) ): dataobj.Metadata["Color"] = self.Color dataobj.Metadata["Width"] = self.Width self.Renderer.Repaint( ) def Finalise(self): """ Finalise the environment after running this script. """ """ NOTE: This function is invoked on the main UI thread. """ self.ParentApplication.SetApplicationAsReady( 0 ) self.Handlers["ScriptFinalised"]()