merge plugin in rscder
This commit is contained in:
parent
fde841c037
commit
bf7f7f0bca
@ -1,4 +1,23 @@
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
import logging
|
||||
import pprint
|
||||
|
||||
def format_now():
|
||||
return datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S')
|
||||
os.environ['ECD_BASEDIR'] = os.path.join( os.path.dirname(__file__))
|
||||
if os.path.exists(os.path.join(os.path.dirname(__file__), 'share')):
|
||||
os.environ['PROJ_LIB'] = os.path.join(os.path.dirname(__file__), 'share/proj')
|
||||
os.environ['GDAL_DATA'] = os.path.join(os.path.dirname(__file__), 'share')
|
||||
|
||||
BASE_DIR = os.path.join( os.path.dirname(__file__))
|
||||
os.makedirs(os.path.join(BASE_DIR, 'logs'), exist_ok=True)
|
||||
|
||||
logging.basicConfig(level=logging.INFO, filename=os.path.join(BASE_DIR, 'logs', format_now() + '_log.txt'), filemode='a', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
logging.info('sys path :' + pprint.pformat(sys.path))
|
||||
logging.info('os.environ :' + pprint.pformat(os.environ))
|
||||
|
||||
import time
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QFont, QPixmap
|
||||
@ -6,21 +25,21 @@ from PyQt5.QtWidgets import QSplashScreen, QProgressBar, QStyleFactory, QMessage
|
||||
from qgis.core import QgsApplication
|
||||
# from qgis.core import
|
||||
from rscder.gui.mainwindow import MainWindow
|
||||
import multiprocessing
|
||||
from rscder.gui import license
|
||||
from rscder.utils.setting import Settings
|
||||
import os
|
||||
BASE_DIR = os.environ['ECD_BASEDIR']
|
||||
|
||||
class MulStart:
|
||||
|
||||
def __init__(self, **kargs) -> None:
|
||||
super(MulStart, self).__init__()
|
||||
self.kargs = kargs
|
||||
def run(self):
|
||||
|
||||
app = QgsApplication([], True)
|
||||
QgsApplication.setPrefixPath('qgis', True)
|
||||
QgsApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
|
||||
QgsApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||
QgsApplication.setOrganizationName("西安理工大学-ImgSciGroup")
|
||||
QgsApplication.setOrganizationName("ImgSciGroup")
|
||||
QgsApplication.setApplicationName("Easy Change Detection")
|
||||
QgsApplication.setApplicationVersion("v0.0.1")
|
||||
QgsApplication.setFont(QFont("Segoe UI", 10))
|
||||
@ -30,7 +49,7 @@ class MulStart:
|
||||
# pyrcc5 res.qrc -o rc.py
|
||||
# import rscder.rc
|
||||
|
||||
app = QgsApplication([], True)
|
||||
|
||||
QgsApplication.initQgis()
|
||||
while not Settings.General().license:
|
||||
QMessageBox.warning(None, "Warning", "Please select a license file.")
|
||||
@ -66,3 +85,12 @@ class MulStart:
|
||||
splash.finish(ex)
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
def main():
|
||||
# print(sys.path)
|
||||
t = MulStart()
|
||||
t.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
main()
|
@ -2,8 +2,8 @@ import os
|
||||
|
||||
# os.environ['PROJ_LIB'] = os.path.join(os.path.dirname(__file__), 'share/proj')
|
||||
# os.environ['GDAL_DATA'] = os.path.join(os.path.dirname(__file__), 'share')
|
||||
os.environ['ECD_BASEDIR'] = os.path.join( os.path.dirname(__file__), '..')
|
||||
BASE_DIR = os.path.join( os.path.dirname(__file__), '..')
|
||||
os.environ['ECD_BASEDIR'] = os.path.join( os.path.dirname(__file__))
|
||||
BASE_DIR = os.path.join( os.path.dirname(__file__))
|
||||
|
||||
from rscder.gui.keygen import LicenseGen
|
||||
from PyQt5.QtWidgets import QApplication
|
1
lic/license.lic
Normal file
1
lic/license.lic
Normal file
@ -0,0 +1 @@
|
||||
U2cvLo/waByK0JLEzMsbuevhDgvFdw9E2wATS9YnC1NrtbmcSH9Rb3F2Bn5G8D8AruY/+S4tf+Lj5PRRyUXubyM2e6erbEYW7HnA9BZljgLMHnmrxpiW1woR6OEWzhJH6Y6GILPn7S0esv4oO3JjRyDRYXecz/lw58wkdZbHktpNVKfjoe827/aKa7gmYNXO
|
@ -1,5 +0,0 @@
|
||||
2023-03-25 11:00:10,230 - root - INFO - lic data:2033-01-01 00:00:00
|
||||
2023-03-25 11:00:10,230 - root - INFO - remain_days: 3569
|
||||
2023-03-25 11:00:11,182 - root - INFO - lic data:2033-01-01 00:00:00
|
||||
2023-03-25 11:00:11,182 - root - INFO - remain_days: 3569
|
||||
2023-03-25 11:00:30,172 - root - INFO - nothing
|
@ -1,4 +0,0 @@
|
||||
2023-03-25 11:02:32,812 - root - INFO - lic data:2033-01-01 00:00:00
|
||||
2023-03-25 11:02:32,812 - root - INFO - remain_days: 3569
|
||||
2023-03-25 11:02:33,761 - root - INFO - lic data:2033-01-01 00:00:00
|
||||
2023-03-25 11:02:33,761 - root - INFO - remain_days: 3569
|
@ -1 +0,0 @@
|
||||
from about.main import *
|
@ -1 +0,0 @@
|
||||
from change_rate.main import *
|
@ -1 +0,0 @@
|
||||
from evaluation.main import *
|
@ -1 +0,0 @@
|
||||
from export_to.main import *
|
@ -1,5 +0,0 @@
|
||||
from misc import Register
|
||||
|
||||
FOLLOW = Register('流程')
|
||||
|
||||
from follow.main import *
|
@ -1,63 +0,0 @@
|
||||
- author: RSCDER
|
||||
description: "\u5173\u4E8E"
|
||||
enabled: true
|
||||
module: about
|
||||
name: "\u5173\u4E8E"
|
||||
path: ./plugin\about
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: ExportTo
|
||||
enabled: true
|
||||
module: export_to
|
||||
name: ExportTo
|
||||
path: ./plugin\export_to
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: FilterCollection
|
||||
enabled: true
|
||||
module: filter_collection
|
||||
name: FilterCollection
|
||||
path: ./plugin\filter_collection
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: Evaluation
|
||||
enabled: true
|
||||
module: evaluation
|
||||
name: Evaluation
|
||||
path: ./plugin\evaluation
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: UnsupervisedPlugin
|
||||
enabled: true
|
||||
module: unsupervised_method
|
||||
name: UnsupervisedPlugin
|
||||
path: ./plugin\unsupervsied_method
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: VegatationPlugin
|
||||
enabled: true
|
||||
module: veg_method
|
||||
name: VegatationPlugin
|
||||
path: ./plugin\veg_method
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: set Change Rate
|
||||
enabled: true
|
||||
module: change_rate
|
||||
name: set_change_rate
|
||||
path: ./plugin\change_rate
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: Follow box
|
||||
enabled: true
|
||||
module: follow
|
||||
name: FollowPlugin
|
||||
path: ./plugin\follow
|
||||
version: 1.0.0
|
||||
- author: RSCDER
|
||||
description: AI CD
|
||||
enabled: true
|
||||
module: ai_method
|
||||
name: AIPlugin
|
||||
path: ./plugin\ai_method
|
||||
version: 1.0.0
|
@ -1,5 +0,0 @@
|
||||
from misc import Register
|
||||
|
||||
THRES = Register('阈值方法')
|
||||
|
||||
from thres.main import *
|
@ -1 +0,0 @@
|
||||
from unsupervised_method.main import *
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
from veg_method.main import *
|
@ -1,29 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
# sys.path.insert(0, os.path.dirname(__file__))
|
||||
# sys.path.insert(0, os.path.join('..', os.path.dirname(__file__), 'libs'))
|
||||
# os.environ['PROJ_LIB'] = os.path.join(os.path.dirname(__file__), 'share/proj')
|
||||
# os.environ['GDAL_DATA'] = os.path.join(os.path.dirname(__file__), 'share')
|
||||
os.environ['ECD_BASEDIR'] = os.path.join( os.path.dirname(__file__), '..')
|
||||
BASE_DIR = os.path.join( os.path.dirname(__file__), '..')
|
||||
# import ctypes
|
||||
|
||||
# ctypes.windll.LoadLibrary()
|
||||
|
||||
from rscder.mul.mulstart import MulStart
|
||||
import logging
|
||||
from plugins.misc import format_now
|
||||
|
||||
os.makedirs(os.path.join(BASE_DIR, 'logs'), exist_ok=True)
|
||||
|
||||
logging.basicConfig(level=logging.INFO, filename=os.path.join(BASE_DIR, 'logs', format_now() + '_log.txt'), filemode='a', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
|
||||
|
||||
def main():
|
||||
# print(sys.path)
|
||||
t = MulStart()
|
||||
t.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
main()
|
@ -9,7 +9,6 @@ from rscder.gui.project import Create
|
||||
from rscder.utils.icons import IconInstance
|
||||
from rscder.utils.project import Project
|
||||
from rscder.utils.misc import singleton
|
||||
from rscder.gui.plugins import PluginDialog
|
||||
from rscder.utils.setting import Settings
|
||||
from rscder.gui.load import loader
|
||||
from functools import partial
|
||||
@ -77,7 +76,7 @@ class ActionManager(QtCore.QObject):
|
||||
self.export_menu = self.postop_menu.addMenu(IconInstance().DOCUMENT,'&结果导出')
|
||||
|
||||
self.view_menu = menubar.addMenu('&视图')
|
||||
self.plugin_menu = menubar.addMenu('&插件')
|
||||
# self.plugin_menu = menubar.addMenu('&插件')
|
||||
self.help_menu = menubar.addMenu( '&帮助')
|
||||
|
||||
# vbox = QVBoxLayout()
|
||||
@ -191,16 +190,16 @@ class ActionManager(QtCore.QObject):
|
||||
'''
|
||||
Plugin menu
|
||||
'''
|
||||
plugin_list = self.add_action(QAction(IconInstance().PLUGINS,'&插件列表', self.w_parent), 'Plugin')
|
||||
plugin_list.triggered.connect(self.plugin_list)
|
||||
# plugin_list = self.add_action(QAction(IconInstance().PLUGINS,'&插件列表', self.w_parent), 'Plugin')
|
||||
# plugin_list.triggered.connect(self.plugin_list)
|
||||
|
||||
# toolbar = self.add_toolbar('Plugin')
|
||||
# toolbar.addAction(plugin_list)
|
||||
|
||||
self.plugin_menu.addAction(plugin_list)
|
||||
# self.plugin_menu.addAction(plugin_list)
|
||||
|
||||
self.message_box.info('菜单初始化完成')
|
||||
self.message_box.info(self.actions.keys())
|
||||
|
||||
|
||||
'''
|
||||
Enabled actions
|
||||
@ -228,9 +227,6 @@ class ActionManager(QtCore.QObject):
|
||||
lic_end_date.setText('有效期至:%s' % (Settings.General().end_date))
|
||||
self.status_bar.addPermanentWidget(lic_end_date)
|
||||
|
||||
def plugin_list(self):
|
||||
dialog = PluginDialog(self.w_parent)
|
||||
dialog.show()
|
||||
|
||||
def project_create(self):
|
||||
project = Project()
|
||||
|
@ -15,7 +15,7 @@ from rscder.utils.icons import IconInstance
|
||||
from rscder.utils.project import Project
|
||||
from rscder.gui.layercombox import LayerCombox
|
||||
from rscder.gui.eagle_eye import eagleEye
|
||||
|
||||
import pprint
|
||||
class MainWindow(QMainWindow):
|
||||
|
||||
closed = pyqtSignal()
|
||||
@ -51,7 +51,7 @@ class MainWindow(QMainWindow):
|
||||
self.action_manager.set_status_bar(self.statusBar())
|
||||
self.action_manager.set_actions()
|
||||
|
||||
PluginLoader(dict(
|
||||
plugin_loader = PluginLoader(dict(
|
||||
layer_tree=self.layer_tree,
|
||||
pair_canvas=self.double_map,
|
||||
message_box=self.message_box,
|
||||
@ -59,7 +59,10 @@ class MainWindow(QMainWindow):
|
||||
mainwindow=self,
|
||||
toolbar=self.toolbar,
|
||||
statusbar=self.statusBar(),
|
||||
)).load_plugin()
|
||||
))
|
||||
plugin_loader.load_plugin()
|
||||
|
||||
self.message_box.info(pprint.pformat(plugin_loader.plugins.keys()))
|
||||
|
||||
self.resize(*Settings.General().size)
|
||||
|
||||
|
@ -1,128 +0,0 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtCore import Qt
|
||||
from rscder.plugins.loader import PluginLoader
|
||||
from rscder.utils.icons import IconInstance
|
||||
from rscder.utils.setting import Settings
|
||||
|
||||
class PluginDialog(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle('插件')
|
||||
self.setWindowIcon(IconInstance().PLUGINS)
|
||||
self.setMinimumWidth(900)
|
||||
self.setMinimumHeight(600)
|
||||
self.plugins = list(Settings.Plugin().plugins)
|
||||
|
||||
self.plugin_table = QTableWidget(len(self.plugins), 3, self)
|
||||
self.plugin_table.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
||||
self.plugin_table.setColumnWidth(0, 200)
|
||||
self.plugin_table.setColumnWidth(1, 500)
|
||||
self.plugin_table.setHorizontalHeaderLabels(['名称', '模块ID', '启用'])
|
||||
self.plugin_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
|
||||
self.plugin_table.cellDoubleClicked.connect(self.edit_plugin)
|
||||
for idx, plugin in enumerate(self.plugins):
|
||||
name_item = QTableWidgetItem(plugin['name'])
|
||||
module_item = QTableWidgetItem(plugin['module'])
|
||||
enabled_item = QTableWidgetItem('启用')
|
||||
enabled_item.setCheckState(Qt.Checked if plugin['enabled'] else Qt.Unchecked)
|
||||
|
||||
self.plugin_table.setItem(idx, 0, name_item)
|
||||
self.plugin_table.setItem(idx, 1, module_item)
|
||||
self.plugin_table.setItem(idx, 2, enabled_item)
|
||||
|
||||
self.add_button = QPushButton('添加', self)
|
||||
self.add_button.clicked.connect(self.add_plugin)
|
||||
self.remove_button = QPushButton('移除', self)
|
||||
self.remove_button.clicked.connect(self.remove_plugin)
|
||||
self.save_button = QPushButton('保存', self)
|
||||
self.save_button.clicked.connect(self.save_plugin)
|
||||
self.cancel_button = QPushButton('取消', self)
|
||||
self.cancel_button.clicked.connect(self.close)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.addWidget(self.plugin_table)
|
||||
hlayout = QHBoxLayout()
|
||||
hlayout.addWidget(self.add_button)
|
||||
hlayout.addWidget(self.remove_button)
|
||||
hlayout.addWidget(self.save_button)
|
||||
hlayout.addWidget(self.cancel_button)
|
||||
layout.addLayout(hlayout)
|
||||
self.setLayout(layout)
|
||||
self.has_change = False
|
||||
|
||||
def add_plugin(self):
|
||||
plugin_directory = QFileDialog.getExistingDirectory(self, 'Select Plugin Directory', '.')
|
||||
if plugin_directory is not None:
|
||||
info = PluginLoader.load_plugin_info(plugin_directory)
|
||||
logging.info(info)
|
||||
|
||||
if info is not None:
|
||||
try:
|
||||
dst = PluginLoader.copy_plugin_to_3rd(plugin_directory)
|
||||
except:
|
||||
QMessageBox.warning(self, 'Warning', 'Failed to copy plugin to 3rd party directory')
|
||||
return
|
||||
|
||||
info['module'] = os.path.basename(plugin_directory)
|
||||
info['enabled'] = True
|
||||
info['path'] = dst
|
||||
self.has_change = True
|
||||
|
||||
self.plugin_table.insertRow(self.plugin_table.rowCount())
|
||||
name_item = QTableWidgetItem(info['name'])
|
||||
name_item.setIcon(IconInstance().TOOLBOX)
|
||||
module_item = QTableWidgetItem(info['module'])
|
||||
enabled_item = QTableWidgetItem('启用')
|
||||
enabled_item.setCheckState(Qt.Checked)
|
||||
self.plugin_table.setItem(self.plugin_table.rowCount() - 1, 0, name_item)
|
||||
self.plugin_table.setItem(self.plugin_table.rowCount() - 1, 1, module_item)
|
||||
self.plugin_table.setItem(self.plugin_table.rowCount() - 1, 2, enabled_item)
|
||||
self.plugins.append(info)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
def remove_plugin(self):
|
||||
self.has_change = True
|
||||
row_ids = list( row.row() for row in self.plugin_table.selectionModel().selectedRows())
|
||||
row_ids.sort(reverse=True)
|
||||
for row in row_ids:
|
||||
self.plugin_table.removeRow(row)
|
||||
info = self.plugins.pop(row)
|
||||
try:
|
||||
shutil.rmtree(info['path'])
|
||||
except Exception as e:
|
||||
# logging
|
||||
logging.info(e)
|
||||
pass
|
||||
# for idx in self.plugins
|
||||
|
||||
def edit_plugin(self, row, column):
|
||||
self.has_change = True
|
||||
if column == 2:
|
||||
self.plugin_table.item(row, column).setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
|
||||
|
||||
def save_plugin(self):
|
||||
|
||||
for idx in range(self.plugin_table.rowCount()):
|
||||
enabled = self.plugin_table.item(idx, 2).checkState() == Qt.Checked
|
||||
self.plugins[idx]['enabled'] = enabled
|
||||
Settings.Plugin().plugins = self.plugins
|
||||
self.has_change = False
|
||||
self.close()
|
||||
|
||||
def closeEvent(self, event):
|
||||
if self.has_change:
|
||||
reply = QMessageBox.question(self, 'Message', "Do you want to save the changes?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
|
||||
if reply == QMessageBox.Yes:
|
||||
self.save_plugin()
|
||||
event.accept()
|
||||
else:
|
||||
event.accept()
|
||||
else:
|
||||
event.accept()
|
1
rscder/plugins/about/__init__.py
Normal file
1
rscder/plugins/about/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .main import *
|
1
rscder/plugins/change_rate/__init__.py
Normal file
1
rscder/plugins/change_rate/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .main import *
|
1
rscder/plugins/evaluation/__init__.py
Normal file
1
rscder/plugins/evaluation/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .main import *
|
1
rscder/plugins/export_to/__init__.py
Normal file
1
rscder/plugins/export_to/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .main import *
|
@ -1,9 +1,9 @@
|
||||
from misc import Register
|
||||
from rscder.plugins.misc import Register
|
||||
|
||||
FILTER = Register('滤波处理算法')
|
||||
|
||||
from .mean_filter import MeanFilter
|
||||
from filter_collection.main import *
|
||||
from rscder.plugins.filter_collection.main import *
|
||||
from .morphology_filter import MorphologyFilter
|
||||
from .bilater_filter import BilaterFilter
|
||||
from .lee_filter import LeeFilter
|
@ -1,9 +1,9 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
@ -1,9 +1,9 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
@ -1,18 +1,16 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
||||
from rscder.utils.icons import IconInstance
|
||||
import os
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
import cv2
|
||||
from tqdm import tqdm
|
||||
def adaptiveMedianDeNoise(count, image):
|
@ -1,9 +1,9 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
||||
@ -11,9 +11,6 @@ from rscder.utils.icons import IconInstance
|
||||
import os
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
import pandas as pd
|
||||
import cv2
|
||||
from tqdm import tqdm
|
||||
def adaptiveMedianDeNoise(count, image):
|
@ -12,8 +12,8 @@ from rscder.gui.layercombox import RasterLayerCombox
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from misc import AlgFrontend, AlgSelectWidget
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from rscder.plugins.misc import AlgFrontend, AlgSelectWidget
|
||||
import functools
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
@ -1,9 +1,9 @@
|
||||
from misc import AlgFrontend
|
||||
from misc.utils import format_now
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.misc.utils import format_now
|
||||
from osgeo import gdal, gdal_array
|
||||
from skimage.filters import rank
|
||||
from skimage.morphology import rectangle
|
||||
from filter_collection import FILTER
|
||||
from rscder.plugins.filter_collection import FILTER
|
||||
from PyQt5.QtWidgets import QDialog, QAction
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from rscder.utils.project import PairLayer, Project, RasterLayer, ResultPointLayer
|
5
rscder/plugins/follow/__init__.py
Normal file
5
rscder/plugins/follow/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from rscder.plugins.misc import Register
|
||||
|
||||
FOLLOW = Register('流程')
|
||||
|
||||
from .main import *
|
@ -4,8 +4,8 @@ from rscder.plugins.basic import BasicPlugin
|
||||
from rscder.utils.icons import IconInstance
|
||||
from rscder.gui.actions import ActionManager
|
||||
from PyQt5 import QtWidgets, QtGui
|
||||
from follow import FOLLOW
|
||||
from misc import AlgFrontend
|
||||
from . import FOLLOW
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
|
||||
class FollowDialog(QtWidgets.QDialog):
|
||||
|
@ -9,6 +9,19 @@ import os
|
||||
import sys
|
||||
import inspect
|
||||
|
||||
from rscder.plugins.about import AboutPlugin
|
||||
from rscder.plugins.change_rate import RateSetPlugin
|
||||
from rscder.plugins.evaluation import EvaluationPlugin
|
||||
from rscder.plugins.export_to import ExportPlugin
|
||||
from rscder.plugins.filter_collection import MainPlugin as FilterPlugin
|
||||
from rscder.plugins.follow import FollowPlugin
|
||||
from rscder.plugins.unsupervised_method import UnsupervisedPlugin
|
||||
from rscder.plugins.veg_method import VegtationPlugin
|
||||
|
||||
PLUGINS = [
|
||||
AboutPlugin, RateSetPlugin, EvaluationPlugin, ExportPlugin, FilterPlugin, FollowPlugin, UnsupervisedPlugin, VegtationPlugin
|
||||
]
|
||||
|
||||
class PluginLoader(QObject):
|
||||
|
||||
plugin_loaded = pyqtSignal()
|
||||
@ -16,7 +29,7 @@ class PluginLoader(QObject):
|
||||
def __init__(self, ctx):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self.plugins = []
|
||||
self.plugins = dict()
|
||||
|
||||
@staticmethod
|
||||
def copy_plugin_to_3rd(dir, random_suffix=True):
|
||||
@ -48,19 +61,11 @@ class PluginLoader(QObject):
|
||||
return info
|
||||
|
||||
def load_plugin(self):
|
||||
plugins = Settings.Plugin().plugins
|
||||
if Settings.Plugin().root not in sys.path:
|
||||
sys.path.insert(0, Settings.Plugin().root)
|
||||
for plugin in plugins:
|
||||
# path = plugin['path']
|
||||
if not plugin['enabled']:
|
||||
continue
|
||||
|
||||
for plugin in PLUGINS:
|
||||
|
||||
try:
|
||||
module = importlib.import_module(plugin['module'])
|
||||
for oname, obj in inspect.getmembers(module):
|
||||
if inspect.isclass(obj) and issubclass(obj, BasicPlugin) and obj != BasicPlugin and obj != PluginLoader:
|
||||
self.plugins.append(obj(self.ctx))
|
||||
break
|
||||
self.plugins[plugin.__name__] = plugin(self.ctx)
|
||||
except Exception as e:
|
||||
# import traceback
|
||||
# traceback.print_exc()
|
||||
|
5
rscder/plugins/thres/__init__.py
Normal file
5
rscder/plugins/thres/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from rscder.plugins.misc import Register
|
||||
|
||||
THRES = Register('阈值方法')
|
||||
|
||||
from .main import *
|
@ -1,8 +1,8 @@
|
||||
from osgeo import gdal, gdalconst
|
||||
from rscder.utils.project import Project
|
||||
import os
|
||||
from misc import AlgFrontend
|
||||
from thres import THRES
|
||||
from rscder.plugins.misc import AlgFrontend
|
||||
from rscder.plugins.thres import THRES
|
||||
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QLineEdit
|
||||
from PyQt5.QtGui import QIntValidator, QDoubleValidator
|
||||
|
1
rscder/plugins/unsupervised_method/__init__.py
Normal file
1
rscder/plugins/unsupervised_method/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .main import *
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user