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
97fff9e0
Commit
97fff9e0
authored
1 year ago
by
Harry Carey
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Removed DeepSlice dependency and migrated function into PyNutil codebase
parent
6d508aa4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PyNutil/coordinate_extraction.py
+29
-1
29 additions, 1 deletion
PyNutil/coordinate_extraction.py
with
29 additions
and
1 deletion
PyNutil/coordinate_extraction.py
+
29
−
1
View file @
97fff9e0
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
from
DeepSlice.coord_post_processing.spacing_and_indexing
import
number_sections
import
json
import
json
from
.read_and_write
import
load_visualign_json
from
.read_and_write
import
load_visualign_json
from
.counting_and_load
import
label_points
,
flat_to_dataframe
from
.counting_and_load
import
label_points
,
flat_to_dataframe
...
@@ -10,7 +9,36 @@ from tqdm import tqdm
...
@@ -10,7 +9,36 @@ from tqdm import tqdm
import
cv2
import
cv2
from
skimage
import
measure
from
skimage
import
measure
import
threading
import
threading
import
re
def
number_sections
(
filenames
:
List
[
str
],
legacy
=
False
)
->
List
[
int
]:
"""
returns the section numbers of filenames
:param filenames: list of filenames
:type filenames: list[str]
:return: list of section numbers
:rtype: list[int]
"""
filenames
=
[
filename
.
split
(
"
\\
"
)[
-
1
]
for
filename
in
filenames
]
section_numbers
=
[]
for
filename
in
filenames
:
if
not
legacy
:
match
=
re
.
findall
(
r
"
\_s\d+
"
,
filename
)
if
len
(
match
)
==
0
:
raise
ValueError
(
f
"
No section number found in filename:
{
filename
}
"
)
if
len
(
match
)
>
1
:
raise
ValueError
(
"
Multiple section numbers found in filename, ensure only one instance of _s### is present, where ### is the section number
"
)
section_numbers
.
append
(
int
(
match
[
-
1
][
2
:]))
else
:
match
=
re
.
sub
(
"
[^0-9]
"
,
""
,
filename
)
###this gets the three numbers closest to the end
section_numbers
.
append
(
match
[
-
3
:])
if
len
(
section_numbers
)
==
0
:
raise
ValueError
(
"
No section numbers found in filenames
"
)
return
section_numbers
# related to coordinate_extraction
# related to coordinate_extraction
def
get_centroids_and_area
(
segmentation
,
pixel_cut_off
=
0
):
def
get_centroids_and_area
(
segmentation
,
pixel_cut_off
=
0
):
...
...
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