1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
'''
Code for package-level customization.
'''
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
class SpySettings:
'''Run-time settings for the `spectral` module.
After importing `spectral`, the settings object is referenced as
`spectral.settings`.
Noteworthy members:
`WX_GL_DEPTH_SIZE` (integer, default 24):
Sets the depth (in number of bits) for the OpenGL depth buffer.
If calls to `view_cube` or `view_nd` result in windows with blank
canvases, try reducing this value.
`envi_support_nonlowercase_params` (bool, default False)
By default, ENVI headers are read with parameter names converted
to lower case. If this attribute is set to True, parameters will
be read with original capitalization retained.
`show_progress` (bool, default True):
Indicates whether long-running algorithms should display progress
to sys.stdout. It can be useful to set this value to False when
SPy is embedded in another application (e.g., IPython Notebook).
`imshow_figure_size` (2-tuple of integers, default `None`):
Width and height (in inches) of windows opened with `imshow`. If
this value is `None`, matplotlib's default size is used.
`imshow_background_color` (3-tuple of integers, default (0,0,0)):
Default color to use for masked pixels in `imshow` displays.
`imshow_interpolation` (str, default `None`):
Pixel interpolation to be used in imshow windows. If this value
is `None`, matplotlib's default interpolation is used. Note that
zoom windows always use "nearest" interpolation.
`imshow_stretch`:
Default RGB linear color stretch to perform.
`imshow_stretch_all`:
If True, each color channel limits are determined independently.
`imshow_zoom_figure_width` (int, default `None`):
Width of zoom windows opened from an imshow window. Since zoom
windows are always square, this is also the window height. If this
value is `None`, matplotlib's default window size is used.
`imshow_zoom_pixel_width` (int, default 50):
Number of source image pixel rows and columns to display in a
zoom window.
`imshow_float_cmap` (str, default "gray"):
imshow color map to use with floating point arrays.
`imshow_class_alpha` (float, default 0.5):
alpha blending value to use for imshow class overlays
`imshow_enable_rectangle_selector` (bool, default True):
Whether to create the rectangle selection tool that enables
interactive image pixel class labeling. On some OS/backend
combinations, an exception may be raised when this object is
created so disabling it allows imshow windows to be created without
using the selector tool.
`imshow_disable_mpl_callbacks` (bool, default True):
If True, several matplotlib keypress event callbacks will be
disabled to prevent conflicts with callbacks from SPy. The
matplotlib callbacks can be set back to their defaults by
calling `matplotlib.rcdefaults()`.
'''
viewer = None
plotter = None
# If START_WX_APP is True and there is no current wx.App object when a
# GUI function is called, then an app object will be created.
START_WX_APP = True
# Parameter used by GLCanvas objects in view_cube and view_nd. If the
# canvas does not render, try reducing this value (e.g., 16).
WX_GL_DEPTH_SIZE = 24
envi_support_nonlowercase_params = False
# Should algorithms show completion progress of algorithms?
show_progress = True
# imshow settings
imshow_figure_size = None
imshow_background_color = (0, 0, 0)
imshow_interpolation = None
imshow_stretch = (0.0, 1.0)
imshow_stretch_all = True
imshow_zoom_figure_width = None
imshow_zoom_pixel_width = 50
imshow_float_cmap = 'gray'
imshow_class_alpha = 0.5
imshow_enable_rectangle_selector = True
imshow_disable_mpl_callbacks = True
# Default color table
spy_colors = np.array([[0, 0, 0],
[255, 0, 0],
[0, 255, 0],
[0, 0, 255],
[255, 255, 0],
[255, 0, 255],
[0, 255, 255],
[200, 100, 0],
[0, 200, 100],
[100, 0, 200],
[200, 0, 100],
[100, 200, 0],
[0, 100, 200],
[150, 75, 75],
[75, 150, 75],
[75, 75, 150],
[255, 100, 100],
[100, 255, 100],
[100, 100, 255],
[255, 150, 75],
[75, 255, 150],
[150, 75, 255],
[50, 50, 50],
[100, 100, 100],
[150, 150, 150],
[200, 200, 200],
[250, 250, 250],
[100, 0, 0],
[200, 0, 0],
[0, 100, 0],
[0, 200, 0],
[0, 0, 100],
[0, 0, 200],
[100, 100, 0],
[200, 200, 0],
[100, 0, 100],
[200, 0, 200],
[0, 100, 100],
[0, 200, 200]], np.int16)
|