Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
python3-imagej-tiff
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
python3-imagej-tiff
Commits
51325319
Commit
51325319
authored
Jul 12, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed packing to 4x faster
parent
fc63a9dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
pack_tile.py
pack_tile.py
+27
-8
No files found.
pack_tile.py
View file @
51325319
...
@@ -42,18 +42,25 @@ def pack_layer(layer,lut_row):
...
@@ -42,18 +42,25 @@ def pack_layer(layer,lut_row):
t
=
layer
.
flatten
()
t
=
layer
.
flatten
()
out
=
np
.
array
([])
#out = np.array([])
out
=
np
.
empty
(
len
(
lut_row
))
# iterate through rows
# iterate through rows
for
i
in
range
(
len
(
lut_row
)):
for
i
in
range
(
len
(
lut_row
)):
val
=
0
val
=
0
# process row value
# process row value
for
j
in
lut_row
[
i
]:
for
j
in
lut_row
[
i
]:
if
np
.
isnan
(
t
[
j
[
0
]]):
## big slowdown
val
=
np
.
nan
#if np.isnan(t[j[0]]):
break
# val = np.nan
val
+=
t
[
j
[
0
]]
*
j
[
1
]
# break
out
=
np
.
append
(
out
,
val
)
#val += t[j[0]]*j[1]
val
+=
t
[
j
[
0
]]
#out = np.append(out,val)
#out[i] = val
out
[
i
]
=
val
return
out
return
out
...
@@ -61,13 +68,25 @@ def pack_layer(layer,lut_row):
...
@@ -61,13 +68,25 @@ def pack_layer(layer,lut_row):
# tile and lut already ordered and indices match
# tile and lut already ordered and indices match
def
pack_tile
(
tile
,
lut
):
def
pack_tile
(
tile
,
lut
):
out
=
np
.
array
([])
#out = np.array([])
#s = 0
#for i in range(len(lut)):
# s += len(lut[i])
#out = np.empty(s)
out
=
np
.
empty
(
100
)
ptr
=
0
for
i
in
range
(
len
(
lut
)):
for
i
in
range
(
len
(
lut
)):
layer
=
pack_layer
(
tile
[:,:,
i
],
lut
[
i
])
layer
=
pack_layer
(
tile
[:,:,
i
],
lut
[
i
])
out
=
np
.
append
(
out
,
layer
)
#out = np.append(out,layer)
out
[
ptr
:
ptr
+
len
(
lut
[
i
])]
=
layer
#out[ptr:ptr+len(lut[i])] = np.empty(25)
ptr
+=
len
(
lut
[
i
])
return
out
return
out
# tiles are already packed
# tiles are already packed
def
get_tile_with_neighbors
(
tiles
,
i
,
j
,
radius
):
def
get_tile_with_neighbors
(
tiles
,
i
,
j
,
radius
):
...
...
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