Ejemplo n.º 1
0
    def importOverlay(dataItem, filename, prefix="File Overlays/", attrs=None):
        theDataItem = DataImpex.importDataItem(filename, None)
        if theDataItem is None:
            print "could not load", filename
            return None

        data = theDataItem[:, :, :, :, :]

        if attrs == None:
            attrs = OverlayAttributes(filename)
        if attrs.min is None:
            attrs.min = numpy.min(data)
        if attrs.max is None:
            attrs.max = numpy.max(data)

        if data.shape[0:-1] == dataItem.shape[0:-1]:
            ov = OverlayItem(
                data,
                color=attrs.color,
                alpha=attrs.alpha,
                colorTable=attrs.colorTable,
                autoAdd=attrs.autoAdd,
                autoVisible=attrs.autoVisible,
                min=attrs.min,
                max=attrs.max,
            )
            ov.key = attrs.key
            if len(prefix) > 0:
                if prefix[-1] != "/":
                    prefix = prefix + "/"
            dataItem.overlayMgr[prefix + ov.key] = ov
            return ov
Ejemplo n.º 2
0
    def importOverlay(dataItem, filename, prefix="File Overlays/", attrs=None):
        theDataItem = DataImpex.importDataItem(filename, None)
        if theDataItem is None:
            print "could not load", filename
            return None

        data = theDataItem[:, :, :, :, :]

        if attrs == None:
            attrs = OverlayAttributes(filename)
        if attrs.min is None:
            attrs.min = numpy.min(data)
        if attrs.max is None:
            attrs.max = numpy.max(data)

        if data.shape[0:-1] == dataItem.shape[0:-1]:
            ov = OverlayItem(data,
                             color=attrs.color,
                             alpha=attrs.alpha,
                             colorTable=attrs.colorTable,
                             autoAdd=attrs.autoAdd,
                             autoVisible=attrs.autoVisible,
                             min=attrs.min,
                             max=attrs.max)
            ov.key = attrs.key
            if len(prefix) > 0:
                if prefix[-1] != "/":
                    prefix = prefix + "/"
            dataItem.overlayMgr[prefix + ov.key] = ov
            return ov