Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Superflat_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OPTIQUE
LEAPS
Superflat_scripts
Commits
773080b7
Commit
773080b7
authored
Jun 27, 2023
by
Francois POLACK
Browse files
Options
Downloads
Patches
Plain Diff
feat: Added Heightmap clipping and ability to flip the recorded view when
data are acquired upside down
parent
5f107453
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
activefigure.py
+1
-1
1 addition, 1 deletion
activefigure.py
heightmap.py
+14
-3
14 additions, 3 deletions
heightmap.py
with
15 additions
and
4 deletions
activefigure.py
+
1
−
1
View file @
773080b7
...
...
@@ -68,7 +68,7 @@ class ROItool(ToolBase):
# self.figure.hmap.ROIorigin=[self.figure.ROI[0],self.figure.ROI[1]]
# self.figure.hmap.ROIsize=[self.figure.ROI[2],self.figure.ROI[3]]
#print("saving ROI:",self.figure.ROI)
#
print("ROI defined")
print
(
"
ROI defined
from figure
"
)
plt
.
close
(
self
.
figure
)
...
...
This diff is collapsed.
Click to expand it.
heightmap.py
+
14
−
3
View file @
773080b7
...
...
@@ -69,6 +69,8 @@ class HeightMap(object):
self
.
ROIorigin
=
[
0
,
0
]
## (int, int) Size of the ROI in pixels (this is the size of Z, ze ... arrayss)
self
.
ROIsize
=
[
0
,
0
]
## an integer or a twoplet indicating the axis which must be reverted
self
.
flipROI
=
None
## Number of invalid values in the ROI
self
.
num_invalid
=
0
## Original fullsize height data loaded from the file.
...
...
@@ -446,19 +448,28 @@ class HeightMap(object):
format
(
title_y
,
np
.
ma
.
std
(
uu
)
*
mult
,
unit
,
(
vbounds
[
1
]
-
vbounds
[
0
])
*
mult
,
unit
))
# end print_statistics
def
clip
(
self
,
origin
,
size
):
self
.
rawZ
=
self
.
rawZ
[
origin
[
1
]:
origin
[
1
]
+
size
[
1
],
origin
[
0
]:
origin
[
0
]
+
size
[
0
]]
def
set_ROI
(
self
,
firstX
,
firstY
,
nwidth
,
nheight
):
def
set_ROI
(
self
,
firstX
,
firstY
,
nwidth
,
nheight
,
flip
=
None
):
"""
! define a rectangular ROI and set the `HeightMap.z`array accordingly
@param firstX origin of the ROI in x (pixels from `HeightMap.origin`)
\n
@param firstY origin of the ROI in y (pixels from `HeightMap.origin`)
\n
@param nwidth width of the ROI (pixels)
@param nheight height of the ROI (pixels)
@param flip int or tuple indicating the axes to flip
"""
self
.
ROIorigin
=
[
firstX
,
firstY
]
self
.
ROIsize
=
[
nwidth
,
nheight
]
if
flip
!=
None
:
self
.
flipROI
=
flip
self
.
z
=
self
.
rawZ
[
firstY
:
firstY
+
nheight
,
firstX
:
firstX
+
nwidth
]
print
(
"
\n
ROI definition:
"
)
if
self
.
flipROI
==
None
:
self
.
z
=
self
.
rawZ
[
firstY
:
firstY
+
nheight
,
firstX
:
firstX
+
nwidth
]
else
:
self
.
z
=
np
.
flip
(
self
.
rawZ
[
firstY
:
firstY
+
nheight
,
firstX
:
firstX
+
nwidth
],
self
.
flipROI
)
print
(
"
ROI axes
"
,
self
.
flipROI
,
"
are flipped over
"
)
print
(
"
original size
"
,
self
.
rawZ
.
shape
,
"
ROI size
"
,
self
.
z
.
shape
)
self
.
set_scale
((
self
.
origin
[
0
]
+
firstX
,
self
.
origin
[
1
]
+
firstY
))
#end set_ROI
...
...
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