parameter.ListOfListOfFloatsParameter( 'orientations', tip='Tuples containing ABG values.') ], help="Load an Orientation Map. Used internally in data files.", discussion="""<para> Load an <classname>Orientation Map</classname> into a µ. This command is used only in data files, and is only available if &oof2; was built with the <userinput>--enable-orientationmap</userinput> option. </para>""")) def writeOrientationMap(datafile, mscontext): ms = mscontext.getObject() data = orientmapdata.getOrientationMap(mscontext.getObject()) if data: filename = orientmapdata.getOrientationMapFile(ms) orientations = [data.angle(pt).abg() for pt in ms.coords()] datafile.startCmd(microstructureIO.micromenu.OrientationMap) datafile.argument('microstructure', ms.name()) datafile.argument('filename', filename) datafile.argument( 'orientations', [[a.alpha(), a.beta(), a.gamma()] for a in orientations]) datafile.endCmd() microstructureIO.registerMicrostructureIOPlugIn(writeOrientationMap)
tip=parameter.emptyTipString), parameter.RegisteredParameter('pixels', ImageData, tip=parameter.emptyTipString)], help="Load an Image.", discussion="<para>Load an ℑ from a saved µ.</para>" )) def writeImage(datafile, imagecontext): datafile.startCmd(mainmenu.OOF.LoadData.Image.New) datafile.argument('name', imagecontext.name()) datafile.argument('microstructure', imagecontext.getMicrostructure().name()) datafile.argument('pixels', RGBData8(imagecontext.getObject().getPixels())) datafile.endCmd() # TODO LATER: Allow different image depths, and find a way to store # only gray values if the image is gray. ################### ## Define a Microstructure IO PlugIn so that Images will be written to ## Microstructure data files. def writeImageInMicrostructure(datafile, mscontext): for image in mscontext.getObject().getImageContexts(): image.writeImage(datafile) microstructureIO.registerMicrostructureIOPlugIn(writeImageInMicrostructure)
tip="File from which the map was read."), parameter.ListOfListOfFloatsParameter('orientations', tip='Tuples containing ABG values.')], help="Load an Orientation Map. Used internally in data files.", discussion="""<para> Load an <classname>Orientation Map</classname> into a µ. This command is used only in data files, and is only available if &oof2; was built with the <userinput>--enable-orientationmap</userinput> option. </para>""" )) def writeOrientationMap(datafile, mscontext): ms = mscontext.getObject() data = orientmapdata.getOrientationMap(mscontext.getObject()) if data: filename = orientmapdata.getOrientationMapFile(ms) orientations = [data.angle(pt).abg() for pt in ms.coords()] datafile.startCmd(microstructureIO.micromenu.OrientationMap) datafile.argument('microstructure', ms.name()) datafile.argument('filename', filename) datafile.argument('orientations', [[a.alpha(), a.beta(), a.gamma()] for a in orientations]) datafile.endCmd() microstructureIO.registerMicrostructureIOPlugIn(writeOrientationMap)