porespy.visualization.prep_for_imshow#
- porespy.visualization.prep_for_imshow(im, mask=None, axis=0, slice=None)#
Adjusts the range of greyscale values in an image to improve visualization by
matplotlib.pyplot.imshow- Parameters:
im (ndimage) – The image to show. If
imincludes+infor-infvalues, they are converted to 1 above or below the minimum and maximum finite values inim, respectively.mask (ndimage, optional) – An image of the porous material with
Trueindicating voxels of interest. TheFalsevoxels are excluded from thevmaxandvmincalculation.axis (int, optional) – If the image is 3D, a 2D image is returned with the specified
slicetaken along this axis (default = 0). IfNonethen a 3D image is returned. If the image is 2D this is ignored.slice (int, optional) – If
imis 3D, a 2D image is be returned showing this slice along the givenaxis. IfNone, then a slice at the mid-point of the axis is returned. IfaxisisNoneor the image is 2D this is ignored.
- Returns:
kwargs – A python dicionary designed to be passed directly to
matplotlib.pyplot.imshowusing the “**kwargs” features (i.e.plt.imshow(\*\*data)). It contains the following key-value pairs:key
value
’X’
The adjusted image with
+infreplaced byvmax + 1, and all solid voxels replacd bynp.nanto show as white inimshow’vmax’
The maximum of
valuesnot including+infor values inFalsevoxels inmask.’vmin’
The minimum of
valuesnot including-infor values inFalsevoxels inmask.’interpolation’
Set to ‘none’ to avoid artifacts in
imshow’origin’
Set to ‘lower’ to put (0, 0) on the bottom-left corner
- Return type:
dict
Notes
If any of the extra items are unwanted they can be removed with
del data['interpolation']ordata.pop('interpolation').Examples
Click here to view online example.