Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
payno
id06workflow
Commits
e386d0ef
Commit
e386d0ef
authored
Oct 18, 2018
by
payno
Browse files
[orange widget] Add Metadata table to display metadata of the experiment.
/close
#8
parent
cd0c230f
Changes
4
Hide whitespace changes
Inline
Side-by-side
id06workflow/core/experiment/__init__.py
View file @
e386d0ef
...
...
@@ -93,6 +93,10 @@ class Experiment(object):
assert
geometry
is
None
or
isinstance
(
geometry
,
GeometryBase
)
self
.
_geometry
=
geometry
@
property
def
metadata
(
self
):
return
self
.
__metadata
@
property
def
roi
(
self
):
# TODO: manage several rois
...
...
@@ -252,3 +256,11 @@ class Experiment(object):
def
hasOperation
(
self
,
operationID
):
raise
NotImplementedError
(
'Not implemented yet'
)
@
property
def
nslices
(
self
):
if
self
.
data
is
None
:
return
0
else
:
assert
self
.
data
.
ndim
is
3
return
self
.
data
.
shape
[
0
]
orangecontrib/id06workflow/widgets/icons/metadata.png
0 → 100644
View file @
e386d0ef
593 Bytes
orangecontrib/id06workflow/widgets/icons/metadata.svg
0 → 100644
View file @
e386d0ef
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:cc=
"http://creativecommons.org/ns#"
xmlns:rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg=
"http://www.w3.org/2000/svg"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:sodipodi=
"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape=
"http://www.inkscape.org/namespaces/inkscape"
width=
"48px"
height=
"48px"
id=
"svg2985"
version=
"1.1"
inkscape:version=
"0.48.5 r10040"
sodipodi:docname=
"New document 2"
>
<defs
id=
"defs2987"
/>
<sodipodi:namedview
id=
"base"
pagecolor=
"#ffffff"
bordercolor=
"#666666"
borderopacity=
"1.0"
inkscape:pageopacity=
"0.0"
inkscape:pageshadow=
"2"
inkscape:zoom=
"7"
inkscape:cx=
"0.14285714"
inkscape:cy=
"24"
inkscape:current-layer=
"layer1"
showgrid=
"true"
inkscape:grid-bbox=
"true"
inkscape:document-units=
"px"
inkscape:window-width=
"1920"
inkscape:window-height=
"1098"
inkscape:window-x=
"0"
inkscape:window-y=
"31"
inkscape:window-maximized=
"1"
/>
<metadata
id=
"metadata2990"
>
<rdf:RDF>
<cc:Work
rdf:about=
""
>
<dc:format>
image/svg+xml
</dc:format>
<dc:type
rdf:resource=
"http://purl.org/dc/dcmitype/StillImage"
/>
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id=
"layer1"
inkscape:label=
"Layer 1"
inkscape:groupmode=
"layer"
>
<rect
style=
"fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id=
"rect2993"
width=
"36.42857"
height=
"32.57143"
x=
"6.2857141"
y=
"8.7142859"
/>
<rect
style=
"fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id=
"rect3797"
width=
"13"
height=
"32.714287"
x=
"6.1428571"
y=
"8.5714283"
/>
<rect
style=
"fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id=
"rect3799"
width=
"9.8571434"
height=
"32.571426"
x=
"32.857143"
y=
"8.7142859"
/>
<rect
style=
"fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id=
"rect3801"
width=
"7.1428571"
height=
"32.42857"
x=
"25.714285"
y=
"8.7142859"
/>
<rect
style=
"fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id=
"rect3803"
width=
"36.714287"
height=
"6.8571429"
x=
"6.1428571"
y=
"8.4285717"
/>
</g>
</svg>
orangecontrib/id06workflow/widgets/metadatatable.py
0 → 100644
View file @
e386d0ef
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
__authors__
=
[
"H. Payno"
]
__license__
=
"MIT"
__date__
=
"16/10/2018"
from
silx.gui
import
qt
from
Orange.widgets
import
gui
from
Orange.widgets.widget
import
OWWidget
from
Orange.canvas.registry.description
import
InputSignal
,
OutputSignal
from
id06workflow.gui.mapping
import
MappingPlot
from
id06workflow.core.experiment
import
Experiment
from
id06workflow.core.experiment.operation.mapping
import
GradientRemoval
from
id06workflow.core.types
import
_Image
class
MetadataTableOW
(
OWWidget
):
"""
"""
name
=
"Metadata table"
id
=
"orange.widgets.id06workflow.metadatatable"
description
=
"Display "
icon
=
"icons/metadata.svg"
priority
=
4
category
=
"esrfWidgets"
keywords
=
[
"metadata"
,
"experiment"
,
"motors"
]
inputs
=
[
InputSignal
(
name
=
"data"
,
type
=
Experiment
,
handler
=
'_process'
)]
outputs
=
[
OutputSignal
(
name
=
"data"
,
type
=
Experiment
)]
want_main_area
=
True
resizing_enabled
=
True
compress_signal
=
False
def
__init__
(
self
):
super
().
__init__
()
layout
=
gui
.
vBox
(
self
.
mainArea
,
'metadata table'
).
layout
()
self
.
_table
=
qt
.
QTableWidget
(
parent
=
self
)
layout
.
addWidget
(
self
.
_table
)
def
_process
(
self
,
experiment
):
if
experiment
is
None
:
return
self
.
_table
.
clear
()
v_header
=
[]
[
v_header
.
append
(
str
(
i
))
for
i
in
range
(
experiment
.
nslices
)]
self
.
_table
.
setRowCount
(
len
(
v_header
))
self
.
_table
.
setVerticalHeaderLabels
(
v_header
)
columnCount
=
None
for
row
,
metadata_slice
in
enumerate
(
experiment
.
metadata
):
if
columnCount
is
None
:
columnCount
=
len
(
metadata_slice
)
self
.
_table
.
setColumnCount
(
columnCount
)
self
.
_table
.
setHorizontalHeaderLabels
(
metadata_slice
.
keys
())
elif
columnCount
!=
len
(
metadata_slice
):
raise
ValueError
(
'Metadata keys are incoherent'
)
for
column
,
info
in
enumerate
(
metadata_slice
):
_item
=
qt
.
QTableWidgetItem
()
_item
.
setText
(
metadata_slice
[
info
])
# _item.setFlags(qt.Qt.ItemIsEnabled | qt.Qt.ItemIsSelectable)
self
.
_table
.
setItem
(
row
,
column
,
_item
)
self
.
send
(
"data"
,
experiment
)
Write
Preview
Supports
Markdown
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