def getDiffractionImage(data, lowerBound, upperBound, logScale, colorMaps, colorMapName, maskedPixelInfo, invert=None): mode = "RGB" if maskedPixelInfo.doLessThanMask: (lessThanMaskColorR,lessThanMaskColorG,lessThanMaskColorB) = \ maskedPixelInfo.getLessThanMaskColorRGB() lessThanMask = maskedPixelInfo.lessThanMask else: # We can just send the function a bunch of junk since it won't be used (lessThanMaskColorR, lessThanMaskColorG, lessThanMaskColorB) = (0, 0, 0) lessThanMask = -1 if maskedPixelInfo.doGreaterThanMask: (greaterThanMaskColorR,greaterThanMaskColorG,greaterThanMaskColorB) = \ maskedPixelInfo.getGreaterThanMaskColorRGB() greaterThanMask = maskedPixelInfo.greaterThanMask else: (greaterThanMaskColorR, greaterThanMaskColorG, greaterThanMaskColorB) = (0, 0, 0) greaterThanMask = -1 if maskedPixelInfo.doPolygonMask: (polygonMaskColorR,polygonMaskColorG,polygonMaskColorB) = \ maskedPixelInfo.getPolygonMaskColorRGB() polygonsX = maskedPixelInfo.polygonsX polygonsY = maskedPixelInfo.polygonsY polygonBeginningsIndex = maskedPixelInfo.polygonBeginningsIndex polygonNumberOfItems = maskedPixelInfo.polygonNumberOfItems else: (polygonMaskColorR, polygonMaskColorG, polygonMaskColorB) = (0, 0, 0) polygonsX = Numeric.array([]) polygonsY = Numeric.array([]) polygonBeginningsIndex = Numeric.array([]) polygonNumberOfItems = Numeric.array([]) palette = colorMaps.getPalette(colorMapName, invert=invert) string = DrawWrap.getDiffractionImageString( data, lowerBound, upperBound, logScale, palette, maskedPixelInfo.doLessThanMask, lessThanMask, lessThanMaskColorR, lessThanMaskColorG, lessThanMaskColorB, maskedPixelInfo.doGreaterThanMask, greaterThanMask, greaterThanMaskColorR, greaterThanMaskColorG, greaterThanMaskColorB, maskedPixelInfo.doPolygonMask, polygonsX, polygonsY, polygonBeginningsIndex, polygonNumberOfItems, polygonMaskColorR, polygonMaskColorG, polygonMaskColorB) img = Image.fromstring(mode, (data.shape[0], data.shape[1]), string) img = img.rotate(90) img = img.transpose(Image.FLIP_TOP_BOTTOM) return img
def getImage(self, lowerBound, upperBound, logScale, colorMaps, colorMapName, invert, doScaleFactor, scaleFactor, setMinMax, minIntensity, maxIntensity): mode = "RGB" if self.maskedPixelInfo.doLessThanMask: (lessThanMaskColorR,lessThanMaskColorG, \ lessThanMaskColorB) = \ self.maskedPixelInfo.getLessThanMaskColorRGB() else: # We can just send the function a bunch # of junk since it won't be used (lessThanMaskColorR,lessThanMaskColorG, \ lessThanMaskColorB) = (0,0,0) if self.maskedPixelInfo.doGreaterThanMask: (greaterThanMaskColorR,greaterThanMaskColorG, \ greaterThanMaskColorB) = \ self.maskedPixelInfo.getGreaterThanMaskColorRGB() else: (greaterThanMaskColorR,greaterThanMaskColorG, \ greaterThanMaskColorB) = (0,0,0) if self.maskedPixelInfo.doPolygonMask: (polygonMaskColorR,polygonMaskColorG, \ polygonMaskColorB) = \ self.maskedPixelInfo.getPolygonMaskColorRGB() else: (polygonMaskColorR,polygonMaskColorG, \ polygonMaskColorB) = (0,0,0) palette = colorMaps.getPalette(colorMapName, \ invert=invert) string = DrawWrap.getCakeImageString( self.cakeData, self.diffractionData, lowerBound, upperBound, logScale, palette, self.maskedPixelInfo.doLessThanMask, self.maskedPixelInfo.lessThanMask, lessThanMaskColorR, lessThanMaskColorG, lessThanMaskColorB, self.maskedPixelInfo.doGreaterThanMask, self.maskedPixelInfo.greaterThanMask, greaterThanMaskColorR, greaterThanMaskColorG, greaterThanMaskColorB, self.maskedPixelInfo.doPolygonMask, polygonMaskColorR, polygonMaskColorG, polygonMaskColorB, doScaleFactor, scaleFactor, setMinMax, minIntensity, maxIntensity) img = Image.fromstring( mode, (self.cakeData.shape[1], self.cakeData.shape[0]), string) return img
def getImage(self,lowerBound,upperBound,logScale,colorMaps,colorMapName,invert): mode = "RGB" if self.maskedPixelInfo.doLessThanMask: (lessThanMaskColorR,lessThanMaskColorG,lessThanMaskColorB) = \ self.maskedPixelInfo.getLessThanMaskColorRGB() else: # We can just send the function a bunch of junk since it won't be used (lessThanMaskColorR,lessThanMaskColorG,lessThanMaskColorB) = (0,0,0) if self.maskedPixelInfo.doGreaterThanMask: (greaterThanMaskColorR,greaterThanMaskColorG,greaterThanMaskColorB) = \ self.maskedPixelInfo.getGreaterThanMaskColorRGB() else: (greaterThanMaskColorR,greaterThanMaskColorG,greaterThanMaskColorB) = (0,0,0) if self.maskedPixelInfo.doPolygonMask: (polygonMaskColorR,polygonMaskColorG,polygonMaskColorB) = \ self.maskedPixelInfo.getPolygonMaskColorRGB() else: (polygonMaskColorR,polygonMaskColorG,polygonMaskColorB) = (0,0,0) palette = colorMaps.getPalette(colorMapName,invert=invert) string = DrawWrap.getCakeImageString(self.cakeData, self.diffractionData, lowerBound, upperBound, logScale, palette, self.maskedPixelInfo.doLessThanMask, self.maskedPixelInfo.lessThanMask, lessThanMaskColorR, lessThanMaskColorG,lessThanMaskColorB, self.maskedPixelInfo.doGreaterThanMask, self.maskedPixelInfo.greaterThanMask, greaterThanMaskColorR, greaterThanMaskColorG, greaterThanMaskColorB, self.maskedPixelInfo.doPolygonMask, polygonMaskColorR, polygonMaskColorG, polygonMaskColorB) img = Image.fromstring(mode,(self.cakeData.shape[1],self.cakeData.shape[0]),string) return img
def getDiffractionImage(data,lowerBound,upperBound,logScale, colorMaps,colorMapName,maskedPixelInfo,invert=None): mode = "RGB" if maskedPixelInfo.doLessThanMask: (lessThanMaskColorR,lessThanMaskColorG,lessThanMaskColorB) = \ maskedPixelInfo.getLessThanMaskColorRGB() lessThanMask = maskedPixelInfo.lessThanMask else: # We can just send the function a bunch of junk since it won't be used (lessThanMaskColorR,lessThanMaskColorG,lessThanMaskColorB) = (0,0,0) lessThanMask = -1 if maskedPixelInfo.doGreaterThanMask: (greaterThanMaskColorR,greaterThanMaskColorG,greaterThanMaskColorB) = \ maskedPixelInfo.getGreaterThanMaskColorRGB() greaterThanMask = maskedPixelInfo.greaterThanMask else: (greaterThanMaskColorR,greaterThanMaskColorG,greaterThanMaskColorB) = (0,0,0) greaterThanMask = -1 if maskedPixelInfo.doPolygonMask: (polygonMaskColorR,polygonMaskColorG,polygonMaskColorB) = \ maskedPixelInfo.getPolygonMaskColorRGB() polygonsX = maskedPixelInfo.polygonsX polygonsY = maskedPixelInfo.polygonsY polygonBeginningsIndex = maskedPixelInfo.polygonBeginningsIndex polygonNumberOfItems = maskedPixelInfo.polygonNumberOfItems else: (polygonMaskColorR,polygonMaskColorG,polygonMaskColorB) = (0,0,0) polygonsX = Numeric.array([]) polygonsY = Numeric.array([]) polygonBeginningsIndex = Numeric.array([]) polygonNumberOfItems = Numeric.array([]) palette = colorMaps.getPalette(colorMapName,invert=invert) string = DrawWrap.getDiffractionImageString(data, lowerBound, upperBound, logScale, palette, maskedPixelInfo.doLessThanMask, lessThanMask, lessThanMaskColorR, lessThanMaskColorG, lessThanMaskColorB, maskedPixelInfo.doGreaterThanMask, greaterThanMask, greaterThanMaskColorR, greaterThanMaskColorG, greaterThanMaskColorB, maskedPixelInfo.doPolygonMask, polygonsX, polygonsY, polygonBeginningsIndex, polygonNumberOfItems, polygonMaskColorR, polygonMaskColorG, polygonMaskColorB) img = Image.fromstring(mode,(data.shape[0],data.shape[1]),string) img = img.rotate(90) img = img.transpose(Image.FLIP_TOP_BOTTOM) return img