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
18eae790
Commit
18eae790
authored
5 months ago
by
polarbean
Browse files
Options
Downloads
Patches
Plain Diff
modify atlas slicing logic
parent
f2f94cfb
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/processing/coordinate_extraction.py
+5
-3
5 additions, 3 deletions
PyNutil/processing/coordinate_extraction.py
PyNutil/processing/counting_and_load.py
+11
-16
11 additions, 16 deletions
PyNutil/processing/counting_and_load.py
with
16 additions
and
19 deletions
PyNutil/processing/coordinate_extraction.py
+
5
−
3
View file @
18eae790
...
@@ -360,6 +360,7 @@ def detect_pixel_id(segmentation: np.array):
...
@@ -360,6 +360,7 @@ def detect_pixel_id(segmentation: np.array):
def
get_region_areas
(
def
get_region_areas
(
use_flat
,
atlas_labels
,
atlas_labels
,
flat_file_atlas
,
flat_file_atlas
,
seg_width
,
seg_width
,
...
@@ -385,10 +386,10 @@ def get_region_areas(
...
@@ -385,10 +386,10 @@ def get_region_areas(
Returns:
Returns:
DataFrame: DataFrame with region areas.
DataFrame: DataFrame with region areas.
"""
"""
image
=
load_image
(
flat_file_atlas
,
slice_dict
[
"
anchoring
"
],
atlas_volume
,
triangulation
,
(
seg_width
,
seg_height
))
atlas_map
=
load_image
(
flat_file_atlas
,
slice_dict
[
"
anchoring
"
],
atlas_volume
,
triangulation
,
(
seg_width
,
seg_height
)
,
atlas_labels
)
region_areas
,
atlas_map
=
flat_to_dataframe
(
region_areas
=
flat_to_dataframe
(
image
,
atlas_labels
,
flat_file_
atlas
,
(
seg_width
,
seg_height
)
atlas
_map
,
(
seg_width
,
seg_height
)
)
)
return
region_areas
,
atlas_map
return
region_areas
,
atlas_map
...
@@ -440,6 +441,7 @@ def segmentation_to_atlas_space(
...
@@ -440,6 +441,7 @@ def segmentation_to_atlas_space(
else
:
else
:
damage_mask
=
None
damage_mask
=
None
region_areas
,
atlas_map
=
get_region_areas
(
region_areas
,
atlas_map
=
get_region_areas
(
use_flat
,
atlas_labels
,
atlas_labels
,
flat_file_atlas
,
flat_file_atlas
,
seg_width
,
seg_width
,
...
...
This diff is collapsed.
Click to expand it.
PyNutil/processing/counting_and_load.py
+
11
−
16
View file @
18eae790
...
@@ -270,10 +270,7 @@ def warp_image(image, triangulation, rescaleXY):
...
@@ -270,10 +270,7 @@ def warp_image(image, triangulation, rescaleXY):
def
flat_to_dataframe
(
def
flat_to_dataframe
(
image
,
image
,
labelfile
,
rescaleXY
=
None
):
rescaleXY
=
None
,
image_vector
=
None
,
volume
=
None
,):
"""
"""
Converts a flat file to a DataFrame.
Converts a flat file to a DataFrame.
...
@@ -290,16 +287,11 @@ def flat_to_dataframe(
...
@@ -290,16 +287,11 @@ def flat_to_dataframe(
np.array: array in shape of alignment XY scaled by rescaleXY with allen ID for each point
np.array: array in shape of alignment XY scaled by rescaleXY with allen ID for each point
"""
"""
scale_factor
=
calculate_scale_factor
(
image
,
rescaleXY
)
scale_factor
=
calculate_scale_factor
(
image
,
rescaleXY
)
allen_id_image
=
(
df_area_per_label
=
count_pixels_per_label
(
image
,
scale_factor
)
assign_labels_to_image
(
image
,
labelfile
)
return
df_area_per_label
if
(
image_vector
is
None
or
volume
is
None
)
else
image
)
df_area_per_label
=
count_pixels_per_label
(
allen_id_image
,
scale_factor
)
return
df_area_per_label
,
allen_id_image
def
load_image
(
file
,
image_vector
,
volume
,
triangulation
,
rescaleXY
):
def
load_image
(
file
,
image_vector
,
volume
,
triangulation
,
rescaleXY
,
labelfile
=
None
):
"""
"""
Loads an image from a file or generates it from a vector and volume.
Loads an image from a file or generates it from a vector and volume.
...
@@ -318,10 +310,13 @@ def load_image(file, image_vector, volume, triangulation, rescaleXY):
...
@@ -318,10 +310,13 @@ def load_image(file, image_vector, volume, triangulation, rescaleXY):
image
=
np
.
float64
(
image
)
image
=
np
.
float64
(
image
)
if
triangulation
is
not
None
:
if
triangulation
is
not
None
:
image
=
warp_image
(
image
,
triangulation
,
rescaleXY
)
image
=
warp_image
(
image
,
triangulation
,
rescaleXY
)
elif
file
.
endswith
(
"
.flat
"
):
else
:
image
=
read_flat_file
(
file
)
if
file
.
endswith
(
"
.flat
"
):
elif
file
.
endswith
(
"
.seg
"
):
image
=
read_flat_file
(
file
)
image
=
read_seg_file
(
file
)
if
file
.
endswith
(
"
.seg
"
):
image
=
read_seg_file
(
file
)
image
=
assign_labels_to_image
(
image
,
labelfile
)
return
image
return
image
...
...
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