Stoner.Image.ImageFile¶
- class Stoner.Image.ImageFile(*args)[source]¶
An Image file type that is analogous to
Stoner.Data.This contains metadata and an image attribute which is an
Stoner.Image.ImageArraytype which subclasses numpy ndarray and adds lots of extra image specific processing functions.- image¶
A
numpy.ndarraysubclass that stores the actual image data.- Type:
- metadata¶
A dictionary of metadata items associated with this image.
- Type:
Stoner.core.RegexpDict
- mask¶
A special object that allows manipulation of the image’s mask - thius allows the user to selectively disable regions of the image from rpocessing functions.
- draw¶
A special object that allows the user to manipulate the image data by making use of
skimage.drawfunctions as well as some additional drawing functions.
- clone¶
Return a duplicate copy of the current image - this allows subsequent methods to modify the cloned version rather than the original version.
- Type:
Stoner.ImageFile
- max_box¶
The extent of the image size in a form suitable for use in defining a box.
- Type:
tuple (0,x-size,0-y-size)
- dtype¶
The current dtype of the elements of the image data.
- Type:
The ImageFile owned attribute is image. All other calls including metadata are passed through to ImageArray (so no need to inherit from metadataObject).
Almost all calls to ImageFile are passed through to the underlying ImageArray logic and ImageArray can be used as a standalone class. However because ImageArray subclasses an ndarray it is not possible to enter it in place. All attributes return an array instance which needs to be reassigned. ImageFile owns image and so can change in place. The penalty is that numpy ufuncs don’t return ImageFile type
so can do:
imfile.asfloat() #imagefile.image is updated to float type however need to do: imfile.image = np.abs(imfile.image)
whereas for imarray need to do:
imarray = imagearray.asfloat()
but:
np.abs(imarray) #returns ImageArray type
Methods
Rescale the intensity of the image.
Stoner__Image__imagefuncs__align(ref[, method])Use one of a variety of algroithms to align two images.
Provide a consistent way to get at the underlying array data in both ImageArray and ImageFile objects.
Return the image converted to floating point type.
Stoner__Image__imagefuncs__asint([dtype])Convert the image to unsigned integer format.
Clip intensity outside the range -1,1 or 0,1.
Clip negative pixels to 0.
Stoner__Image__imagefuncs__convert(dtype[, ...])Convert an image to the requested data-type.
Align images to correct for image drift.
Stoner__Image__imagefuncs__crop(*args, **kwargs)Crop the image according to a box.
Stoner__Image__imagefuncs__denoise([weight])Rename the skimage restore function.
Nulop function for testing the integration into ImageArray.
Return intensity limits, i.e. (min, max) tuple, of the image's dtype.
Stoner__Image__imagefuncs__fft([shift, ...])Perform a 2d fft of the image and shift the result to get zero frequency in the centre.
Alias for skimage.filters.gaussian.
Use
scipy.interpolate.griddata()to shift the image to a regular grid of coordinates.Stoner__Image__imagefuncs__hist(*args, **kwargs)Pass through to
matplotlib.pyplot.hist()function.Stoner__Image__imagefuncs__imshow([figure, ...])Quickly plot of image.
Subtract a polynomial background from image.
Norm alise the data to a fixed scale.
Plot the histogram and cumulative distribution for the image.
Wrap sckit-image method of the same name to get a line_profile.
Quantise the image data into fixed levels given by a mapping.
Rerurn a map of the radial coordinates of an image from a given centre, with adjustments for pixel size.
Extract a radial profile line from an image.
Find values of the data that are beyond a percentile of the overall distribution and replace them.
Stoner__Image__imagefuncs__rotate(angle[, ...])Rotate image by a certain angle around its center.
Stoner__Image__imagefuncs__save([filename])Save the image into the file 'filename'.
Stoner__Image__imagefuncs__save_npy(filename)Save the ImageArray as a numpy array.
Stoner__Image__imagefuncs__save_png(filename)Save the ImageArray with metadata in a png file.
Stoner__Image__imagefuncs__save_tiff(filename)Save the ImageArray as a tiff image with metadata.
Implements a 2D Savitsky Golay Filter for a 2D array (e.g. image).
Return the minimum and maximum values in the image.
Subtract a background image from the ImageArray.
Return a boolean array which is thresholded between threshmin and threshmax.
Stoner__Image__imagefuncs__translate(translation)Translate the image.
Find the limits of an image after a translation.
__init__(*args, **kwargs)Mostly a pass through to ImageArray constructor.
adjust_contrast([lims, percent])Rescale the intensity of the image.
align(ref[, method])Use one of a variety of algroithms to align two images.
all([axis, out, keepdims])Returns True if all elements evaluate to True.
anom([axis, dtype])Compute the anomalies (deviations from the arithmetic mean) along the given axis.
any([axis, out, keepdims])Returns True if any of the elements of a evaluate to True.
argmax([axis, fill_value, out, keepdims])Returns array of indices of the maximum values along the given axis.
argmin([axis, fill_value, out, keepdims])Return array of indices to the minimum values along the given axis.
argpartition(*args, **kwargs)argsort([axis, kind, order, endwith, ...])Return an ndarray of indices that sort the array along the specified axis.
asarray()Provide a consistent way to get at the underlying array data in both ImageArray and ImageFile objects.
asfloat([normalise, clip, clip_negative])Return the image converted to floating point type.
asint([dtype])Convert the image to unsigned integer format.
astype(dtype[, order, casting, subok, copy])Copy of the array, cast to a specified type.
byteswap([inplace])Swap the bytes of the array elements
choose(choices[, out, mode])Use an index array to construct a new array from a set of choices.
clear()clip([min, max, out])Return an array whose values are limited to
[min, max].clip_intensity([clip_negative, limits])Clip intensity outside the range -1,1 or 0,1.
clip_neg()Clip negative pixels to 0.
compress(condition[, axis, out])Return a where condition is
True.Return all the non-masked data as a 1-D array.
conj()Complex-conjugate all elements.
Return the complex conjugate, element-wise.
convert(dtype[, force_copy, uniform, normalise])Convert an image to the requested data-type.
copy([order])Return a copy of the array.
correct_drift(ref, **kwargs)Align images to correct for image drift.
count([axis, keepdims])Count the non-masked elements of the array along the given axis.
crop(*args, **kwargs)Crop the image according to a box.
cumprod([axis, dtype, out])Return the cumulative product of the array elements over the given axis.
cumsum([axis, dtype, out])Return the cumulative sum of the array elements over the given axis.
denoise([weight])Rename the skimage restore function.
diagonal([offset, axis1, axis2])Return specified diagonals.
Nulop function for testing the integration into ImageArray.
dot(b[, out])Masked dot product of two arrays.
dtype_limits([clip_negative])Return intensity limits, i.e. (min, max) tuple, of the image's dtype.
dump(file)Dump a pickle of the array to the specified file.
dumps()Returns the pickle of the array as a string.
fft([shift, phase, remove_dc, gaussian, window])Perform a 2d fft of the image and shift the result to get zero frequency in the centre.
fill(value)Fill the array with a scalar value.
filled([fill_value])Return a copy of self, with masked values filled with a given value.
filter_image([sigma])Alias for skimage.filters.gaussian.
flatten([order])Return a copy of the array collapsed into one dimension.
get(k[,d])get_filename(mode)Force the user to choose a new filename using a system dialog box.
The filling value of the masked array is a scalar.
get_imag()The imaginary part of the masked array.
get_real()The real part of the masked array.
getfield(dtype[, offset])Returns a field of the given array as a certain type.
gridimage([points, xi, method, fill_value, ...])Use
scipy.interpolate.griddata()to shift the image to a regular grid of coordinates.Force the mask to hard, preventing unmasking by assignment.
hist(*args, **kwargs)Pass through to
matplotlib.pyplot.hist()function.ids()Return the addresses of the data and mask areas.
imshow([figure, ax, title, title_args, ...])Quickly plot of image.
Return a boolean indicating whether the data is contiguous.
item(*args)Copy an element of an array to a standard Python scalar and return it.
items()Make sure we implement an items that doesn't just iterate over self.
keys()Return the keys of the metadata dictionary.
level_image([poly_vert, poly_horiz, box, ...])Subtract a polynomial background from image.
load(*args, **kwargs)Create a
ImageFilefrom file abnd guessing a better subclass if necessary.max([axis, out, fill_value, keepdims])Return the maximum along a given axis.
mean([axis, dtype, out, keepdims])Returns the average of the array elements along given axis.
min([axis, out, fill_value, keepdims])Return the minimum along a given axis.
nonzero()Return the indices of unmasked elements that are not zero.
normalise([scale, sample, limits, scale_masked])Norm alise the data to a fixed scale.
partition(*args, **kwargs)plot_histogram([bins])Plot the histogram and cumulative distribution for the image.
pop(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem()as a 2-tuple; but raise KeyError if D is empty.
prod([axis, dtype, out, keepdims])Return the product of the array elements over the given axis.
product([axis, dtype, out, keepdims])Return the product of the array elements over the given axis.
profile_line([src, dst, linewidth, order, ...])Wrap sckit-image method of the same name to get a line_profile.
ptp([axis, out, fill_value, keepdims])Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value).
put(indices, values[, mode])Set storage-indexed locations to corresponding values.
quantize(output[, levels])Quantise the image data into fixed levels given by a mapping.
radial_coordinates([centre, pixel_size, angle])Rerurn a map of the radial coordinates of an image from a given centre, with adjustments for pixel size.
radial_profile([angle, r, centre, pixel_size])Extract a radial profile line from an image.
ravel([order])Returns a 1D version of self, as a view.
remove_outliers([percentiles, replace])Find values of the data that are beyond a percentile of the overall distribution and replace them.
repeat(repeats[, axis])Repeat elements of an array.
reshape(*s, **kwargs)Give a new shape to the array without changing its data.
resize(newshape[, refcheck, order])rotate(angle[, resize, center, order, mode, ...])Rotate image by a certain angle around its center.
round([decimals, out])Return each element rounded to the given number of decimals.
save([filename])Save the image into the file 'filename'.
save_npy(filename)Save the ImageArray as a numpy array.
save_png(filename)Save the ImageArray with metadata in a png file.
save_tiff(filename[, forcetype])Save the ImageArray as a tiff image with metadata.
searchsorted(v[, side, sorter])Find indices where elements of v should be inserted in a to maintain order.
set_fill_value([value])setdefault(k[,d])setfield(val, dtype[, offset])Put a value into a specified place in a field defined by a data-type.
setflags([write, align, uic])Set array flags WRITEABLE, ALIGNED, WRITEBACKIFCOPY, respectively.
sgolay2d([points, poly, derivative])Implements a 2D Savitsky Golay Filter for a 2D array (e.g. image).
Reduce a mask to nomask when possible.
Force the mask to soft (default), allowing unmasking by assignment.
sort([axis, kind, order, endwith, ...])Sort the array, in-place
span()Return the minimum and maximum values in the image.
squeeze([axis])Remove axes of length one from a.
std([axis, dtype, out, ddof, keepdims, mean])Returns the standard deviation of the array elements along given axis.
subtract_image(background[, contrast, clip, ...])Subtract a background image from the ImageArray.
sum([axis, dtype, out, keepdims])Return the sum of the array elements over the given axis.
swapaxes(axis1, axis2)Return a view of the array with axis1 and axis2 interchanged.
take(indices[, axis, out, mode])Take elements from a masked array along an axis.
threshold_minmax([threshmin, threshmax])Return a boolean array which is thresholded between threshmin and threshmax.
tobytes([fill_value, order])Return the array data as a string containing the raw bytes in the array.
tofile(fid[, sep, format])Save a masked array to a file in binary format.
toflex()Transforms a masked array into a flexible-type array.
tolist([fill_value])Return the data portion of the masked array as a hierarchical Python list.
Transforms a masked array into a flexible-type array.
trace([offset, axis1, axis2, dtype, out])Return the sum along diagonals of the array.
translate(translation[, add_metadata, ...])Translate the image.
translate_limits(translation[, reverse])Find the limits of an image after a translation.
transpose(*axes)Returns a view of the array with axes transposed.
Copy the mask and set the sharedmask flag to
False.update([E, ]**F)If E present and has a .keys() method, does: for k in E.keys(): D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values()Return the values of the metadata dictionary.
var([axis, dtype, out, ddof, keepdims, mean])Compute the variance along the specified axis.
view([dtype, type, fill_value])Return a view of the MaskedArray data.
Attributes
Clone the image and then rotate the imaage 90 degrees counter clockwise.
Clone the image and then rotate the imaage 90 degrees clockwise.
Return the aspect ratio (width/height) of the image.
basePass thrpough for base
baseclassClass of the underlying data (read-only).
Return the coordinates of the centre of the image.
Make a copy of this ImageFile.
ctypesPass thrpough for ctypes
data].
debugPass thrpough for debug
devicePass thrpough for device
Access the DrawProxy object for accessing the skimage draw sub module.
Pass thrpough for filename
fill_valueThe filling value of the masked array is a scalar.
flagsPass thrpough for flags
flatReturn the numpy.ndarray.flat rather than a MaskedIterator.
Clone the image and then mirror the image horizontally.
Clone the image and then mirror the image vertically.
fmtsPass thrpough for fmts
hardmaskSpecifies whether values can be unmasked through assignments.
imagThe imaginary part of the masked array.
Access the image data.
itemsetPass thrpough for itemset
itemsizePass thrpough for itemsize
mTReturn the matrix-transpose of the masked array.
Get the mask of the underlying IamgeArray.
Return the maximum coordinate extent (xmin,xmax,ymin,ymax).
Read the metadata dictionary.
mime_typenbytesPass thrpough for nbytes
ndimPass thrpough for ndim
newbyteorderPass thrpough for newbyteorder
priorityrealThe real part of the masked array.
recordmaskGet or set the mask of the array if it has no named fields.
sharedmaskShare status of the mask (read-only).
sizePass thrpough for size
stridesPass thrpough for strides
Get a title for this image.