Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyNutil
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Harry Carey
PyNutil
Commits
8ffdf33a
Commit
8ffdf33a
authored
11 months ago
by
Sharon Yates
Browse files
Options
Downloads
Patches
Plain Diff
Fix colour "auto"
parent
efde119e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PyNutil/coordinate_extraction.py
+3
-3
3 additions, 3 deletions
PyNutil/coordinate_extraction.py
test/test10_PyNutil_web.json
+1
-1
1 addition, 1 deletion
test/test10_PyNutil_web.json
with
4 additions
and
4 deletions
PyNutil/coordinate_extraction.py
+
3
−
3
View file @
8ffdf33a
...
...
@@ -243,13 +243,13 @@ def load_segmentation(segmentation_path: str):
else
:
return
cv2
.
imread
(
segmentation_path
)
def
remove_backgroun
d
(
segmentation
:
np
.
array
):
def
detect_pixel_i
d
(
segmentation
:
np
.
array
):
"""
Remove the background from the segmentation and return the pixel id.
"""
segmentation_no_background
=
segmentation
[
~
np
.
all
(
segmentation
==
0
,
axis
=
2
)]
print
(
"
length of non background pixels:
"
,
len
(
segmentation_no_background
))
pixel_id
=
segmentation_no_background
[
0
]
print
(
"
detected pixel_id:
"
,
pixel_id
)
return
segmentation_no_background
,
pixel_id
return
pixel_id
def
get_region_areas
(
use_flat
,
atlas_labels
,
flat_file_atlas
,
seg_width
,
seg_height
,
slice_dict
,
atlas_volume
,
triangulation
):
if
use_flat
:
...
...
@@ -299,7 +299,7 @@ def segmentation_to_atlas_space(
):
segmentation
=
load_segmentation
(
segmentation_path
)
if
pixel_id
==
"
auto
"
:
segmentation
,
pixel_id
=
remove_backgroun
d
(
segmentation
)
pixel_id
=
detect_pixel_i
d
(
segmentation
)
seg_height
,
seg_width
=
segmentation
.
shape
[:
2
]
reg_height
,
reg_width
=
slice_dict
[
"
height
"
],
slice_dict
[
"
width
"
]
if
non_linear
and
"
markers
"
in
slice_dict
:
...
...
This diff is collapsed.
Click to expand it.
test/test10_PyNutil_web.json
+
1
−
1
View file @
8ffdf33a
...
...
@@ -4,6 +4,6 @@
"segmentation_folder"
:
"PyNutil/test_data/PyTest_web"
,
"alignment_json"
:
"PyNutil/test_data/PyNutil_test.waln"
,
"nonlinear"
:
true
,
"colour"
:
[
0
,
0
,
0
]
,
"colour"
:
"auto"
,
"points_json_path"
:
"PyNutil/outputs/test.json"
}
This diff is collapsed.
Click to expand it.
Preview
0%
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