Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Image Data Explorer
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
Jean-Karim Heriche
Image Data Explorer
Commits
e255a176
Commit
e255a176
authored
4 months ago
by
Jean-Karim Heriche
Browse files
Options
Downloads
Patches
Plain Diff
Fix handling of ome-zarr.
parent
bf0fc354
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/explore_image.R
+13
-10
13 additions, 10 deletions
R/explore_image.R
R/explore_image2.R
+12
-8
12 additions, 8 deletions
R/explore_image2.R
with
25 additions
and
18 deletions
R/explore_image.R
+
13
−
10
View file @
e255a176
...
...
@@ -29,7 +29,7 @@ explore_image_server <-function(input, output, session, rv, parent_input){
if
(
!
is.null
(
rv
$
imgPath1
)
&&
length
(
unique
(
rv
$
imgPath1
))
==
1
&&
length
(
unique
(
rv
$
selectedFrame
))
<=
1
&&
!
is.null
(
rv
$
fileCol1
)
&&
rv
$
fileCol1
!=
""
){
if
(
grepl
(
"\\.ome\\.zarr
\\/
"
,
rv
$
imgPath1
[
1
]))
{
# NGFF, use omeRarr
if
(
grepl
(
"\\.ome\\.zarr"
,
rv
$
imgPath1
[
1
]))
{
# NGFF, use omeRarr
s3.client
<-
NULL
img.idx
<-
1
# Assume object coordinates refer to highest resolution level
if
(
class
(
rv
$
imgRoot
)[
1
]
==
"s3_bucket"
)
{
# Images are in a S3 bucket
...
...
@@ -48,25 +48,28 @@ explore_image_server <-function(input, output, session, rv, parent_input){
}
## NGFF dimensions order is t,c,z,y,x
size
<-
as.list
(
omeRarr
::
get_image_dims
(
filePath1
,
image.idx
=
img.idx
,
s3.client
))
## Set a dimension to NA to get everything in this dimension
slice
<-
list
(
t
=
NA
,
c
=
NA
,
z
=
NA
,
y
=
NA
,
x
=
NA
)
# Some older files only specify dimensions > 1
if
(
is.null
(
size
$
z
))
{
size
$
z
<-
1
}
if
(
is.null
(
size
$
c
))
{
size
$
c
<-
1
}
if
(
is.null
(
size
$
t
))
{
size
$
t
<-
1
}
## Set a dimension to NULL to get everything in this dimension
slice
<-
list
(
t
=
NA
,
c
=
NA
,
z
=
NA
,
y
=
NULL
,
x
=
NULL
)
if
(
!
is.null
(
rv
$
roiFrame
)
&&
rv
$
roiFrame
!=
""
)
{
## Figure out what the 3rd dimension is
if
(
size
$
z
==
1
&&
size
$
t
>
1
&&
size
$
c
==
1
)
{
slice
$
t
<-
unique
(
rv
$
selectedFrame
)
slice
$
z
<-
N
A
slice
$
c
<-
N
A
slice
$
z
<-
N
ULL
slice
$
c
<-
N
ULL
}
else
if
(
size
$
z
>
1
&&
size
$
t
==
1
&&
size
$
c
==
1
)
{
slice
$
z
<-
unique
(
rv
$
selectedFrame
)
slice
$
t
<-
N
A
slice
$
c
<-
N
A
slice
$
t
<-
N
ULL
slice
$
c
<-
N
ULL
}
else
if
(
size
$
z
==
1
&&
size
$
t
==
1
&&
size
$
c
>
1
)
{
slice
$
c
<-
unique
(
rv
$
selectedFrame
)
slice
$
z
<-
N
A
slice
$
t
<-
N
A
slice
$
z
<-
N
ULL
slice
$
t
<-
N
ULL
}
}
print
(
slice
)
I
<-
tryCatch
(
{
omeRarr
::
get_image
(
filePath1
,
image.idx
=
img.idx
,
slice
=
slice
,
s3.client
=
s3.client
)
},
error
=
function
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
R/explore_image2.R
+
12
−
8
View file @
e255a176
...
...
@@ -25,7 +25,7 @@ explore_image_server2 <-function(input, output, session, rv){
if
(
!
is.null
(
rv
$
imgPath2
)
&&
length
(
unique
(
rv
$
imgPath2
))
==
1
&&
length
(
unique
(
rv
$
selectedFrame
))
<=
1
&&
!
is.null
(
rv
$
fileCol2
)
&&
rv
$
fileCol2
!=
""
){
if
(
grepl
(
"\\.ome\\.zarr
\\/
"
,
rv
$
imgPath2
[
1
]))
{
# NGFF, use omeRarr
if
(
grepl
(
"\\.ome\\.zarr"
,
rv
$
imgPath2
[
1
]))
{
# NGFF, use omeRarr
s3.client
<-
NULL
img.idx
<-
1
# Assume object coordinates refer to highest resolution level
if
(
class
(
rv
$
imgRoot
)[
1
]
==
"s3_bucket"
)
{
# Images are in a S3 bucket
...
...
@@ -44,22 +44,26 @@ explore_image_server2 <-function(input, output, session, rv){
}
## NGFF dimensions order is t,c,z,y,x
size
<-
as.list
(
omeRarr
::
get_image_dims
(
filePath1
,
image.idx
=
img.idx
,
s3.client
))
# Some older files only specify dimensions > 1
if
(
is.null
(
size
$
z
))
{
size
$
z
<-
1
}
if
(
is.null
(
size
$
c
))
{
size
$
c
<-
1
}
if
(
is.null
(
size
$
t
))
{
size
$
t
<-
1
}
## Set a dimension to NA to get everything in this dimension
slice
<-
list
(
t
=
NA
,
c
=
NA
,
z
=
NA
,
y
=
N
A
,
x
=
N
A
)
slice
<-
list
(
t
=
NA
,
c
=
NA
,
z
=
NA
,
y
=
N
ULL
,
x
=
N
ULL
)
if
(
!
is.null
(
rv
$
roiFrame
)
&&
rv
$
roiFrame
!=
""
)
{
## Figure out what the 3rd dimension is
if
(
size
$
z
==
1
&&
size
$
t
>
1
&&
size
$
c
==
1
)
{
slice
$
t
<-
unique
(
rv
$
selectedFrame
)
slice
$
z
<-
N
A
slice
$
c
<-
N
A
slice
$
z
<-
N
ULL
slice
$
c
<-
N
ULL
}
else
if
(
size
$
z
>
1
&&
size
$
t
==
1
&&
size
$
c
==
1
)
{
slice
$
z
<-
unique
(
rv
$
selectedFrame
)
slice
$
t
<-
N
A
slice
$
c
<-
N
A
slice
$
t
<-
N
ULL
slice
$
c
<-
N
ULL
}
else
if
(
size
$
z
==
1
&&
size
$
t
==
1
&&
size
$
c
>
1
)
{
slice
$
c
<-
unique
(
rv
$
selectedFrame
)
slice
$
z
<-
N
A
slice
$
t
<-
N
A
slice
$
z
<-
N
ULL
slice
$
t
<-
N
ULL
}
}
I
<-
tryCatch
(
...
...
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