convert#
  | 
Convert a Matplotlib figure to a 3D numpy array with RGBA channels.  | 
matplotlib_figure_to_numpy#
- fury.convert.matplotlib_figure_to_numpy(fig, *, dpi=100, fname=None, flip_up_down=True, transparent=False)[source]#
 Convert a Matplotlib figure to a 3D numpy array with RGBA channels.
- Parameters:
 - figobj
 A matplotlib figure object
- dpiint, optional
 Dots per inch
- fnamestr, optional
 If
fnameis given then the array will be saved as a png to this position.- flip_up_downbool, optional
 The origin is different from matlplotlib default and VTK’s default behaviour (default True).
- transparentbool, optional
 Make background transparent (default False).
- Returns:
 - arrndarray
 a numpy 3D array of RGBA values
Notes
The safest way to read the pixel values from the figure was to save them using savefig as a png and then read again the png. There is a cleaner way found here http://www.icare.univ-lille1.fr/drupal/node/1141 where you can actually use fig.canvas.tostring_argb() to get the values directly without saving to the disk. However, this was not stable across different machines and needed more investigation from what time permitted.