Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
graintracking
DCT
Commits
dc5d9e33
Commit
dc5d9e33
authored
6 years ago
by
Nicola VIGANO
Browse files
Options
Downloads
Patches
Plain Diff
gtFigure: added point plotting, and fixed small bug with multiple insets
Signed-off-by:
Nicola VIGANO
<
N.R.Vigano@cwi.nl
>
parent
40667033
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_Drawing/gtFigureAddExtras.m
+19
-6
19 additions, 6 deletions
zUtil_Drawing/gtFigureAddExtras.m
zUtil_Drawing/gtFigureCreateExtras.m
+11
-0
11 additions, 0 deletions
zUtil_Drawing/gtFigureCreateExtras.m
with
30 additions
and
6 deletions
zUtil_Drawing/gtFigureAddExtras.m
+
19
−
6
View file @
dc5d9e33
...
...
@@ -2,19 +2,20 @@ function gtFigureAddExtras(ax, im_props, extras)
% function gtFigureAddExtras(ax, im_props, extras)
num_extras
=
numel
(
extras
);
original_image
=
permute
(
getimage
(
ax
),
[
2
1
3
]);
if
(
iscell
(
extras
))
for
ii_ex
=
1
:
num_extras
apply_extras
(
ax
,
im_props
,
extras
{
ii_ex
})
apply_extras
(
ax
,
im_props
,
extras
{
ii_ex
}
,
original_image
)
end
else
for
ii_ex
=
1
:
num_extras
apply_extras
(
ax
,
im_props
,
extras
(
ii_ex
))
apply_extras
(
ax
,
im_props
,
extras
(
ii_ex
)
,
original_image
)
end
end
end
function
apply_extras
(
ax
,
im_props
,
extras
)
function
apply_extras
(
ax
,
im_props
,
extras
,
original_image
)
switch
(
extras
.
type
)
case
'unit_bar'
add_unit_bar
(
ax
,
im_props
,
extras
);
...
...
@@ -22,6 +23,8 @@ function apply_extras(ax, im_props, extras)
add_line
(
ax
,
im_props
,
extras
)
case
'box'
add_box
(
ax
,
extras
)
case
'point'
add_point
(
ax
,
extras
)
case
'text'
add_text
(
ax
,
extras
)
case
'arrow'
...
...
@@ -29,7 +32,7 @@ function apply_extras(ax, im_props, extras)
case
'segment'
add_segment
(
ax
,
extras
)
case
'inset_zoom'
add_inset
(
ax
,
extras
,
'zoom'
)
add_inset
(
ax
,
extras
,
'zoom'
,
original_image
)
case
'inset_image'
add_inset
(
ax
,
extras
,
'image'
)
end
...
...
@@ -118,6 +121,15 @@ function add_box(ax, ex_props)
'LineWidth'
,
ex_props
.
line_width
,
'LineStyle'
,
ex_props
.
line_style
)
end
function
add_point
(
ax
,
ex_props
)
x
=
ex_props
.
position
(
1
);
y
=
ex_props
.
position
(
2
);
hold
(
ax
,
'on'
)
scatter
(
x
,
y
,
ex_props
.
size
,
ex_props
.
color
,
ex_props
.
style
,
'filled'
,
'parent'
,
ax
);
hold
(
ax
,
'off'
)
end
function
add_text
(
ax
,
ex_props
)
text
(
ex_props
.
position
(
1
),
ex_props
.
position
(
2
),
ex_props
.
string
,
...
'parent'
,
ax
,
'Color'
,
ex_props
.
color
,
...
...
...
@@ -149,11 +161,11 @@ function add_segment(ax, ex_props)
'LineWidth'
,
ex_props
.
line_width
,
'LineStyle'
,
ex_props
.
line_style
)
end
function
add_inset
(
ax
,
ex_props
,
type
)
function
add_inset
(
ax
,
ex_props
,
type
,
original_image
)
switch
(
lower
(
type
))
case
'zoom'
cdata
=
permute
(
getimage
(
ax
),
[
2
1
3
])
;
cdata
=
original_image
;
method_type
=
'nearest'
;
oversampling
=
[
1
,
1
];
...
...
@@ -177,6 +189,7 @@ function add_inset(ax, ex_props, type)
end
yy
=
linspace
(
region_start
(
1
),
region_end
(
1
),
ex_props
.
position
(
3
)
*
oversampling
(
1
));
xx
=
linspace
(
region_start
(
2
),
region_end
(
2
),
ex_props
.
position
(
4
)
*
oversampling
(
2
));
if
(
numel
(
size
(
cdata
))
==
3
)
zz
=
[
1
2
3
];
[
xx
,
yy
,
zz
]
=
ndgrid
(
xx
,
yy
,
zz
);
...
...
This diff is collapsed.
Click to expand it.
zUtil_Drawing/gtFigureCreateExtras.m
+
11
−
0
View file @
dc5d9e33
...
...
@@ -6,6 +6,8 @@ function extras = gtFigureCreateExtras(type, varargin)
extras = create_line(varargin{:});
case 'box'
extras = create_box(varargin{:});
case 'point'
extras = create_point(varargin{:});
case 'text'
extras = create_text(varargin{:});
case 'arrow'
...
...
@@ -52,6 +54,15 @@ function extras = create_box(varargin)
extras = parse_pv_pairs(extras, varargin);
end
function extras = create_point(varargin)
extras = struct( ...
'size', 20, ...
'style', 'o', ...
'position', [1 1], ...
'color', [1 1 1] );
extras = parse_pv_pairs(extras, varargin);
end
function extras = create_text(varargin)
extras = struct( ...
'string', '', ...
...
...
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