From 97fda70fcaa1e92136c81c07623f946a5d2f3305 Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Tue, 11 Jun 2024 16:27:33 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 21 ++- dem_to_csmap.ui | 332 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 349 insertions(+), 4 deletions(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index 971134e..bf5c387 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -35,10 +35,27 @@ def __init__(self): self.ui.pushButton_cancel.clicked.connect(self.close) def convert_dem_to_csmap(self): - params = process.CsmapParams() + # パラメータの設定 + params = process.CsmapParams( + gf_size=self.ui.spinBoxGfSize.value(), # 適用範囲 + gf_sigma=self.ui.SpinBoxGfSigma.value(), # ぼかし強度 + curvature_size=self.ui.spinBoxCurvatureSize.value(), # 計算範囲 + height_scale=( + self.ui.doubleSpinBoxHeightScaleMin.value(), + self.ui.doubleSpinBoxHeightScaleMax.value(), + ), # 高度 + slope_scale=( + self.ui.doubleSpinBoxSlopeScaleMin.value(), + self.ui.doubleSpinBoxSlopeScaleMax.value(), + ), # 斜度 + curvature_scale=( + self.ui.doubleSpinBoxCurvatureScaleMin.value(), + self.ui.doubleSpinBoxCurvatureScaleMax.value(), + ), # 曲率 + ) # 入力・出力をUIで操作 - input_path = self.ui.mQgsFileWidget.filePath() + input_path = self.ui.mQgsFileWidget_input.filePath() output_path = self.ui.mQgsFileWidget_output.filePath() try: diff --git a/dem_to_csmap.ui b/dem_to_csmap.ui index 1981346..dfa982a 100644 --- a/dem_to_csmap.ui +++ b/dem_to_csmap.ui @@ -6,8 +6,8 @@ 0 0 - 389 - 191 + 496 + 476 @@ -19,16 +19,344 @@ 入力レイヤ + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + パラメーター + + + + + + + ガウシアンフィルター + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + 適用範囲 + + + Qt::AlignCenter + + + + + + + Qt::LeftToRight + + + Qt::AlignCenter + + + 1 + + + 100 + + + 12 + + + + + + + ぼかし強度 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + 100 + + + 3 + + + + + + + + + 高度 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + 最小値 + + + Qt::AlignCenter + + + + + + + Qt::LeftToRight + + + Qt::AlignCenter + + + 1 + + + 10000.000000000000000 + + + 100.000000000000000 + + + + + + + 最大値 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + 10000.000000000000000 + + + 100.000000000000000 + + + 1000.000000000000000 + + + + + + + + + 斜度 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + 最小値 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + 100.000000000000000 + + + 0.500000000000000 + + + + + + + 最大値 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + 100.000000000000000 + + + 0.500000000000000 + + + 1.500000000000000 + + + + + + + + + 曲率 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + 計算範囲 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + 100 + + + + + + + + + + + 最小値 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + -100.000000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + -0.100000000000000 + + + + + + + 最大値 + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 1 + + + -100.000000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + 0.100000000000000 + + + + + 出力レイヤ + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + From a68076045d1e92b002d66a32de7a54f205f7b5fc Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 11:05:52 +0900 Subject: [PATCH 2/7] =?UTF-8?q?UI=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=8Cmax=5Fworkers/chunk=5Fsize=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 14 +- dem_to_csmap.ui | 1003 +++++++++++++++++++++++++++++------------------ 2 files changed, 631 insertions(+), 386 deletions(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index bf5c387..1c5c894 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -37,23 +37,25 @@ def __init__(self): def convert_dem_to_csmap(self): # パラメータの設定 params = process.CsmapParams( - gf_size=self.ui.spinBoxGfSize.value(), # 適用範囲 - gf_sigma=self.ui.SpinBoxGfSigma.value(), # ぼかし強度 - curvature_size=self.ui.spinBoxCurvatureSize.value(), # 計算範囲 + gf_size=self.ui.spinBoxGfSize.value(), + gf_sigma=self.ui.SpinBoxGfSigma.value(), + curvature_size=self.ui.spinBoxCurvatureSize.value(), height_scale=( self.ui.doubleSpinBoxHeightScaleMin.value(), self.ui.doubleSpinBoxHeightScaleMax.value(), - ), # 高度 + ), slope_scale=( self.ui.doubleSpinBoxSlopeScaleMin.value(), self.ui.doubleSpinBoxSlopeScaleMax.value(), - ), # 斜度 + ), curvature_scale=( self.ui.doubleSpinBoxCurvatureScaleMin.value(), self.ui.doubleSpinBoxCurvatureScaleMax.value(), ), # 曲率 ) + process.max_workers = self.ui.spinBoxMaxWorkers.value() + # 入力・出力をUIで操作 input_path = self.ui.mQgsFileWidget_input.filePath() output_path = self.ui.mQgsFileWidget_output.filePath() @@ -62,7 +64,7 @@ def convert_dem_to_csmap(self): process.process( input_path, output_path, - chunk_size=256, + chunk_size=self.ui.spinBoxChunkSize.value(), params=params, ) except Exception as e: diff --git a/dem_to_csmap.ui b/dem_to_csmap.ui index dfa982a..c25ab27 100644 --- a/dem_to_csmap.ui +++ b/dem_to_csmap.ui @@ -6,391 +6,634 @@ 0 0 - 496 - 476 + 438 + 625 Dialog - - - - - 入力レイヤ - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - - パラメーター - - - - - - - ガウシアンフィルター - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 適用範囲 - - - Qt::AlignCenter - - - - - - - Qt::LeftToRight - - - Qt::AlignCenter - - - 1 - - - 100 - - - 12 - - - - - - - ぼかし強度 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - 100 - - - 3 - - - - - - - - - 高度 - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 最小値 - - - Qt::AlignCenter - - - - - - - Qt::LeftToRight - - - Qt::AlignCenter - - - 1 - - - 10000.000000000000000 - - - 100.000000000000000 - - - - - - - 最大値 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - 10000.000000000000000 - - - 100.000000000000000 - - - 1000.000000000000000 - - - - - - - - - 斜度 - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 最小値 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - 100.000000000000000 - - - 0.500000000000000 - - - - - - - 最大値 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - 100.000000000000000 - - - 0.500000000000000 - - - 1.500000000000000 - - - - - - - - - 曲率 - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 計算範囲 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - 100 - - - - - - - - - - - 最小値 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - -100.000000000000000 - - - 100.000000000000000 - - - 0.100000000000000 - - - -0.100000000000000 - - - - - - - 最大値 - - - Qt::AlignCenter - - - - - - - Qt::AlignCenter - - - 1 - - - -100.000000000000000 - - - 100.000000000000000 - - - 0.100000000000000 - - - 0.100000000000000 - - - - - - - - - 出力レイヤ - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - - 処理終了後,自動でウィンドウを閉じる - - - - - - - - - Cancel - - - false - - - - - - - Run - - - - - - + + + + 12 + 12 + 63 + 16 + + + + 入力レイヤ + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + 12 + 37 + 406 + 22 + + + + + + + 12 + 530 + 253 + 20 + + + + true + + + 処理終了後,自動でウィンドウを閉じる + + + + 20 + 20 + + + + + + + 12 + 69 + 63 + 16 + + + + 出力レイヤ + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + 12 + 93 + 406 + 22 + + + + + + + 205 + 585 + 100 + 25 + + + + + 135 + 30 + + + + Cancel + + + false + + + + + + 12 + 125 + 230 + 391 + + + + Options + + + + + 10 + 25 + 150 + 20 + + + + + 0 + 0 + + + + gaussian filter size + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 150 + 25 + 70 + 20 + + + + Qt::LeftToRight + + + Qt::AlignCenter + + + 1 + + + 100 + + + 12 + + + + + + 150 + 55 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + 100 + + + 3 + + + + + + 10 + 55 + 150 + 20 + + + + gaussian filter sigma + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 10 + 85 + 150 + 20 + + + + curvature filter size + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 150 + 85 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + 100 + + + + + + 10 + 110 + 150 + 20 + + + + height scale + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 120 + 110 + 30 + 20 + + + + min + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 150 + 110 + 70 + 20 + + + + Qt::LeftToRight + + + Qt::AlignCenter + + + 1 + + + 10000.000000000000000 + + + 100.000000000000000 + + + + + + 150 + 135 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + 10000.000000000000000 + + + 100.000000000000000 + + + 1000.000000000000000 + + + + + + 120 + 135 + 30 + 20 + + + + max + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 150 + 285 + 70 + 20 + + + + Qt::AlignCenter + + + 10000 + + + 256 + + + 1024 + + + + + + 10 + 285 + 150 + 20 + + + + chunk size as pixel + + + + + + 10 + 160 + 150 + 20 + + + + slope scale + + + + + + 120 + 160 + 50 + 20 + + + + + 0 + 0 + + + + + 50 + 20 + + + + min + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 120 + 185 + 50 + 20 + + + + + 0 + 0 + + + + + 50 + 20 + + + + max + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 150 + 160 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + 100.000000000000000 + + + 0.500000000000000 + + + + + + 150 + 185 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + 100.000000000000000 + + + 0.500000000000000 + + + 1.500000000000000 + + + + + + 10 + 210 + 150 + 20 + + + + curvature scale + + + + + + 120 + 210 + 30 + 20 + + + + min + + + + + + 120 + 235 + 30 + 20 + + + + max + + + + + + 150 + 210 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + -100.000000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + -0.100000000000000 + + + + + + 150 + 235 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + -100.000000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + 0.100000000000000 + + + + + + 10 + 335 + 210 + 16 + + + + max workers for multiprocessing + + + + + + 150 + 360 + 70 + 20 + + + + Qt::AlignCenter + + + 1 + + + + + + + 315 + 585 + 100 + 25 + + + + + 135 + 30 + + + + Run + + From 51a84b7ce5ef89ccb3fe34f5569da72eb27f56f1 Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 11:34:50 +0900 Subject: [PATCH 3/7] =?UTF-8?q?height=5Fscale=E3=82=92SpinBox=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=EF=BC=8Cmust=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 6 ++-- dem_to_csmap.ui | 91 ++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 53 deletions(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index 1c5c894..33ec094 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -41,8 +41,8 @@ def convert_dem_to_csmap(self): gf_sigma=self.ui.SpinBoxGfSigma.value(), curvature_size=self.ui.spinBoxCurvatureSize.value(), height_scale=( - self.ui.doubleSpinBoxHeightScaleMin.value(), - self.ui.doubleSpinBoxHeightScaleMax.value(), + self.ui.spinBoxHeightScaleMin.value(), + self.ui.spinBoxHeightScaleMax.value(), ), slope_scale=( self.ui.doubleSpinBoxSlopeScaleMin.value(), @@ -54,7 +54,7 @@ def convert_dem_to_csmap(self): ), # 曲率 ) - process.max_workers = self.ui.spinBoxMaxWorkers.value() + process.process.max_workers = self.ui.spinBoxMaxWorkers.value() # 入力・出力をUIで操作 input_path = self.ui.mQgsFileWidget_input.filePath() diff --git a/dem_to_csmap.ui b/dem_to_csmap.ui index c25ab27..6c0f65b 100644 --- a/dem_to_csmap.ui +++ b/dem_to_csmap.ui @@ -273,56 +273,6 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - 150 - 110 - 70 - 20 - - - - Qt::LeftToRight - - - Qt::AlignCenter - - - 1 - - - 10000.000000000000000 - - - 100.000000000000000 - - - - - - 150 - 135 - 70 - 20 - - - - Qt::AlignCenter - - - 1 - - - 10000.000000000000000 - - - 100.000000000000000 - - - 1000.000000000000000 - - @@ -614,6 +564,47 @@ 1 + + + + 150 + 110 + 70 + 20 + + + + Qt::AlignCenter + + + 10000 + + + 100 + + + + + + 150 + 135 + 70 + 20 + + + + Qt::AlignCenter + + + 10000 + + + 100 + + + 1000 + + From a887791d06e1dd334ec0cd2d1ac777921b87b70c Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 14:56:19 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E8=A4=87=E6=95=B0=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=81=AE=E5=85=A5=E5=8A=9B=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index 33ec094..e068df6 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -25,6 +25,7 @@ def __init__(self): # QGISでサポートされているラスタデータのみ選択可能 self.ui.mQgsFileWidget_input.setFilter("*") + self.ui.mQgsFileWidget_input.setStorageMode(QgsFileWidget.GetMultipleFiles) # 出力データの設定 self.ui.mQgsFileWidget_output.setFilter("*.tif") From e2c1d6cedcb8f16a14acbea01b821523ef8b8494 Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 17:14:07 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E5=85=A5=E5=8A=9B=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=82=92=E8=A4=87=E6=95=B0=E9=81=B8=E6=8A=9E=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index e068df6..33ec094 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -25,7 +25,6 @@ def __init__(self): # QGISでサポートされているラスタデータのみ選択可能 self.ui.mQgsFileWidget_input.setFilter("*") - self.ui.mQgsFileWidget_input.setStorageMode(QgsFileWidget.GetMultipleFiles) # 出力データの設定 self.ui.mQgsFileWidget_output.setFilter("*.tif") From 3a98ae72bda3b0de7fb2c1149e4d24f63285b680 Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 17:24:33 +0900 Subject: [PATCH 6/7] =?UTF-8?q?max=5Fworkers=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dem_to_csmap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index 33ec094..17e5ce6 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -54,7 +54,7 @@ def convert_dem_to_csmap(self): ), # 曲率 ) - process.process.max_workers = self.ui.spinBoxMaxWorkers.value() + process.process(max_workers=self.ui.spinBoxMaxWorkers.value()) # 入力・出力をUIで操作 input_path = self.ui.mQgsFileWidget_input.filePath() From ef328d670094e7e0eea2a1e7f90385c0271f9dd9 Mon Sep 17 00:00:00 2001 From: KeiTa4446 Date: Wed, 12 Jun 2024 17:30:29 +0900 Subject: [PATCH 7/7] max_workers --- dem_to_csmap.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dem_to_csmap.py b/dem_to_csmap.py index 17e5ce6..55cdaab 100644 --- a/dem_to_csmap.py +++ b/dem_to_csmap.py @@ -54,8 +54,6 @@ def convert_dem_to_csmap(self): ), # 曲率 ) - process.process(max_workers=self.ui.spinBoxMaxWorkers.value()) - # 入力・出力をUIで操作 input_path = self.ui.mQgsFileWidget_input.filePath() output_path = self.ui.mQgsFileWidget_output.filePath() @@ -66,6 +64,7 @@ def convert_dem_to_csmap(self): output_path, chunk_size=self.ui.spinBoxChunkSize.value(), params=params, + max_workers=self.ui.spinBoxMaxWorkers.value(), ) except Exception as e: iface.messageBar().pushMessage(