def getParameter(self, name, index=-1): """ Get the value of the parameter. @param name -- the name of the parameter to retrieve, as defined by the Node Spec. """ # If any spec parameter name is the same as an attribute, this call # will get it automatically, e.g. self.learningMode return PyRegion.getParameter(self, name, index)
def getParameter(self, name, index=-1): """ Get the value of a parameter. Note: this method may be overridden by derived classes, but if so, then the derived class should invoke this base method if 'name' is unknown to the derived class. @param name -- the name of the parameter to retrieve, as defined by the Node Spec. """ if name == "SVDSampleCount": return self._SVDSampleCount elif name == "SVDDimCount": return self._SVDDimCount elif name == "fractionOfMax": return self._fractionOfMax elif name == "trainingSampleCount": return self.gettrainingSampleCount() else: # If any spec parameter name is the same as an attribute, this call # will get it automatically, e.g. self.learningMode return PyRegion.getParameter(self, name, index)
def getParameter(self, parameterName, nodeSet=""): if parameterName == 'numCategories': return len(self._categories) elif parameterName == 'categoryList': return self._categories elif parameterName == "numBlockPresentations": # Compute total number of block presentations edgeLen = 2 * self.radialLength + 1 return 0 if self.mode != "block" else len(self._categories) * edgeLen * edgeLen elif parameterName == 'outputImage': if self._canvas is None: return '' # Can't just do "return" because it shows up as "None"! outputArray = self._canvas.astype(numpy.uint8) * 255 outputArray = outputArray.reshape((self.height, self.width)) outputImage = Image.fromarray(outputArray) return serializeImage(outputImage) elif parameterName == 'locationImage': if self._fullImage is None: return '' # Can't just do "return" because it shows up as "None"! return serializeImage(self._createLocationImage()) elif parameterName == 'metadata': return str(self._lastMetadata) else: return PyRegion.getParameter(self, parameterName, nodeSet)