Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
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
alibylite
Commits
97528dd7
Commit
97528dd7
authored
2 years ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
Allow local runs without the omero module
parent
e8d84cd5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/aliby/io/dataset.py
+4
-2
4 additions, 2 deletions
src/aliby/io/dataset.py
src/aliby/io/image.py
+32
-15
32 additions, 15 deletions
src/aliby/io/image.py
src/aliby/io/omero.py
+5
-1
5 additions, 1 deletion
src/aliby/io/omero.py
with
41 additions
and
18 deletions
src/aliby/io/dataset.py
+
4
−
2
View file @
97528dd7
...
...
@@ -13,8 +13,10 @@ from abc import ABC, abstractproperty, abstractmethod
from
pathlib
import
Path
,
PosixPath
from
typing
import
Union
import
omero
try
:
import
omero
except
ModuleNotFoundError
:
print
(
"
Warning: Cannot import omero.
"
)
from
agora.io.bridge
import
BridgeH5
from
aliby.io.image
import
ImageLocalOME
from
aliby.io.omero
import
BridgeOmero
...
...
This diff is collapsed.
Click to expand it.
src/aliby/io/image.py
+
32
−
15
View file @
97528dd7
...
...
@@ -10,25 +10,41 @@ import numpy as np
import
xmltodict
from
dask
import
delayed
from
dask.array.image
import
imread
from
omero.model
import
enums
as
omero_enums
try
:
from
omero.model
import
enums
as
omero_enums
except
ModuleNotFoundError
:
print
(
"
Warning: Cannot import omero_enums.
"
)
from
tifffile
import
TiffFile
from
yaml
import
safe_load
from
agora.io.bridge
import
BridgeH5
from
agora.io.metadata
import
dir_to_meta
from
aliby.io.omero
import
BridgeOmero
try
:
from
aliby.io.omero
import
BridgeOmero
except
ModuleNotFoundError
:
class
BridgeOmero
:
# dummy class necessary when the omero module is not installed
pass
print
(
"
Warning: Cannot import BridgeOmero.
"
)
# convert OMERO definitions into numpy types
PIXEL_TYPES
=
{
omero_enums
.
PixelsTypeint8
:
np
.
int8
,
omero_enums
.
PixelsTypeuint8
:
np
.
uint8
,
omero_enums
.
PixelsTypeint16
:
np
.
int16
,
omero_enums
.
PixelsTypeuint16
:
np
.
uint16
,
omero_enums
.
PixelsTypeint32
:
np
.
int32
,
omero_enums
.
PixelsTypeuint32
:
np
.
uint32
,
omero_enums
.
PixelsTypefloat
:
np
.
float32
,
omero_enums
.
PixelsTypedouble
:
np
.
float64
,
}
try
:
PIXEL_TYPES
=
{
omero_enums
.
PixelsTypeint8
:
np
.
int8
,
omero_enums
.
PixelsTypeuint8
:
np
.
uint8
,
omero_enums
.
PixelsTypeint16
:
np
.
int16
,
omero_enums
.
PixelsTypeuint16
:
np
.
uint16
,
omero_enums
.
PixelsTypeint32
:
np
.
int32
,
omero_enums
.
PixelsTypeuint32
:
np
.
uint32
,
omero_enums
.
PixelsTypefloat
:
np
.
float32
,
omero_enums
.
PixelsTypedouble
:
np
.
float64
,
}
except
NameError
:
print
(
"
Warning: PIXEL_TYPES are not defined.
"
)
def
get_image_class
(
source
:
t
.
Union
[
str
,
int
,
t
.
Dict
[
str
,
str
],
PosixPath
]):
...
...
@@ -266,12 +282,12 @@ class ImageDir(BaseLocalImage):
class
Image
(
BridgeOmero
):
"""
Load
s
images from OMERO and gives access to the data and metadata.
Load images from OMERO and gives access to the data and metadata.
"""
def
__init__
(
self
,
image_id
:
int
,
**
server_info
):
"""
Establish
es
the connection to the OMERO server via the Argo
Establish the connection to the OMERO server via the Argo
base class.
Parameters
...
...
@@ -292,7 +308,8 @@ class Image(BridgeOmero):
cls
,
filepath
:
t
.
Union
[
str
,
PosixPath
],
):
"""
Instatiate Image from a hdf5 file.
"""
Instantiate Image from a hdf5 file.
Parameters
----------
...
...
This diff is collapsed.
Click to expand it.
src/aliby/io/omero.py
+
5
−
1
View file @
97528dd7
...
...
@@ -4,7 +4,11 @@ from pathlib import PosixPath
import
re
from
agora.io.bridge
import
BridgeH5
from
omero.gateway
import
BlitzGateway
try
:
from
omero.gateway
import
BlitzGateway
except
ModuleNotFoundError
:
print
(
"
Warning: Cannot import BlitzGateway.
"
)
from
yaml
import
safe_load
...
...
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