本文整理匯總了Python中region.Region.add_region方法的典型用法代碼示例。如果您正苦於以下問題:Python Region.add_region方法的具體用法?Python Region.add_region怎麽用?Python Region.add_region使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類region.Region
的用法示例。
在下文中一共展示了Region.add_region方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_region_from_seeds
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import add_region [as 別名]
def get_region_from_seeds(self, seed_cords):
'''
Get corresponding region from seeds.
Inputs:
seed_cords: the cordinates of the seed
'''
if not isinstance(seed_cords, np.ndarray):
raise ValueError('get_region_from_seeds: get_region_from_seeds is not np.ndarray!')
region = None
if self._unique_image != None:
region_ids = self._unique_image[seed_cords[:, 0], seed_cords[:, 1], seed_cords[:, 2]]
if len(region_ids) == 1:
region = Region(seed_cords, region_ids[0], self._image.shape, None, None)
else:
for region_id in region_ids:
sub_region = self.get_region_from_index(region_id - 1)
region.add_region()
return region