Esempio n. 1
0
imagemenu.addItem(
    oofmenu.OOFMenuItem('Copy',
                        ellipsis=1,
                        callback=copyImage,
                        params=parameter.ParameterGroup(
                            whoville.WhoParameter(
                                'image',
                                whoville.getClass('Image'),
                                tip=parameter.emptyTipString),
                            whoville.NewWhoParameter(
                                'microstructure',
                                ooflib.common.microstructure.microStructures,
                                tip="Microstructure to receive copied image."),
                            whoville.AutoWhoNameParameter(
                                'name',
                                resolver=imageNameResolver,
                                value=automatic.automatic,
                                tip="Name to give to copied image.")),
                        help='Copy an Image.',
                        discussion=xmlmenudump.loadFile(
                            'DISCUSSIONS/image/menu/copyimage.xml')))


def renameImage(menuitem, image, name):
    immidge = imagecontext.imageContexts[image]
    immidge.reserve()
    immidge.begin_writing()
    try:
        immidge.rename(name, exclude=immidge.getObject().name())
    finally:
        immidge.end_writing()
Esempio n. 2
0
def msNameResolver(param, name):
    if param.automatic():
        nm = 'microstructure'
    else:
        nm = name
    return ooflib.common.microstructure.microStructures.uniqueName(nm)


micromenu.addItem(
    oofmenu.OOFMenuItem('New',
                        callback=newMicrostructure,
                        params=parameter.ParameterGroup(
                            whoville.AutoWhoNameParameter(
                                'name',
                                resolver=msNameResolver,
                                value=automatic.automatic,
                                tip="Name of the new Microstructure.")) +
                        sizeparams,
                        help="Create a new Microstructure.",
                        discussion=xmlmenudump.loadFile(
                            "DISCUSSIONS/common/menu/newmicro.xml")))

############################


def renameMicrostructure(menuitem, microstructure, name):
    if parallel_enable.enabled():
        microstructureIPC.msmenu.Rename(microstructure=microstructure,
                                        name=name)
        return
Esempio n. 3
0
    orientdata = orientmapdata.getOrientationMap(ms.getObject())
    immidge = orientdata.createImage(imagename, colorscheme) # OOFImage object
    immidge.setSize(ms.getObject().size())
    immidge.setMicrostructure(ms.getObject())
    imagemenu.loadImageIntoMS(immidge, microstructure)
    switchboard.notify("redraw")

orientmapmenu.addItem(oofmenu.OOFMenuItem(
    'Convert_to_Image',
    callback=_imageFromOrientationMap,
    ordering=3,
    params= parameter.ParameterGroup(
    MicrostructureWithOrientMapParameter('microstructure',
                      tip='Convert the Orientation Map in this Microstructure'),
    whoville.AutoWhoNameParameter('imagename',
                                  resolver=_imageNameResolver,
                                  value=automatic.automatic,
                                  tip="Name to give to the new Image."),
    parameter.RegisteredParameter('colorscheme',
                                  angle2color.Angle2Color,
                                  tip="How to convert angles to colors.")),
    help="Convert an Orientation Map into an Image, so that pixel selection tools will work on it.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/orientationmap/menu/image.xml')
    ))
    

################

def _misorientation(menutitem, orientation1, orientation2, lattice_symmetry):
    # Orientation.misorientation(), defined in
    # engine/IO/orientationmatrix.py, returns an angle in degrees. It
    # calls COrientation.misorientation(), which returns an angle in
Esempio n. 4
0
    ##        return
    meshcontext = ooflib.engine.mesh.meshes[mesh]
    # 'subproblem' is a SubProblemType instance
    subpobj = subproblem.create()
    meshcontext.newSubProblem(subpobj, subproblem,
                              labeltree.makePath(mesh) + [name])


subproblemMenu.addItem(
    oofmenu.OOFMenuItem(
        'New',
        callback=_new_subproblem,
        threadable=oofmenu.THREADABLE,
        params=parameter.ParameterGroup(
            whoville.AutoWhoNameParameter('name',
                                          value=automatic.automatic,
                                          resolver=subproblemNameResolver,
                                          tip="Name of the new SubProblem"),
            SyncMeshParameter('mesh', tip=parameter.emptyTipString),
            parameter.RegisteredParameter('subproblem',
                                          subproblemtype.SubProblemType,
                                          tip=parameter.emptyTipString)),
        help="Define a new subproblem",
        discussion="""<para>

    Create a new &subproblem; in the given &mesh;.  If the given name
    is not unique in the &mesh;, <userinput>&lt;x&gt;</userinput> will
    be appended to it, where <userinput>x</userinput> is an integer
    chosen to make the name unique.  </para>
    """))

#############