Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diapotb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luc Hermitte
diapotb
Commits
9c95fa4f
Commit
9c95fa4f
authored
6 years ago
by
Gaëlle USSEGLIO
Browse files
Options
Downloads
Patches
Plain Diff
UPDATE: Add Simu_SAR step into DiapOTB chain
parent
7b2b61ea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_src/diapOTB.py
+31
-10
31 additions, 10 deletions
python_src/diapOTB.py
python_src/ex_config.ini
+5
-0
5 additions, 0 deletions
python_src/ex_config.ini
with
36 additions
and
10 deletions
python_src/diapOTB.py
+
31
−
10
View file @
9c95fa4f
...
...
@@ -58,12 +58,13 @@ def ConfigSectionMap(config, section):
def
ConfigCheck
(
config
):
configOk
=
True
# List for configuration
listOfSections
=
[
"
Global
"
,
"
MultiLook
"
,
"
Doppler0
"
]
globalList
=
[
"
Master_Image_Path
"
,
"
Slave_Image_Path
"
,
"
output_dir
"
]
listOfSections
=
[
"
Global
"
,
"
MultiLook
"
,
"
Doppler0
"
,
"
Simu_SAR
"
]
globalList
=
[
"
Master_Image_Path
"
,
"
Slave_Image_Path
"
,
"
DEM_Path
"
,
"
output_dir
"
]
MLList
=
[
"
range
"
,
"
azimut
"
,
"
gain
"
]
Doppler0List
=
[
"
doppler_file
"
]
SimuSARList
=
[
"
range
"
,
"
azimut
"
,
"
gain
"
]
dictOfSections
=
{
'
Global
'
:
globalList
,
'
MultiLook
'
:
MLList
,
'
Doppler0
'
:
Doppler0List
}
dictOfSections
=
{
'
Global
'
:
globalList
,
'
MultiLook
'
:
MLList
,
'
Doppler0
'
:
Doppler0List
,
'
Simu_SAR
'
:
SimuSARList
}
# For each elt of listOfSections
for
section
in
listOfSections
:
...
...
@@ -107,12 +108,17 @@ if __name__ == "__main__":
# Get elements from configuration file
master_Image
=
ConfigSectionMap
(
Config
,
"
Global
"
)[
'
master_image_path
'
]
slave_Image
=
ConfigSectionMap
(
Config
,
"
Global
"
)[
'
slave_image_path
'
]
dem
=
ConfigSectionMap
(
Config
,
"
Global
"
)[
'
dem_path
'
]
output_dir
=
ConfigSectionMap
(
Config
,
"
Global
"
)[
'
output_dir
'
]
ml_range
=
int
(
ConfigSectionMap
(
Config
,
"
MultiLook
"
)[
'
range
'
])
ml_azimut
=
int
(
ConfigSectionMap
(
Config
,
"
MultiLook
"
)[
'
azimut
'
])
ml_gain
=
float
(
ConfigSectionMap
(
Config
,
"
MultiLook
"
)[
'
gain
'
])
ml_simu_range
=
int
(
ConfigSectionMap
(
Config
,
"
Simu_SAR
"
)[
'
range
'
])
ml_simu_azimut
=
int
(
ConfigSectionMap
(
Config
,
"
Simu_SAR
"
)[
'
azimut
'
])
ml_simu_gain
=
float
(
ConfigSectionMap
(
Config
,
"
Simu_SAR
"
)[
'
gain
'
])
dop_file
=
ConfigSectionMap
(
Config
,
"
Doppler0
"
)[
'
doppler_file
'
]
# Check if images exist
...
...
@@ -122,6 +128,9 @@ if __name__ == "__main__":
if
not
os
.
path
.
exists
(
slave_Image
)
:
print
slave_Image
+
"
does not exists
"
quit
()
if
not
os
.
path
.
exists
(
dem
)
:
print
dem
+
"
does not exists
"
quit
()
if
not
os
.
path
.
exists
(
output_dir
):
print
"
The output directory does not exist and will be created
"
os
.
makedirs
(
output_dir
)
...
...
@@ -132,7 +141,7 @@ if __name__ == "__main__":
slave_Image_base
=
os
.
path
.
basename
(
slave_Image
)
####################### Doppler Application ##########################
#######################
SAR
Doppler Application ##########################
# Master
dopFile
=
open
(
os
.
path
.
join
(
output_dir
,
dop_file
),
"
w
"
)
dopFile
.
write
(
"
Doppler for master image :
"
+
os
.
path
.
basename
(
master_Image_base
)
+
"
\n
"
)
...
...
@@ -150,28 +159,40 @@ if __name__ == "__main__":
appDoppler0Slave
=
otb
.
Registry
.
CreateApplication
(
"
SARDoppler0
"
)
appDoppler0Slave
.
SetParameterString
(
"
in
"
,
slave_Image
)
appDoppler0Slave
.
SetParameterString
(
"
outfile
"
,
os
.
path
.
join
(
output_dir
,
dop_file
))
appDoppler0
Master
.
SetParameterInt
(
"
ram
"
,
4000
)
appDoppler0
Slave
.
SetParameterInt
(
"
ram
"
,
4000
)
appDoppler0Slave
.
ExecuteAndWriteOutput
()
###################### MultiLook Application #########################
######################
SAR
MultiLook Application #########################
# Master
master_Image_ML
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_ml.tif
"
appMultiLookMaster
=
otb
.
Registry
.
CreateApplication
(
"
SARMultiLook
"
)
appMultiLookMaster
.
SetParameterString
(
"
in
"
,
master_Image
)
appMultiLookMaster
.
SetParameterString
(
"
in
complex
"
,
master_Image
)
appMultiLookMaster
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
master_Image_ML
))
appMultiLookMaster
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appMultiLookMaster
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appMultiLookMaster
.
SetParameterFloat
(
"
mlgain
"
,
ml_gain
)
app
Doppler0
Master
.
SetParameterInt
(
"
ram
"
,
4000
)
app
MultiLook
Master
.
SetParameterInt
(
"
ram
"
,
4000
)
appMultiLookMaster
.
ExecuteAndWriteOutput
()
# Slave
slave_Image_ML
=
os
.
path
.
splitext
(
slave_Image_base
)[
0
]
+
"
_ml.tif
"
appMultiLookSlave
=
otb
.
Registry
.
CreateApplication
(
"
SARMultiLook
"
)
appMultiLookSlave
.
SetParameterString
(
"
in
"
,
slave_Image
)
appMultiLookSlave
.
SetParameterString
(
"
in
complex
"
,
slave_Image
)
appMultiLookSlave
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
slave_Image_ML
))
appMultiLookSlave
.
SetParameterInt
(
"
mlran
"
,
ml_range
)
appMultiLookSlave
.
SetParameterInt
(
"
mlazi
"
,
ml_azimut
)
appMultiLookSlave
.
SetParameterFloat
(
"
mlgain
"
,
ml_gain
)
app
Doppler0Master
.
SetParameterInt
(
"
ram
"
,
4000
)
app
MultiLookSlave
.
SetParameterInt
(
"
ram
"
,
4000
)
appMultiLookSlave
.
ExecuteAndWriteOutput
()
########### SARDEMToAmplitude Application (Simu_SAR step) ################
amplitude_simu_image
=
os
.
path
.
splitext
(
master_Image_base
)[
0
]
+
"
_simuSAR.tif
"
appDEMToAmplitude
=
otb
.
Registry
.
CreateApplication
(
"
SARDEMToAmplitude
"
)
appDEMToAmplitude
.
SetParameterString
(
"
insar
"
,
master_Image
)
appDEMToAmplitude
.
SetParameterString
(
"
indem
"
,
dem
)
appDEMToAmplitude
.
SetParameterString
(
"
out
"
,
os
.
path
.
join
(
output_dir
,
amplitude_simu_image
))
appDEMToAmplitude
.
SetParameterInt
(
"
mlran
"
,
ml_simu_range
)
appDEMToAmplitude
.
SetParameterInt
(
"
mlazi
"
,
ml_simu_azimut
)
appDEMToAmplitude
.
SetParameterFloat
(
"
mlgain
"
,
ml_simu_gain
)
appDEMToAmplitude
.
SetParameterInt
(
"
ram
"
,
4000
)
appDEMToAmplitude
.
ExecuteAndWriteOutput
()
This diff is collapsed.
Click to expand it.
python_src/ex_config.ini
+
5
−
0
View file @
9c95fa4f
[Global]
Master_Image_Path
=
image_1.tif
Slave_Image_Path
=
image_2.tif
DEM_Path
=
./DEM.hgt
output_dir
=
./output_diapOTB
[MultiLook]
...
...
@@ -11,3 +12,7 @@ gain = 0.1
[Doppler0]
doppler_file
=
dop0.txt
[Simu_SAR]
range
=
3
azimut
=
3
gain
=
1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment