Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
GEPARD
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
GEPARD
GEPARD
Commits
9e096e02
Commit
9e096e02
authored
Jul 26, 2019
by
Lars Bittrich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfixes for zeissimport and dataset with transformations
parent
cfa964ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
16 deletions
+33
-16
dataset.py
dataset.py
+3
-3
zeissimporter.py
zeissimporter.py
+16
-9
zeissxml.py
zeissxml.py
+14
-4
No files found.
dataset.py
View file @
9e096e02
...
...
@@ -216,7 +216,7 @@ class DataSet(object):
Ngrid
=
len
(
self
.
grid
)
width
,
height
,
rotationvalue
=
self
.
imagedim_df
p0
,
p1
=
self
.
maxdim
[:
2
],
self
.
maxdim
[
2
:]
p0
,
p1
=
self
.
lastpos
[:
2
],
self
.
maxdim
[
2
:]
for
i
in
range
(
Ngrid
):
print
(
f
"Processing image
{
i
+
1
}
of
{
Ngrid
}
"
)
names
=
[]
...
...
@@ -271,7 +271,7 @@ class DataSet(object):
print
(
'error in getZval:'
,
self
.
zvalimg
.
shape
,
i
,
j
)
j
=
self
.
zvalimg
.
shape
[
1
]
-
1
zp
=
self
.
zvalimg
[
i
,
j
]
z0
,
z1
=
self
.
zpositions
.
min
(),
self
.
zpositions
.
max
()
z0
,
z1
=
self
.
zpositions
[
0
],
self
.
zpositions
[
-
1
]
return
zp
/
255.
*
(
z1
-
z0
)
+
z0
def
mapHeight
(
self
,
x
,
y
):
...
...
@@ -296,7 +296,7 @@ class DataSet(object):
elif
mode
==
'bf'
:
p0
[
0
]
-=
self
.
signx
*
self
.
imagedim_bf
[
0
]
/
2
p0
[
1
]
+
=
self
.
signy
*
self
.
imagedim_bf
[
1
]
/
2
p0
[
1
]
-
=
self
.
signy
*
self
.
imagedim_bf
[
1
]
/
2
x
,
y
=
self
.
signx
*
(
p
[
0
]
-
p0
[
0
])
/
self
.
pixelscale_bf
,
self
.
signy
*
(
p
[
1
]
-
p0
[
1
])
/
self
.
pixelscale_bf
else
:
...
...
zeissimporter.py
View file @
9e096e02
...
...
@@ -164,7 +164,10 @@ class ZeissImporter(QtWidgets.QDialog):
z0
,
zn
=
self
.
zrange
.
z0
,
self
.
zrange
.
zn
if
zn
<
z0
:
zn
,
z0
=
z0
,
zn
dataset
.
zpositions
=
np
.
linspace
(
z0
,
zn
,
N
)
-
zpc
[
2
]
# zeiss z axis has large values at the surface and smaller for large particles
# that is why we need to invert the zpositions: zimg black corresponds to zn
# zimg white corresponds to z0
dataset
.
zpositions
=
np
.
linspace
(
z0
,
zn
,
N
)[::
-
1
]
-
zpc
[
2
]
dataset
.
heightmap
=
np
.
zeros
(
3
)
dataset
.
signy
=
1.
zimg
=
cv2imread_fix
(
self
.
zmapimgname
,
cv2
.
IMREAD_GRAYSCALE
)
...
...
@@ -174,24 +177,28 @@ class ZeissImporter(QtWidgets.QDialog):
pshift
=
self
.
ramanctrl
.
getRamanPositionShift
()
dataset
.
pshift
=
pshift
pixelscale
=
self
.
region
.
width
/
zimg
.
shape
[
1
]
pixelscale
=
self
.
region
.
scalex
*
1.e6
# use input image as single image aquired in one shot
dataset
.
imagedim_df
=
(
self
.
region
.
width
,
self
.
region
.
height
,
0.0
)
dataset
.
imagedim_df
=
(
zimg
.
shape
[
1
]
*
pixelscale
,
zimg
.
shape
[
0
]
*
pixelscale
,
0.0
)
dataset
.
pixelscale_df
=
pixelscale
dataset
.
imagedim_bf
=
(
self
.
region
.
width
,
self
.
region
.
height
,
0.0
)
dataset
.
imagedim_bf
=
(
zimg
.
shape
[
1
]
*
pixelscale
,
zimg
.
shape
[
0
]
*
pixelscale
,
0.0
)
dataset
.
pixelscale_bf
=
pixelscale
print
(
'scale:'
,
pixelscale
)
print
(
'dim df:'
,
dataset
.
imagedim_df
)
print
(
'dim bf:'
,
dataset
.
imagedim_bf
)
dataset
.
coordinatetransform
=
T
,
pc
# set image center as reference point in data set (use Zeiss coordinates)
# set image center as reference point (assume just one tile)
# in data set (use Zeiss coordinates)
p0center
=
np
.
array
([
self
.
region
.
centerx
,
self
.
region
.
centery
])
-
zpc
[:
2
]
p0
=
p0center
-
.
5
*
np
.
array
((
self
.
region
.
width
,
self
.
region
.
height
))
p1
=
p0center
+
.
5
*
np
.
array
((
self
.
region
.
width
,
self
.
region
.
height
))
dataset
.
readin
=
False
dataset
.
lastpos
=
p0
dataset
.
maxdim
=
p0
+
p1
dataset
.
lastpos
=
p0
center
dataset
.
maxdim
=
p0
center
zmin
,
zmax
=
dataset
.
zpositions
.
min
(),
dataset
.
zpositions
.
max
()
blur
=
(
blur
)
*
(
255.
)
...
...
zeissxml.py
View file @
9e096e02
...
...
@@ -39,13 +39,15 @@ class Region:
def
__init__
(
self
):
self
.
centerx
,
self
.
centery
=
None
,
None
self
.
width
,
self
.
height
=
None
,
None
self
.
scalex
,
self
.
scaley
=
None
,
None
def
__repr__
(
self
):
return
str
(
self
)
def
__str__
(
self
):
return
f
'Region center:
{
self
.
centerx
,
self
.
centery
}
µm
\n
'
+
\
f
'Region size:
{
self
.
width
,
self
.
height
}
µm'
f
'Region size:
{
self
.
width
,
self
.
height
}
µm
\n
'
+
\
f
'Scale:
{
self
.
scalex
,
self
.
scaley
}
µm/pixel'
class
ZRange
:
def
__init__
(
self
):
...
...
@@ -65,6 +67,7 @@ class ZeissHandler(handler.ContentHandler):
self
.
zrange
=
ZRange
()
self
.
intag
=
False
self
.
subtag
=
''
self
.
scaledim
=
''
def
characters
(
self
,
content
):
if
self
.
intag
:
...
...
@@ -75,20 +78,27 @@ class ZeissHandler(handler.ContentHandler):
self
.
markers
.
append
(
Marker
(
attrs
[
'Id'
],
attrs
[
'StageXPosition'
],
attrs
[
'StageYPosition'
],
attrs
[
'FocusPosition'
]))
elif
name
==
'TileRegion'
or
name
==
'ZStackSetup'
:
elif
name
==
'TileRegion'
or
name
==
'ZStackSetup'
or
name
==
'Scaling'
:
self
.
intag
=
True
if
self
.
intag
:
self
.
content
=
''
if
name
in
[
'First'
,
'Last'
,
'Interval'
]:
if
self
.
subtag
==
'Items'
and
name
==
'Distance'
:
self
.
scaledim
=
attrs
[
'Id'
]
if
name
in
[
'First'
,
'Last'
,
'Interval'
,
'Items'
]:
self
.
subtag
=
name
def
endElement
(
self
,
name
):
if
name
==
'TileRegion'
or
name
==
'ZStackSetup'
:
if
name
==
'TileRegion'
or
name
==
'ZStackSetup'
or
name
==
'Scaling'
:
self
.
intag
=
False
if
self
.
intag
and
name
==
'CenterPosition'
:
self
.
region
.
centerx
,
self
.
region
.
centery
=
map
(
float
,
self
.
content
.
split
(
','
))
elif
self
.
intag
and
name
==
'ContourSize'
:
self
.
region
.
width
,
self
.
region
.
height
=
map
(
float
,
self
.
content
.
split
(
','
))
elif
self
.
intag
and
self
.
subtag
==
'Items'
and
name
==
'Value'
:
if
self
.
scaledim
==
'X'
:
self
.
region
.
scalex
=
float
(
self
.
content
)
elif
self
.
scaledim
==
'Y'
:
self
.
region
.
scaley
=
float
(
self
.
content
)
elif
self
.
intag
and
name
==
'Value'
and
\
self
.
subtag
in
[
'First'
,
'Last'
,
'Interval'
]:
attrmap
=
{
'First'
:
'z0'
,
'Last'
:
'zn'
,
'Interval'
:
'dz'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment