straditize.widgets.pattern_selection module¶
A wdiget to select patterns in the image
The PatternSelectionWidget
is used by the
straditize.widget.selection_toolbar.SelectionToolbar
to select
patterns in the straditizer image
Disclaimer
Copyright (C) 2018-2019 Philipp S. Sommer
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Classes
|
Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.). |
|
A wdiget to select patterns in the image |
-
class
straditize.widgets.pattern_selection.
EmbededMplCanvas
(parent=None, *args, **kwargs)[source]¶ Bases:
matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg
Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).
-
class
straditize.widgets.pattern_selection.
PatternSelectionWidget
(arr, data_obj, remove_selection=False, *args, **kwargs)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
,psyplot_gui.common.DockMixin
A wdiget to select patterns in the image
This widget consist of an
EmbededMplCanvas
to display the template for the pattern and uses theskimage.feature.match_template()
function to identify it in thearr
See also
straditize.widget.selection_toolbar.SelectionToolbar.start_pattern_selection
Attributes
The selector to select the template in the original image
A QSlider to set the threshold for the template correlation
The template to look for in the
arr
The extents of the
template
in the original imageThe
EmbededMplCanvas
to display thetemplate
The matplotlib artist of the
template
in theMethods
cancel
()correlate_template
(arr, template[, …])Correlate a template with the arr
Modify the selection based on the correlation threshold
Remove this plugin and close it
Look for the correlations of template and source
to_dock
(main[, title, position, docktype])Toggle the correlation plot between
template
andarr
Modifiy the selection (or not) based on the template correlation
Enable or disable the template selection
update_image
(*args, **kwargs)Update the template image based on the
selector
extents- Parameters
arr (np.ndarray of shape
(Ny, Nx)
) – The labeled selection arraydata_obj (straditize.label_selection.LabelSelection) – The data object whose image shall be selected
remove_selection (bool) – If True, remove the selection on apply
-
axes
= None¶
-
correlate_template
(arr, template, fraction=False, increment=1, report=True)[source]¶ Correlate a template with the arr
This method uses the
skimage.feature.match_template()
function to find the given template in the source array arr.- Parameters
arr (np.ndarray of shape
(Ny,Nx)
) – The labeled selection array (seearr
), the source of the given templatetemplate (np.ndarray of shape
(nx, ny)
) – The template fromarr
that shall be searchedfraction (float) – If not null, we will look through the given fraction of the template to look for partial matches as well
increment (int) – The increment of the loop with the fraction.
report (bool) – If True and fraction is not null, a QProgressDialog is opened to inform the user about the progress
-
key_press_cid
= None¶
-
selector
= None¶ The selector to select the template in the original image
-
sl_thresh
= None¶ A QSlider to set the threshold for the template correlation
-
template
= None¶ The template to look for in the
arr
-
template_fig
= None¶ The
EmbededMplCanvas
to display thetemplate
-
template_im
= None¶ The matplotlib artist of the
template
in thetemplate_fig