本文整理汇总了Python中ij.plugin.frame.RoiManager.getRoiManager方法的典型用法代码示例。如果您正苦于以下问题:Python RoiManager.getRoiManager方法的具体用法?Python RoiManager.getRoiManager怎么用?Python RoiManager.getRoiManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.plugin.frame.RoiManager
的用法示例。
在下文中一共展示了RoiManager.getRoiManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: grab
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getRoiManager [as 别名]
def grab(self, dialog_options=None):
""" Get the image patches using the ROI manager.
"""
if not dialog_options:
return
# get a refence to the ROI manager and check that we have ROIs!
rm = RoiManager.getRoiManager()
num_ROIs = rm.getCount()
if num_ROIs < 1: return None
if dialog_options['rename']:
for r in xrange(num_ROIs):
rm.getRoi(r).setName('{0:s}_{1:s}_{2:d}'.format(self.session_id,dialog_options['label'],r))
return [ClassifierROI(rm.getRoi(r), path=dialog_options['path']) for r in xrange(num_ROIs)]
示例2: write
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getRoiManager [as 别名]
def write(self, ROIs=None, dialog_options=None):
""" Write out the classifier info
"""
if not dialog_options or not isinstance(ROIs, list):
return
# get the data stack
channels = ['BF', 'GFP', 'RFP']
channels_to_use = [c for c in channels if dialog_options[c] != 'None']
print channels_to_use
for c in channels_to_use:
for r in ROIs:
IJ.log("Grabbing patches for ROI: "+ r.name)
r.window_size = dialog_options['window_size']
r.save = dialog_options['save']
r(data=WindowManager.getImage(dialog_options[c]), channel=c)
if dialog_options['zip']:
roi_fn = os.path.join(dialog_options['path'], dialog_options['label']+'_'+str(self.session_id)+'_ROIset.zip')
rm = RoiManager.getRoiManager()
rm.runCommand('Select All')
rm.runCommand('Save', roi_fn)
# old style dictionary comprehension
ROI_dict = dict((r.name,{'frame':r.index, 'x':r.x, 'y':r.y}) for r in ROIs)
ROI_dict['opts'] = dialog_options
# save out a pickled dictionary with all of the details
if dialog_options['save']:
pass
# try:
# classifier_file = open(os.path.join(dialog_options['path'],dialog_options['data']+'_classifier.p'), 'wb')
# pickle.dump( ROI_dict, classifier_file, -1)
# classifier_file.close()
# except IOError:
# IJ.log('Could not pickle classifier info file.')
print ROI_dict