Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
aliby-mirror
Commits
f4157d4b
Commit
f4157d4b
authored
2 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
clean(imageviewer): remove unused class
parent
5b588312
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/aliby/utils/imageViewer.py
+4
-25
4 additions, 25 deletions
src/aliby/utils/imageViewer.py
src/extraction/core/extractor.py
+0
-17
0 additions, 17 deletions
src/extraction/core/extractor.py
with
4 additions
and
42 deletions
src/aliby/utils/imageViewer.py
+
4
−
25
View file @
f4157d4b
...
...
@@ -30,7 +30,7 @@ from agora.io.cells import Cells
from
agora.io.writer
import
load_attributes
from
aliby.io.image
import
dispatch_image
from
aliby.tile.tiler
import
Tiler
,
TilerParameters
from
aliby.utils.plot
import
stretch_
image
from
aliby.utils.plot
import
stretch_
clip
default_colours
=
{
"
Brightfield
"
:
"
Greys_r
"
,
...
...
@@ -56,28 +56,6 @@ def custom_imshow(a, norm=None, cmap=None, *args, **kwargs):
)
class
localImageViewer
:
"""
Fast access to Images segmented locally without tiling
from image.h5 objects.
"""
def
__init__
(
self
,
h5file
,
data_source
=
None
):
self
.
_hdf
=
h5py
.
File
(
h5file
)
self
.
positions
=
list
(
self
.
_hdf
.
keys
())
self
.
current_position
=
self
.
positions
[
0
]
def
plot_position
(
self
,
channel
=
0
,
tp
=
0
,
z
=
0
,
stretch
=
True
):
pixvals
=
self
.
_hdf
[
self
.
current_position
][
channel
,
tp
,
...,
z
]
if
stretch
:
minval
=
np
.
percentile
(
pixvals
,
0.5
)
maxval
=
np
.
percentile
(
pixvals
,
99.5
)
pixvals
=
np
.
clip
(
pixvals
,
minval
,
maxval
)
pixvals
=
((
pixvals
-
minval
)
/
(
maxval
-
minval
))
*
255
Image
.
fromarray
(
pixvals
.
astype
(
np
.
uint8
))
class
BaseImageViewer
(
ABC
):
def
__init__
(
self
,
fpath
):
...
...
@@ -112,6 +90,7 @@ class LocalImageViewer(BaseImageViewer):
"""
Tool to generate figures from local files, either zarr or files organised
in directories.
TODO move common functionality from RemoteImageViewer to BaseImageViewer
"""
def
__init__
(
self
,
results_path
:
str
,
data_path
:
str
):
...
...
@@ -133,7 +112,7 @@ class LocalImageViewer(BaseImageViewer):
self
.
cells
=
Cells
.
from_source
(
results_path
)
class
r
emoteImageViewer
(
BaseImageViewer
):
class
R
emoteImageViewer
(
BaseImageViewer
):
"""
This ImageViewer combines fetching remote images with tiling and outline display.
"""
...
...
@@ -364,7 +343,7 @@ class remoteImageViewer(BaseImageViewer):
),
"
Invalid norm argument.
"
if
norm
and
norm
in
(
"
l1
"
,
"
l2
"
,
"
max
"
):
images
=
{
k
:
stretch_
image
(
v
)
for
k
,
v
in
images
.
items
()}
images
=
{
k
:
stretch_
clip
(
v
)
for
k
,
v
in
images
.
items
()}
images
=
[
concat_pad
(
img
,
width
,
nrows
)
for
img
in
images
.
values
()]
# TODO convert to RGB to draw fluorescence with colour
...
...
This diff is collapsed.
Click to expand it.
src/extraction/core/extractor.py
+
0
−
17
View file @
f4157d4b
...
...
@@ -61,23 +61,6 @@ class ExtractorParameters(ParametersABC):
self
.
sub_bg
=
sub_bg
self
.
multichannel_ops
=
multichannel_ops
@staticmethod
def
guess_from_meta
(
store_name
:
str
,
suffix
=
"
fast
"
):
"""
Find the microscope name from the h5 metadata.
Parameters
----------
store_name : str or Path
For a h5 file
suffix : str
Added at the end of the predicted parameter set
"""
with
h5py
.
File
(
store_name
,
"
r
"
)
as
f
:
microscope
=
f
[
"
/
"
].
attrs
.
get
(
"
microscope
"
)
assert
microscope
,
"
No metadata found
"
return
"
_
"
.
join
((
microscope
,
suffix
))
@classmethod
def
default
(
cls
):
return
cls
({})
...
...
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