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
51770119
Commit
51770119
authored
Jun 08, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packing data, initial
parent
c76092fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
0 deletions
+114
-0
test_2.py
test_2.py
+58
-0
tile_packing_table.xml
tile_packing_table.xml
+56
-0
No files found.
test_2.py
0 → 100644
View file @
51770119
#!/usr/bin/env python3
from
PIL
import
Image
import
xml.etree.ElementTree
as
ET
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
imagej_tiff
as
ijt
#tiff = ijt.imagej_tiff('test.tiff')
#print(tiff.nimages)
#print(tiff.labels)
#print(tiff.infos)
#tiff.show_images(['X-corr','Y-corr',0,2])
#plt.show()
import
json
import
xml.etree.ElementTree
as
ET
import
xml.dom.minidom
as
minidom
import
ast
def
calc_packed_value
(
layer
,
index
,
tile
):
t
=
tile
.
flatten
()
a
=
layer
[
index
]
res
=
0
for
i
in
a
:
res
+=
t
[
i
[
0
]]
*
i
[
1
]
return
res
def
iterate_tile
(
lut
,
tile
):
# hard coded layers names
lst
=
[
'diagm-pair'
,
'diago-pair'
]
#lut['diagm-pair']
#stack = ijt.getstack(lst)
e
=
ET
.
parse
(
'tile_packing_table.xml'
)
.
getroot
()
#print(ET.tostring(e))
#reparsed = minidom.parseString(ET.tostring(e,""))
#print(reparsed.toprettyxml(indent="\t"))
# LUT is a dict
LUT
=
{}
for
table
in
e
:
layer
=
table
.
get
(
'layer'
)
LUT
[
layer
]
=
[]
for
row
in
table
:
LUT
[
layer
]
.
append
(
ast
.
literal_eval
(
row
.
text
))
print
(
LUT
)
print
(
"Done"
)
tile_packing_table.xml
0 → 100644
View file @
51770119
<Document>
<table
layer=
'diagm-pair'
>
<tr
row=
'0'
>
[(2,1.0), (3,1.0), (4,1.0), (5,1.0), (6,1.0)]
</tr>
<tr
row=
'1'
>
[(10,1.0), (11,1.0), (19,1.0), (20,1.0)]
</tr>
<tr
row=
'2'
>
[(12,1.0), (13,1.0), (14,1.0)]
</tr>
<tr
row=
'3'
>
[(15,1.0), (16,1.0), (24,1.0), (25, 1.0)]
</tr>
<tr
row=
'4'
>
[(18,1.0), (27,1.0), (36,1.0), (45,1.0), (54,1.0)]
</tr>
<tr
row=
'5'
>
[(21,1.0), (22,1.0), (23,1.0)]
</tr>
<tr
row=
'6'
>
[(26,1.0), (35,1.0), (44,1.0), (53,1.0), (62,1.0)]
</tr>
<tr
row=
'7'
>
[(28,1.0), (37,1.0), (46,1.0)]
</tr>
<tr
row=
'8'
>
[(29,1.0), (38,1.0), (47,1.0)]
</tr>
<tr
row=
'9'
>
[(30,1.0)]
</tr>
<tr
row=
'10'
>
[(31,1.0)]
</tr>
<tr
row=
'11'
>
[(32,1.0)]
</tr>
<tr
row=
'12'
>
[(33,1.0), (42,1.0), (51,1.0)]
</tr>
<tr
row=
'13'
>
[(34,1.0), (43,1.0), (52,1.0)]
</tr>
<tr
row=
'14'
>
[(39,1.0)]
</tr>
<tr
row=
'15'
>
[(40,1.0)]
</tr>
<tr
row=
'16'
>
[(41,1.0)]
</tr>
<tr
row=
'17'
>
[(48,1.0)]
</tr>
<tr
row=
'18'
>
[(49,1.0)]
</tr>
<tr
row=
'19'
>
[(50,1.0)]
</tr>
<tr
row=
'20'
>
[(55,1.0), (56,1.0), (64,1.0), (65,1.0)]
</tr>
<tr
row=
'21'
>
[(57,1.0), (58,1.0), (59,1.0)]
</tr>
<tr
row=
'22'
>
[(60,1.0), (61,1.0), (69,1.0), (70,1.0)]
</tr>
<tr
row=
'23'
>
[(66,1.0), (67,1.0), (68,1.0)]
</tr>
<tr
row=
'24'
>
[(74,1.0), (75,1.0), (76,1.0), (77,1.0), (78,1.0)]
</tr>
</table>
<table
layer=
'diago-pair'
>
<tr
row=
'0'
>
[(2,1.0), (3,1.0), (4,1.0), (5,1.0), (6,1.0)]
</tr>
<tr
row=
'1'
>
[(10,1.0), (11,1.0), (19,1.0), (20,1.0)]
</tr>
<tr
row=
'2'
>
[(12,1.0), (13,1.0), (14,1.0)]
</tr>
<tr
row=
'3'
>
[(15,1.0), (16,1.0), (24,1.0), (25, 1.0)]
</tr>
<tr
row=
'4'
>
[(18,1.0), (27,1.0), (36,1.0), (45,1.0), (54,1.0)]
</tr>
<tr
row=
'5'
>
[(21,1.0), (22,1.0), (23,1.0)]
</tr>
<tr
row=
'6'
>
[(26,1.0), (35,1.0), (44,1.0), (53,1.0), (62,1.0)]
</tr>
<tr
row=
'7'
>
[(28,1.0), (37,1.0), (46,1.0)]
</tr>
<tr
row=
'8'
>
[(29,1.0), (38,1.0), (47,1.0)]
</tr>
<tr
row=
'9'
>
[(30,1.0)]
</tr>
<tr
row=
'10'
>
[(31,1.0)]
</tr>
<tr
row=
'11'
>
[(32,1.0)]
</tr>
<tr
row=
'12'
>
[(33,1.0), (42,1.0), (51,1.0)]
</tr>
<tr
row=
'13'
>
[(34,1.0), (43,1.0), (52,1.0)]
</tr>
<tr
row=
'14'
>
[(39,1.0)]
</tr>
<tr
row=
'15'
>
[(40,1.0)]
</tr>
<tr
row=
'16'
>
[(41,1.0)]
</tr>
<tr
row=
'17'
>
[(48,1.0)]
</tr>
<tr
row=
'18'
>
[(49,1.0)]
</tr>
<tr
row=
'19'
>
[(50,1.0)]
</tr>
<tr
row=
'20'
>
[(55,1.0), (56,1.0), (64,1.0), (65,1.0)]
</tr>
<tr
row=
'21'
>
[(57,1.0), (58,1.0), (59,1.0)]
</tr>
<tr
row=
'22'
>
[(60,1.0), (61,1.0), (69,1.0), (70,1.0)]
</tr>
<tr
row=
'23'
>
[(66,1.0), (67,1.0), (68,1.0)]
</tr>
<tr
row=
'24'
>
[(74,1.0), (75,1.0), (76,1.0), (77,1.0), (78,1.0)]
</tr>
</table>
</Document>
\ No newline at end of file
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