def __init__(self, threshs=None, chest_regions=None, chest_types=None, pairs=None): if chest_regions is not None: if len(chest_regions.shape) != 1: raise ValueError("chest_regions must be a 1D array with elements in [0, 255]") if np.max(chest_regions) > 255 or np.min(chest_regions) < 0: raise ValueError("chest_regions must be a 1D array with elements in [0, 255]") if chest_types is not None: if len(chest_types.shape) != 1: raise ValueError("chest_types must be a 1D array with elements in [0, 255]") if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError("chest_types must be a 1D array with elements in [0, 255]") if pairs is not None: if len(pairs.shape) != 2: raise ValueError("cpairs must be a 1D array with elements in [0, 255]") if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError("chest_types must be a 1D array with elements in [0, 255]") self.chest_regions_ = chest_regions self.chest_types_ = chest_types self.pairs_ = pairs self.threshs_ = None if threshs is None: self.threshs_ = np.array([-950, -910, -856], dtype=int) else: self.threshs_ = threshs Phenotypes.__init__(self)
def __init__(self, chest_regions=None, chest_types=None, pairs=None, pheno_names=None): c = ChestConventions() self.chest_regions_ = None if chest_regions is not None: tmp = [] for m in xrange(0, len(chest_regions)): tmp.append(c.GetChestRegionValueFromName(chest_regions[m])) self.chest_regions_ = np.array(tmp) self.chest_types_ = None if chest_types is not None: tmp = [] for m in xrange(0, len(chest_types)): tmp.append(c.GetChestTypeValueFromName(chest_types[m])) self.chest_types_ = np.array(tmp) self.pairs_ = None if pairs is not None: self.pairs_ = np.zeros([len(pairs), 2]) inc = 0 for p in pairs: assert len(p)%2 == 0, \ "Specified region-type pairs not understood" r = c.GetChestRegionValueFromName(p[0]) t = c.GetChestTypeValueFromName(p[1]) self.pairs_[inc, 0] = r self.pairs_[inc, 1] = t inc += 1 self.requested_pheno_names = pheno_names Phenotypes.__init__(self)
def __init__(self, chest_regions=None, chest_types=None, pairs=None, pheno_names=None): #rola changed len(chest_regions.shape) to len(shape(chest_regions)) if chest_regions is not None: if len(chest_regions.shape) != 1: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') if np.max(chest_regions) > 255 or np.min(chest_regions) < 0: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') if chest_types is not None: chest_types = map(int, chest_types) #rola print(type(chest_types)) if len(np.shape(chest_types)) != 1: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if np.max(np.array(chest_types)) > 255 or np.min( np.array(chest_types)) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if pairs is not None: if len(pairs.shape) != 2: raise ValueError(\ 'cpairs must be a 1D array with elements in [0, 255]') if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') self.chest_regions_ = chest_regions self.chest_types_ = chest_types self.pairs_ = pairs self.requested_pheno_names = pheno_names Phenotypes.__init__(self)
def __init__(self, threshs=None, chest_regions=None, chest_types=None, pairs=None): if chest_regions is not None: if len(chest_regions.shape) != 1: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') if np.max(chest_regions) > 255 or np.min(chest_regions) < 0: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') if chest_types is not None: if len(chest_types.shape) != 1: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if pairs is not None: if len(pairs.shape) != 2: raise ValueError(\ 'cpairs must be a 1D array with elements in [0, 255]') if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') self.chest_regions_ = chest_regions self.chest_types_ = chest_types self.pairs_ = pairs self.threshs_ = None if threshs is None: self.threshs_ = np.array([-950, -910, -856], dtype=int) else: self.threshs_ = threshs Phenotypes.__init__(self)
def __init__(self, chest_regions=None, chest_types=None, pairs=None, pheno_names=None): if chest_regions is not None: if len(np.shape(chest_regions)) != 1: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') print(chest_regions) print(type(chest_regions)) print(np.max(chest_regions)) print(np.min(chest_regions)) if np.max(chest_regions) > 255 or np.min(chest_regions) < 0: raise ValueError(\ 'chest_regions must be a 1D array with elements in [0, 255]') if chest_types is not None: print(chest_types) print(type(chest_types)) if len(np.shape(chest_types)) != 1: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if np.max(chest_types) > 255 or np.min(chest_types) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') if pairs is not None: if len(np.shape(pairs)) != 2: raise ValueError(\ 'cpairs must be a 1D array with elements in [0, 255]') if np.max(pairs) > 255 or np.min(pairs) < 0: raise ValueError(\ 'chest_types must be a 1D array with elements in [0, 255]') self.chest_regions_ = chest_regions self.chest_types_ = chest_types self.pairs_ = pairs self.requested_pheno_names = pheno_names Phenotypes.__init__(self)