straditize.widgets.image_correction module¶
Image correction methods
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
|
A button to rescale the straditize image |
|
Widget to rotate the image |
-
class
straditize.widgets.image_correction.
ImageRescaler
(straditizer_widgets, item, *args, **kwargs)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
,PyQt5.QtWidgets.QPushButton
A button to rescale the straditize image
Methods
adjust_orig_limits
(*args, **kwargs)Readjust
ax_orig
after changes inax_rescale
adjust_rescaled_limits
(*args, **kwargs)Readjust
ax_rescale
after changes inax_orig
Close the
fig
equalize_axes
([event])Set both axes to the same size
Raise the figure for rescaling
rescale
([ask])Rescale and start a new straditizer
rescale_plot
(percentage)Replot
im_rescale
after adjustments of theslider
resize_stradi_image
(percentage)Resize the straditizer image
Check if a widget should be enabled
Create the rescaling figure
Attributes
The matplotlib axes for the
im_orig
The matplotlib axes for the
im_rescale
The matplotlib figure for the rescaling
The matplotlib image for the original diagram
The matplotlib image for the rescaled diagram
Boolean that is true if one of the axes is rescaling
A
matplotlib.widgets.Slider
for specifying the size of the-
adjust_orig_limits
(*args, **kwargs)[source]¶ Readjust
ax_orig
after changes inax_rescale
-
adjust_rescaled_limits
(*args, **kwargs)[source]¶ Readjust
ax_rescale
after changes inax_orig
-
ax_rescale
= None¶ The matplotlib axes for the
im_rescale
-
fig
= None¶ The matplotlib figure for the rescaling
-
im_orig
= None¶ The matplotlib image for the original diagram
-
im_rescale
= None¶ The matplotlib image for the rescaled diagram
-
rescale
(ask=None)[source]¶ Rescale and start a new straditizer
- Parameters
ask (bool) – Whether to ask with a QMessageBox. If None, it defaults to the
straditize.widgets.StraditizerWidgers.always_yes
-
rescale_plot
(percentage)[source]¶ Replot
im_rescale
after adjustments of theslider
-
property
rescaling
¶ Boolean that is true if one of the axes is rescaling
-
resize_stradi_image
(percentage)[source]¶ Resize the straditizer image
- Parameters
percentage (float) – A float between 0 and 100 specifying the target size of the
straditize.straditizer.Straditizer.image
- Returns
The resized
image
of the current straditizer- Return type
-
should_be_enabled
(w)[source]¶ Check if a widget should be enabled
This function checks if a given widget w from the
widgets2disable
attribute should be enabled or not- Parameters
w (QWidget) – The widget to check
- Returns
True, if the widget should be enabled
- Return type
-
slider
= None¶ A
matplotlib.widgets.Slider
for specifying the size of the rescaled image
-
-
class
straditize.widgets.image_correction.
ImageRotator
(straditizer_widgets, item=None, *args, **kwargs)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
,PyQt5.QtWidgets.QWidget
Widget to rotate the image
This control mainly adds a QLineEdit
txt_rotate
to thestraditize.widgets.StraditizerWidgets
to rotate the image. It also enables the user to specify the rotation angle using two connectedCrossMarks
. Here the user can decide between a horizontal alignment (btn_rotate_horizontal
) or a vertical alignment (btn_rotate_vertical
)- Parameters
straditizer_widgets (StraditizerWidgets) – The main widget for the straditizer GUI
item (QTreeWidgetItem) – The parent item in the
StraditizerWidgets.tree
. If given, thesetup_children()
is called with this item
Attributes
The rotation angle from
txt_rotate
as a floatA QPushButton for horizontal alignment
A QPushButton for vertical alignment
A QLineEdit to display the rotation angle
Methods
Enable or disable the widgets in this control
Remove the cross marks used for the rotation angle
Rotate the image based on the specified
angle
Check if a widget should be enabled
Start the horizontal alignment
Start the rotation (if not already started)
Start the vertical alignment
update_txt_rotate
(*args[, marks])Update the
txt_rotate
from the displayed cross marks-
property
angle
¶ The rotation angle from
txt_rotate
as a float
-
btn_rotate_horizontal
= None¶ A QPushButton for horizontal alignment
-
btn_rotate_vertical
= None¶ A QPushButton for vertical alignment
-
enable_or_disable_widgets
(b)[source]¶ Enable or disable the widgets in this control
This method enables or disables the
widgets2disable
if theshould_be_enabled()
method evaluates to True- Parameters
b (bool) – If True, enable the widgets, if False, disable them
-
should_be_enabled
(w)[source]¶ Check if a widget should be enabled
This function checks if a given widget w from the
widgets2disable
attribute should be enabled or not- Parameters
w (QWidget) – The widget to check
- Returns
True, if the widget should be enabled
- Return type
-
txt_rotate
= None¶ A QLineEdit to display the rotation angle
-
update_txt_rotate
(*args, marks=[], **kwargs)[source]¶ Update the
txt_rotate
from the displayed cross marks