當前位置: 首頁>>代碼示例>>Python>>正文


Python RoiManager.getRoiManager方法代碼示例

本文整理匯總了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)]
開發者ID:quantumjot,項目名稱:impy-tools,代碼行數:19,代碼來源:IJClassifier_.py

示例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
開發者ID:quantumjot,項目名稱:impy-tools,代碼行數:44,代碼來源:IJClassifier_.py


注:本文中的ij.plugin.frame.RoiManager.getRoiManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。