Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce9c197

Browse files
committed
we can just subclass ImageGraphic
1 parent b2b9b10 commit ce9c197

File tree

1 file changed

+2
-60
lines changed

1 file changed

+2
-60
lines changed

fastplotlib/graphics/image_volume.py

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from ..utils import quick_min_max
66
from ._base import Graphic
7+
from .image import ImageGraphic
78
from .features import (
89
TextureArray,
910
ImageCmap,
@@ -71,7 +72,7 @@ def chunk_index(self) -> tuple[int, int, int]:
7172
return self._chunk_index
7273

7374

74-
class ImageVolumeGraphic(Graphic):
75+
class ImageVolumeGraphic(ImageGraphic):
7576
_features = {
7677
"data": TextureArray,
7778
"cmap": ImageCmap,
@@ -162,15 +163,6 @@ def __init__(
162163

163164
self._set_world_object(world_object)
164165

165-
@property
166-
def data(self) -> TextureArray:
167-
"""Get or set the image data"""
168-
return self._data
169-
170-
@data.setter
171-
def data(self, data):
172-
self._data[:] = data
173-
174166
@property
175167
def cmap(self) -> str:
176168
"""colormap name"""
@@ -179,53 +171,3 @@ def cmap(self) -> str:
179171
@cmap.setter
180172
def cmap(self, name: str):
181173
self._cmap.set_value(self, name)
182-
183-
@property
184-
def vmin(self) -> float:
185-
"""lower contrast limit"""
186-
return self._vmin.value
187-
188-
@vmin.setter
189-
def vmin(self, value: float):
190-
self._vmin.set_value(self, value)
191-
192-
@property
193-
def vmax(self) -> float:
194-
"""upper contrast limit"""
195-
return self._vmax.value
196-
197-
@vmax.setter
198-
def vmax(self, value: float):
199-
self._vmax.set_value(self, value)
200-
201-
@property
202-
def interpolation(self) -> str:
203-
"""image data interpolation method"""
204-
return self._interpolation.value
205-
206-
@interpolation.setter
207-
def interpolation(self, value: str):
208-
self._interpolation.set_value(self, value)
209-
210-
@property
211-
def cmap_interpolation(self) -> str:
212-
"""cmap interpolation method"""
213-
return self._cmap_interpolation.value
214-
215-
@cmap_interpolation.setter
216-
def cmap_interpolation(self, value: str):
217-
self._cmap_interpolation.set_value(self, value)
218-
219-
def reset_vmin_vmax(self):
220-
"""
221-
Reset the vmin, vmax by estimating it from the data
222-
223-
Returns
224-
-------
225-
None
226-
227-
"""
228-
229-
vmin, vmax = quick_min_max(self._data.value)
230-
self.vmin = vmin
231-
self.vmax = vmax

0 commit comments

Comments
 (0)