def save_annotated(self, fn, image, enhance=True, dpi=100, clear_fig=True,
label_fmt=None):
"""
Save an image with the transfer function represented as a colorbar.
Parameters
----------
fn : str
The output filename
image : ImageArray
The image to annotate
enhance : bool, optional
Enhance the contrast (default: True)
dpi : int, optional
Dots per inch in the output image (default: 100)
clear_fig : bool, optional
Reset the figure (through pylab.clf()) before drawing. Setting
this to false can allow us to overlay the image onto an
existing figure
label_fmt : str, optional
A format specifier (e.g., label_fmt="%.2g") to use in formatting
the data values that label the transfer function colorbar.
"""
image = image.swapaxes(0,1)
ax = self.show_mpl(image, enhance=enhance, clear_fig=clear_fig)
self.annotate(ax.axes, enhance, label_fmt=label_fmt)
self._pylab.savefig(fn, bbox_inches='tight', facecolor='black', dpi=dpi)
评论列表
文章目录