Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
model_server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Christopher Randolph Rhodes
model_server
Commits
9bce8268
Commit
9bce8268
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Generalized to flattening multichannel images
parent
1092b9c5
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
extensions/chaeo/tests/test_zstack.py
+1
-1
1 addition, 1 deletion
extensions/chaeo/tests/test_zstack.py
extensions/chaeo/zmask.py
+18
-17
18 additions, 17 deletions
extensions/chaeo/zmask.py
with
19 additions
and
18 deletions
extensions/chaeo/tests/test_zstack.py
+
1
−
1
View file @
9bce8268
...
...
@@ -106,7 +106,7 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
dff
[
'
centroid-0
'
].
to_numpy
(),
dff
[
'
centroid-1
'
].
to_numpy
(),
dff
[
'
zi
'
].
to_numpy
(),
self
.
stack
.
get_one_channel_data
(
1
),
self
.
stack
)
self
.
assertEqual
(
img
.
shape
[
0
:
2
],
self
.
stack
.
shape
[
0
:
2
])
...
...
This diff is collapsed.
Click to expand it.
extensions/chaeo/zmask.py
+
18
−
17
View file @
9bce8268
...
...
@@ -154,20 +154,18 @@ def project_stack_from_focal_points(
zz
:
np
.
ndarray
,
stack
:
GenericImageDataAccessor
,
degree
:
int
=
2
,
):
# TODO: add weights
)
->
np
.
ndarray
:
"""
Given a set of 3D points, project a multichannel z-stack
:param xx:
:param yy:
:param zz:
:param stack:
:param degree:
:return:
Given a set of 3D points, project a multichannel z-stack
based on a surface fit of the provided points
:param xx:
vector of point x-coordinates
:param yy:
vector of point y-coordinates
:param zz:
vector of point z-coordinates
:param stack:
z-stack to project
:param degree:
order of polynomial to fit
:return:
multichannel 2d projected image array
"""
assert
xx
.
shape
==
yy
.
shape
assert
xx
.
shape
==
zz
.
shape
assert
stack
.
chroma
==
1
poly
=
PolynomialFeatures
(
degree
=
degree
)
X
=
np
.
stack
([
xx
,
yy
]).
T
...
...
@@ -175,20 +173,23 @@ def project_stack_from_focal_points(
model
=
LinearRegression
(
fit_intercept
=
False
)
model
.
fit
(
features
,
zz
)
output_shape
=
stack
.
hw
xy_indices
=
np
.
indices
(
output_shape
).
reshape
(
2
,
-
1
).
T
xy_indices
=
np
.
indices
(
stack
.
hw
).
reshape
(
2
,
-
1
).
T
xy_features
=
np
.
dot
(
poly
.
fit_transform
(
xy_indices
,
zz
),
model
.
coef_
)
zi_image
=
xy_features
.
reshape
(
output_shape
stack
.
hw
).
round
().
clip
(
0
,
stack
.
nz
).
astype
(
'
uint16
'
)
return
np
.
take_along_axis
(
stack
.
data
[:,
:,
0
,
:],
np
.
expand_dims
(
zi_image
,
2
),
axis
=
2
).
reshape
(
output_shape
)
stack
.
data
,
np
.
repeat
(
np
.
expand_dims
(
zi_image
,
(
2
,
3
)),
stack
.
chroma
,
axis
=
2
),
axis
=
3
)
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