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.QPushButtonA button to rescale the straditize image
Methods
adjust_orig_limits(*args, **kwargs)Readjust
ax_origafter changes inax_rescaleadjust_rescaled_limits(*args, **kwargs)Readjust
ax_rescaleafter changes inax_origClose the
figequalize_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_rescaleafter adjustments of thesliderresize_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_origThe matplotlib axes for the
im_rescaleThe 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.Sliderfor specifying the size of the-
adjust_orig_limits(*args, **kwargs)[source]¶ Readjust
ax_origafter changes inax_rescale
-
adjust_rescaled_limits(*args, **kwargs)[source]¶ Readjust
ax_rescaleafter 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_rescaleafter 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
imageof 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
widgets2disableattribute 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.Sliderfor 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.QWidgetWidget to rotate the image
This control mainly adds a QLineEdit
txt_rotateto thestraditize.widgets.StraditizerWidgetsto 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_rotateas 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
angleCheck 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_rotatefrom the displayed cross marks-
property
angle¶ The rotation angle from
txt_rotateas 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
widgets2disableif 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
widgets2disableattribute 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_rotatefrom the displayed cross marks