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
1651d4fa
Commit
1651d4fa
authored
1 year ago
by
Sharon Christine Yates
Browse files
Options
Downloads
Patches
Plain Diff
Add region name and r, g, b to section reports
parent
fb7e5679
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/counting_and_load.py
+1
-1
1 addition, 1 deletion
PyNutil/counting_and_load.py
PyNutil/main.py
+21
-2
21 additions, 2 deletions
PyNutil/main.py
with
22 additions
and
3 deletions
PyNutil/counting_and_load.py
+
1
−
1
View file @
1651d4fa
...
@@ -163,7 +163,7 @@ def flat_to_dataframe(flat_file, labelfile, rescaleXY=False):
...
@@ -163,7 +163,7 @@ def flat_to_dataframe(flat_file, labelfile, rescaleXY=False):
area_per_label
=
list
(
zip
(
unique_ids
,
counts
))
area_per_label
=
list
(
zip
(
unique_ids
,
counts
))
# create a list of unique regions and pixel counts per region
# create a list of unique regions and pixel counts per region
df_area_per_label
=
pd
.
DataFrame
(
area_per_label
,
columns
=
[
"
idx
"
,
"
area_count
"
])
df_area_per_label
=
pd
.
DataFrame
(
area_per_label
,
columns
=
[
"
idx
"
,
"
region_area
"
])
# create a pandas df with regions and pixel counts
# create a pandas df with regions and pixel counts
return
(
df_area_per_label
)
return
(
df_area_per_label
)
...
...
This diff is collapsed.
Click to expand it.
PyNutil/main.py
+
21
−
2
View file @
1651d4fa
...
@@ -226,12 +226,31 @@ class PyNutil:
...
@@ -226,12 +226,31 @@ class PyNutil:
# create the df for section report and all report
# create the df for section report and all report
# pixel_count_per_region returns a df with idx, pixel count, name and RGB.
# pixel_count_per_region returns a df with idx, pixel count, name and RGB.
# ra is region area list
# ra is region area list
from
# merge current_df onto ra (region_areas_list) based on idx column
# merge current_df onto ra (region_areas_list) based on idx column
#(left means use only keys from left frame, preserve key order)
#(left means use only keys from left frame, preserve key order)
current_df
=
ra
.
merge
(
current_df
,
on
=
'
idx
'
,
how
=
'
left
'
)
current_df
=
ra
.
merge
(
current_df
,
on
=
'
idx
'
,
how
=
'
left
'
)
new_rows
=
[]
for
index
,
row
in
current_df
.
iterrows
():
mask
=
self
.
atlas_labels
[
"
idx
"
]
==
row
[
"
idx
"
]
current_region_row
=
self
.
atlas_labels
[
mask
]
current_region_name
=
current_region_row
[
"
name
"
].
values
current_region_red
=
current_region_row
[
"
r
"
].
values
current_region_green
=
current_region_row
[
"
g
"
].
values
current_region_blue
=
current_region_row
[
"
b
"
].
values
row
[
"
name
"
]
=
current_region_name
[
0
]
row
[
"
r
"
]
=
current_region_red
[
0
]
row
[
"
g
"
]
=
current_region_green
[
0
]
row
[
"
b
"
]
=
current_region_blue
[
0
]
new_rows
.
append
(
row
)
current_df_new
=
pd
.
DataFrame
(
new_rows
)
##Sharon. I would guess you should add the rgb and name adding code here
##Sharon. I would guess you should add the rgb and name adding code here
per_section_df
.
append
(
current_df
)
per_section_df
.
append
(
current_df
_new
)
prev_pl
+=
pl
prev_pl
+=
pl
prev_cl
+=
cl
prev_cl
+=
cl
...
...
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