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
9b0c89c2
Commit
9b0c89c2
authored
Oct 17, 2018
by
payno
Browse files
[gradient] Move gradient operation to a thread.
- update also gradient orange widget.
parent
24159a10
Changes
2
Hide whitespace changes
Inline
Side-by-side
id06workflow/gui/shifcorrection.py
View file @
9b0c89c2
...
...
@@ -107,16 +107,17 @@ class ShiftCorrectionWidget(qt.QWidget):
self
.
_operation_thread
.
init
(
operation
=
self
.
_operation
,
dry_run
=
True
)
callback
=
partial
(
self
.
_update_post_processing
,
_shift
)
self
.
_operation_thread
.
finished
.
connect
(
callback
)
self
.
_
callback
=
partial
(
self
.
_update_post_processing
,
_shift
)
self
.
_operation_thread
.
finished
.
connect
(
self
.
_
callback
)
self
.
_operation
.
sigProgress
.
connect
(
self
.
setProgress
)
self
.
_operation_thread
.
start
()
def
_update_post_processing
(
self
,
_shift
):
self
.
_stack
.
setStack
(
self
.
_shiftedData
)
self
.
_sumPlot
.
addImage
(
self
.
_shiftedData
.
sum
(
axis
=
0
))
self
.
_lastShift
=
_shift
self
.
setProgress
(
100
)
self
.
_operation_thread
.
finished
.
disconnect
(
self
.
_callback
)
self
.
_stack
.
setStack
(
self
.
_shiftedData
)
self
.
_sumPlot
.
addImage
(
self
.
_shiftedData
.
sum
(
axis
=
0
))
self
.
_lastShift
=
_shift
self
.
setProgress
(
100
)
def
setExperiment
(
self
,
experiment
):
if
self
.
_operation_thread
.
isRunning
()
is
True
:
...
...
orangecontrib/id06workflow/widgets/mapping.py
View file @
9b0c89c2
...
...
@@ -32,8 +32,10 @@ from Orange.widgets.widget import OWWidget
from
Orange.canvas.registry.description
import
InputSignal
,
OutputSignal
from
id06workflow.core.experiment
import
Experiment
from
id06workflow.core.experiment.operation.mapping
import
IntensityMapping
from
id06workflow.core.experiment.operation.ThreadedOperation
import
ThreadedOperation
from
id06workflow.core.types
import
_Image
from
id06workflow.gui.mapping
import
MappingPlot
from
functools
import
partial
import
logging
_logger
=
logging
.
getLogger
(
__file__
)
...
...
@@ -63,15 +65,33 @@ class MappingOW(OWWidget):
super
().
__init__
()
layout
=
gui
.
vBox
(
self
.
mainArea
,
'noise removal'
).
layout
()
self
.
_progress
=
gui
.
ProgressBar
(
self
,
100
)
self
.
_plot
=
MappingPlot
(
parent
=
self
)
layout
.
addWidget
(
self
.
_plot
)
self
.
_processing_thread
=
ThreadedOperation
()
def
_setProgressValue
(
self
,
value
):
self
.
_progress
.
widget
.
progressBarSet
(
value
)
def
_process
(
self
,
experiment
):
if
experiment
is
None
:
return
if
self
.
_processing_thread
.
isRunning
():
_logger
.
error
(
'Mapping thread is already running, cannot take another'
'job yet'
)
return
operation
=
IntensityMapping
(
experiment
=
experiment
)
operation
.
compute
()
operation
.
sigProgress
.
connect
(
self
.
_setProgressValue
)
self
.
_processing_thread
.
init
(
operation
)
callback
=
partial
(
self
.
_post_processing
,
operation
,
experiment
)
self
.
_processing_thread
.
finished
.
connect
(
callback
)
self
.
_processing_thread
.
start
()
def
_post_processing
(
self
,
operation
,
experiment
):
self
.
send
(
"image"
,
_Image
(
img
=
operation
.
intensity_map
,
name
=
'intensity_map'
))
self
.
send
(
"image"
,
...
...
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