コード例 #1
0
ファイル: orientmapmenu.py プロジェクト: santiama/OOF3D
def _imageFromOrientationMap(menuitem, microstructure, imagename, colorscheme):
    ms = ooflib.common.microstructure.microStructures[microstructure]
    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)
コード例 #2
0
ファイル: orientmapmenu.py プロジェクト: anilkunwar/OOF2
def _imageFromOrientationMap(menuitem, microstructure, imagename, colorscheme):
    ms = ooflib.common.microstructure.microStructures[microstructure]
    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")
コード例 #3
0
ファイル: orientmapdisplay.py プロジェクト: pk-organics/OOF3D
 def draw(self, gfxwindow, device):
     msobj = self.who().getObject(gfxwindow)
     data = orientmapdata.getOrientationMap(msobj)
     if data is not None:
         orientimage = orientmapdata.OrientMapImage(data, self.colorscheme)
         if config.dimension() == 2:
             device.draw_image(orientimage, coord.Coord(0, 0), msobj.size())
         elif config.dimension() == 3:
             device.draw_image(orientimage, coord.Coord(0, 0, 0),
                               msobj.size())
コード例 #4
0
 def __call__(self, ms, selection):
     curselection = selection.getObject()
     orientationmap = orientmapdata.getOrientationMap(ms)
     if orientationmap is None:
         raise ooferror.ErrUserError(
             "The Microstructure has no orientation map.")
     selection.start()
     selection.clearAndSelect(
         pixelselectioncouriero.OrientationSelection(
             orientationmap, self.orientation.corient,
             self.lattice_symmetry.schoenflies(), self.misorientation))
コード例 #5
0
 def select(self, immidge, pointlist, selector):
     ms = immidge.getMicrostructure()
     orientationmap = orientmapdata.getOrientationMap(ms)
     if orientationmap is None:
         raise ooferror.ErrUserError(
             "The Microstructure has no orientation map.")
     pt = ms.pixelFromPoint(pointlist[0])
     orientation = orientationmap.angle(pt)  # a swigged COrientABG
     selector(
         pixelselectioncouriero.OrientationSelection(
             orientationmap, orientation,
             self.lattice_symmetry.schoenflies(), self.misorientation))
コード例 #6
0
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()
コード例 #7
0
 def select(self, immidge, points, selector):
     mspath = immidge.getParent().path()
     ms = immidge.getMicrostructure()
     orientationmap = orientmapdata.getOrientationMap(ms)
     if orientationmap is None:
         raise ooferror.ErrUserError(
             "The Microstructure has no orientation map.")
     startpt = ms.pixelFromPoint(points[0])
     selectionctxt = ms.pixelselection.getObject()
     if selectionctxt.checkpixel(startpt):
         od = pixeldifferentiator.OrientationDifferentiator(
             mspath, self.local_flammability, self.global_flammability,
             self.lattice_symmetry)
         selector(BurnSelection(ms, od.cobj, startpt, self.next_nearest))
コード例 #8
0
def _loadOrientationMap(menuitem, filename, reader, microstructure):
    # format is an Enum object.  microstructure is a name.
    mscontext = ooflib.common.microstructure.microStructures[microstructure]
    mscontext.reserve()
    mscontext.begin_writing()
    try:
        # Check to see if the microstructure already has an
        # orientation map.  It can't have more than one.
        if orientmapdata.getOrientationMap(mscontext.getObject()) is not None:
            raise ooferror.ErrUserError(
                "A Microstructure can contain only one orientation map.")

        data = reader.read(filename)        # creates OrientMap object

        if (mscontext.getObject().sizeInPixels() != data.sizeInPixels() or
            mscontext.getObject().size() != data.size()):
            raise ooferror.ErrUserError(
                "Cannot load orientation map into an existing Microstructure of a different size. ms=%sx%s (%dx%d), map=%sx%s (%dx%d)" % (
                mscontext.getObject().size()[0],
                mscontext.getObject().size()[1],
                mscontext.getObject().sizeInPixels()[0],
                mscontext.getObject().sizeInPixels()[1],
                data.size()[0], data.size()[1],
                data.sizeInPixels()[0], data.sizeInPixels()[1]))
        # Registering the OrientMapData object under its
        # microstructure's name allows it to be found by the
        # OrientationMapProp Property in C++.
        orientmapdata.registerOrientMap(microstructure, data)
        data.setMicrostructure(mscontext.getObject())
        # Storing it as a Python Microstructure plug-in allows the
        # data to be found by Python (and keeps a live reference to
        # it, so we don't have to transfer ownership to C++).  All of
        # this registration doesn't actually duplicate the data.
        orientmapplugin = mscontext.getObject().getPlugIn("OrientationMap")
        orientmapplugin.set_data(data, filename)
        orientmapplugin.timestamp.increment()
    finally:
        mscontext.end_writing()
        mscontext.cancel_reservation()
    reader.postProcess(mscontext)
    orientmapdata.orientationmapNotify(mscontext.getObject())
