MCPcopy Create free account
hub / github.com/vispy/vispy / set_data

Method set_data

vispy/visuals/image.py:375–398  ·  view source on GitHub ↗

Set the image data. Parameters ---------- image : array-like The image data. texture_format : str or None

(self, image, copy=False)

Source from the content-addressed store, hash-verified

373 return tex
374
375 def set_data(self, image, copy=False):
376 """Set the image data.
377
378 Parameters
379 ----------
380 image : array-like
381 The image data.
382 texture_format : str or None
383
384 """
385 data = np.array(image, copy=copy or np_copy_if_needed)
386 if np.iscomplexobj(data):
387 raise TypeError(
388 "Complex data types not supported. Please use 'ComplexImage' instead"
389 )
390 # can the texture handle this data?
391 self._texture.check_data_format(data)
392 if self._data is None or self._data.shape[:2] != data.shape[:2]:
393 # Only rebuild if the size of the image changed
394 self._need_vertex_update = True
395 self._data = data
396 self._need_texture_upload = True
397
398 self.update()
399
400 def view(self):
401 """Get the :class:`vispy.visuals.visual.VisualView` for this visual."""

Callers 2

__init__Method · 0.95
_build_vertex_dataMethod · 0.45

Calls 2

check_data_formatMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected