Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
platy-browser-data
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
Container Registry
Model registry
Operate
Environments
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
Christian Tischer
platy-browser-data
Commits
9eb2c4c3
Commit
9eb2c4c3
authored
5 years ago
by
Kimberly Isobel Meechan
Browse files
Options
Downloads
Patches
Plain Diff
add texture features
parent
b4e83b75
No related branches found
No related tags found
1 merge request
!9
Morphology
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/extension/attributes/morphology_impl.py
+19
-0
19 additions, 0 deletions
scripts/extension/attributes/morphology_impl.py
with
19 additions
and
0 deletions
scripts/extension/attributes/morphology_impl.py
+
19
−
0
View file @
9eb2c4c3
...
...
@@ -13,6 +13,8 @@ from skimage.measure import regionprops, marching_cubes_lewiner, mesh_surface_ar
from
skimage.transform
import
resize
from
skimage.util
import
pad
from
scipy.ndimage.morphology
import
distance_transform_edt
from
mahotas.features
import
haralick
from
skimage.morphology
import
label
,
remove_small_objects
def
log
(
msg
):
...
...
@@ -122,6 +124,23 @@ def intensity_row_features(raw, mask):
return
mean_intensity
,
st_dev
def
texture_row_features
(
raw
,
mask
):
# errors if there are small, isolated spots (because I'm using ignore zeros as true)
# so here remove components that are < 10 pixels
labelled
=
label
(
mask
)
if
len
(
np
.
unique
(
labelled
))
>
2
:
labelled
=
remove_small_objects
(
labelled
,
min_size
=
10
)
mask
=
labelled
!=
0
mask
=
mask
.
astype
(
'
uint8
'
)
# set regions outside mask to zero
raw_copy
=
raw
.
copy
()
raw_copy
[
mask
==
0
]
=
0
hara
=
haralick
(
raw_copy
,
ignore_zeros
=
True
,
return_mean
=
True
,
distance
=
2
)
return
hara
# compute morphology (and intensity features) for label range
def
morphology_features_for_label_range
(
table
,
ds
,
ds_raw
,
scale_factor_seg
,
scale_factor_raw
,
...
...
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