pyiron_contrib.image.job module
- class pyiron_contrib.image.job.ImageJob(project, job_name)[source]
Bases:
GenericJob
A job type for storing and processing image data.
TODO: Consider allowing the data field of each image to be saved to hdf5…
- images
A list of Image objects.
- Type
- add_image(source, metadata=None, as_gray=False, relative_path=True)[source]
Add an image to the job.
- Parameters
source (str/numpy.ndarray) – The filepath to the data, or the raw array of data itself.
metadata (Metadata) – The metadata associated with the source. (Default is None.)
as_gray (bool) – Whether to interpret the new data as grayscale. (Default is False.)
relative_path (bool) – Whether the path provided is relative. (Default is True, automatically converts to an absolute path before setting the source value of the image.)
- add_images(sources, metadata=None, as_gray=False)[source]
Add multiple images to the job.
- Parameters
sources (str/list/tuple/numpy.ndarray) – When a string, uses the glob module to look for matching files. When list-like, iteratively uses each element as a new source.
metadata (Metadata) – The metadata associated with all these sources. (Default is None.)
as_gray (bool) – Whether to interpret all this data as grayscale. (Default is False.)
relative_path (bool) – Whether the path provided is relative. (Default is True, automatically converts to an absolute path before setting the source value of the image.)
- from_hdf(hdf=None, group_name=None)[source]
Load the Protocol from an HDF5 file.
- Parameters
hdf (ProjectHDFio) – HDF5 group object - optional
group_name (str) – HDF5 subgroup name - optional
- property images
- plot(mask=None, subplots_kwargs=None, imshow_kwargs=None, hide_axes=True)[source]
Make a simple matplotlib imshow plot for each of the images on a grid.
- Parameters
mask (list/numpy.ndarray) – An integer index mask for selecting a subset of the images to plot.
subplots_kwargs (dict) – Keyword arguments to pass to the figure generation. (Default is None.)
imshow_kwargs (dict) – Keyword arguments to pass to the imshow plotting command. (Default is None.)
hide_axes (bool) – Whether to hide axis ticks and labels. (Default is True.)
- Returns
The figure the plots are in. (list): The axes the plot is on.
- Return type
(matplotlib.figure.Figure)
- run(run_again=False, repair=False, debug=False, run_mode=None)[source]
This is the main run function, depending on the job status [‘initialized’, ‘created’, ‘submitted’, ‘running’, ‘collect’,’finished’, ‘refresh’, ‘suspended’] the corresponding run mode is chosen.
- Parameters
delete_existing_job (bool) – Delete the existing job and run the simulation again.
repair (bool) – Set the job status to created and run the simulation again.
debug (bool) – Debug Mode - defines the log level of the subprocess the job is executed in.
run_mode (str) – [‘modal’, ‘non_modal’, ‘queue’, ‘manual’] overwrites self.server.run_mode
run_again (bool) – Same as delete_existing_job (deprecated)