Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Create mosaïc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DISCO Beamline
Create mosaïc
Commits
5dc1e914
Commit
5dc1e914
authored
May 31, 2022
by
Hugo chauvet
Browse files
Options
Downloads
Patches
Plain Diff
fix MM1 version bugs in image order
parent
18dba18f
Branches
Branches containing commit
No related tags found
1 merge request
!3
Dev
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ImageJ/script_mosaic_telemos.py
+17
-9
17 additions, 9 deletions
ImageJ/script_mosaic_telemos.py
ImageJ/utils/IJmmlib.py
+8
-2
8 additions, 2 deletions
ImageJ/utils/IJmmlib.py
ImageJ/utils/mmlib.py
+27
-3
27 additions, 3 deletions
ImageJ/utils/mmlib.py
with
52 additions
and
14 deletions
ImageJ/script_mosaic_telemos.py
+
17
−
9
View file @
5dc1e914
...
...
@@ -45,7 +45,7 @@ except:
finally
:
from
utils.IJmmlib
import
load_mm_images
from
utils.mmlib
import
load_metadata
,
get_mm2_first_image_metadata
,
get_
dimensions
from
utils.mmlib
import
load_metadata
,
get_mm2_first_image_metadata
,
get_
mm1_first_image_metadata
,
get_dimensions
,
get_micromanager_version
# Import to do operation with ImageJ2 and ImgMath
from
net.imglib2.util
import
Intervals
...
...
@@ -68,8 +68,8 @@ def getMMversion(metadata):
"""
Get MM version from metadata
"""
if
int
(
metadata
[
'
Summary
'
][
"
MicroManagerVersion
"
].
split
(
'
.
'
)[
0
])
>=
2
:
mmversion
=
get_micromanager_version
(
metadata
)
if
mmversion
[
0
]
==
'
2
'
:
version
=
2
else
:
version
=
1
...
...
@@ -345,7 +345,8 @@ def process_tiles(implus_tiles_stack, channel, z, implus_white_corr, implus_dark
dark
=
Views
.
hyperSlice
(
dark
,
2
,
channel
)
# Need to apply crop on dark
roi
=
getRoi
(
metadata
)
mmversion
=
getMMversion
(
metadata
)
roi
=
getRoi
(
metadata
,
mmversion
)
if
roi
is
not
None
and
len
(
roi
)
==
4
and
implus_dark_stack
.
width
>
roi
[
2
]
and
implus_dark_stack
.
height
>
roi
[
3
]:
xmin
,
ymin
,
xmax
,
ymax
=
roi
xmax
=
xmin
+
xmax
...
...
@@ -734,11 +735,18 @@ def extract_tile_positions(metadata, selected_roi, tilesondisk, tilename='tile_'
xt
,
yt
=
getMMtiles
(
metadata
,
selected_roi
,
tilesondisk
)
# Is the microscope use Andor camera ? (tilted at 90)
ANDOR
=
False
mmversion
=
getMMversion
(
metadata
)
if
mmversion
==
2
:
fmeta
=
get_mm2_first_image_metadata
(
metadata
)
if
fmeta
[
'
Camera
'
]
==
'
Andor
'
:
ANDOR
=
True
else
:
ANDOR
=
False
fmeta
=
get_mm1_first_image_metadata
(
metadata
)
if
fmeta
[
'
Core-Camera
'
]
==
'
Andor
'
:
ANDOR
=
True
if
ANDOR
:
xtmp
=
yt
...
...
This diff is collapsed.
Click to expand it.
ImageJ/utils/IJmmlib.py
+
8
−
2
View file @
5dc1e914
...
...
@@ -4,7 +4,7 @@ Usefull jython functions for micro manager and imagej
"""
import
os
from
ij
import
ImagePlus
,
VirtualStack
,
IJ
from
mmlib
import
generate_file_list
,
load_metadata
,
get_dimensions
,
get_resolution
from
mmlib
import
generate_file_list
,
load_metadata
,
get_dimensions
,
get_resolution
,
get_micromanager_version
def
load_mm_images
(
rootdir
,
roi
=
1
,
tile
=
True
,
pos
=
False
,
...
...
@@ -15,8 +15,14 @@ def load_mm_images(rootdir, roi=1, tile=True, pos=False,
"""
metadata
=
load_metadata
(
rootdir
)
mmversion
=
int
(
get_micromanager_version
(
metadata
)[
0
])
dimensions
=
get_dimensions
(
metadata
)
image_files
=
generate_file_list
(
metadata
,
roi
,
tile
,
pos
)
if
mmversion
==
1
:
stack_order
=
[
'
position
'
,
'
z
'
,
'
time
'
,
'
channels
'
]
else
:
stack_order
=
[
'
position
'
,
'
time
'
,
'
channels
'
,
'
z
'
]
image_files
=
generate_file_list
(
metadata
,
roi
,
tile
,
pos
,
stack_order
)
# Create the virtual stack
vstack
=
VirtualStack
(
dimensions
[
'
width
'
],
dimensions
[
'
height
'
],
None
,
rootdir
)
...
...
This diff is collapsed.
Click to expand it.
ImageJ/utils/mmlib.py
+
27
−
3
View file @
5dc1e914
...
...
@@ -63,6 +63,30 @@ def get_mm2_first_image_metadata(metadata):
return
None
def
get_mm1_first_image_metadata
(
metadata
):
"""
Return the first metadata in the list of images starting with Metadata
"""
for
k
in
metadata
.
keys
():
if
k
.
startswith
(
'
FrameKey-
'
):
return
metadata
[
k
]
return
None
def
get_mm_first_image_metadata
(
metadata
):
"""
Return the first metadata in the list of images starting with Metadata
"""
v
=
get_micromanager_version
(
metadata
)
if
v
[
0
]
==
'
1
'
:
return
get_mm1_first_image_metadata
(
metadata
)
return
get_mm2_first_image_metadata
(
metadata
)
def
get_dimensions
(
metadata
):
"""
Extract from metadata the dimensions of data and export a consistent
...
...
@@ -145,7 +169,7 @@ def get_stage_positions_labels(metadata):
return
stage_label
def
generate_file_list
(
metadata
,
roi
=
1
,
tile
=
True
,
pos
=
False
):
def
generate_file_list
(
metadata
,
roi
=
1
,
tile
=
True
,
pos
=
False
,
stack_order
=
None
):
"""
Generate a list of all images to load from the metadata
...
...
@@ -178,7 +202,7 @@ def generate_file_list(metadata, roi=1, tile=True, pos=False):
pre_folder
=
'
Default
'
# Get the combination of all conditions of acquisitions
all_conditions
,
ordered_keys
=
groups_dimensions
(
metadata
)
all_conditions
,
ordered_keys
=
groups_dimensions
(
metadata
,
stack_order
)
# Loop over conditions to create the correct file name
image_files
=
[]
...
...
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