コード例 #9
0
ファイル: orientmapmenu.py プロジェクト: anilkunwar/OOF2
def _loadOrientationMap(menuitem, filename, reader, microstructure):
    # format is an Enum object.  microstructure is a name.
    mscontext = ooflib.common.microstructure.microStructures[microstructure]
    mscontext.reserve()
    mscontext.begin_writing()
    try:
        # Check to see if the microstructure already has an
        # orientation map.  It can't have more than one.
        if orientmapdata.getOrientationMap(mscontext.getObject()) is not None:
            raise ooferror.ErrUserError(
                "A Microstructure can contain only one orientation map.")

        data = reader.read(filename)        # creates OrientMap object

        if (mscontext.getObject().sizeInPixels() != data.sizeInPixels() or
            mscontext.getObject().size() != data.size()):
            raise ooferror.ErrUserError(
                "Cannot load orientation map into an existing Microstructure of a different size. ms=%sx%s (%dx%d), map=%sx%s (%dx%d)" % (
                mscontext.getObject().size()[0],
                mscontext.getObject().size()[1],
                mscontext.getObject().sizeInPixels()[0],
                mscontext.getObject().sizeInPixels()[1],
                data.size()[0], data.size()[1],
                data.sizeInPixels()[0], data.sizeInPixels()[1]))
        # Registering the OrientMapData object under its
        # microstructure's name allows it to be found by the
        # OrientationMapProp Property in C++.
        orientmapdata.registerOrientMap(microstructure, data)
        # Storing it as a Python Microstructure plug-in allows the
        # data to be found by Python (and keeps a live reference to
        # it, so we don't have to transfer ownership to C++).  All of
        # this registration doesn't actually duplicate the data.
        orientmapplugin = mscontext.getObject().getPlugIn("OrientationMap")
        orientmapplugin.set_data(data, filename)
        orientmapplugin.timestamp.increment()
    finally:
        mscontext.end_writing()
        mscontext.cancel_reservation()
    reader.postProcess(mscontext)
    orientmapdata.orientationmapNotify(mscontext.getObject())
コード例 #10
0
ファイル: orientmapdisplay.py プロジェクト: anilkunwar/OOF2
 def draw(self, gfxwindow, device):
     msobj = self.who().getObject(gfxwindow)
     data = orientmapdata.getOrientationMap(msobj)
     if data is not None:
         orientimage = orientmapdata.OrientMapImage(data, self.colorscheme)
         device.draw_image(orientimage, coord.Coord(0,0), msobj.size())
コード例 #11
0
def _withoutOrientationMap(who):
    result = (whoville.excludeProxies(who)
              and orientmapdata.getOrientationMap(who.getObject()) is None)
    return result
コード例 #12
0
def _withOrientationMap(who):
    return (whoville.excludeProxies(who)
            and orientmapdata.getOrientationMap(who.getObject()) is not None)
コード例 #13
0
def _withoutOrientationMap(who):
    result = whoville.excludeProxies(who) and orientmapdata.getOrientationMap(who.getObject()) is None
    return result
コード例 #14
0
def _withOrientationMap(who):
    return whoville.excludeProxies(who) and orientmapdata.getOrientationMap(who.getObject()) is not None