Camera.add_images¶
- Camera.add_images(data, parse_data=True, preprocessor=True, metadata_only=False)[source]¶
This method is used to add images to the
images
while also ensuring that theimage_mask
list remains the same size as theimages
list.This method is the only way that a user should add images to a
Camera
object after the object has been initialized. It ensures that theimages
andimage_mask
lists do not get out of sync, ensures that the new images are turned on (their correspondingimage_mask
values are set toTrue
) and also interprets the input in order to create anOpNavImage
for each instance.There are a few different ways you can specify the images to be added to the camera model. The first, and most effective, is to specify a list of strings representing the paths to the files that contain the image information. Similarly, you can specify a single string representing the path to a single image if you only want to add one image. Inputting the image data in this method allows the
OpNavImage
class to retrieve the required metadata for each image, assuming the user has successfully subclassed theOpNavImage
class and set up theparse_data()
method.The next most useful way to enter the image data is by entering either a single, or a list of
OpNavImage
objects. When using this method, the user should be sure that the appropriate metadata has been set for each image.The least useful way to enter the image data is by entering the raw image data either as a numpy array, a list of numpy arrays, or a list of lists of lists. In each of these cases, the data contained in the arrays/inner lists of lists is interpreted directly as the imaging data and no metadata is attached to the created
OpNavImage
object. The user must the be sure to go an enter the correct metadata for each image to ensure functionality is not broken for other GIANT routines.Regardless of how the image data is entered, this method expands the
image_mask
list by the number of images that are being added and turns each of the new images on. In addition, if thepreprocessor
argument is set toTrue
thepreprocessor()
method is called on each image before it is stored in theimages
list.If you are entering the image data as a string or a list of strings then you can optionally turn off the parse_data functionality by setting the
parse_data
keyword argument toFalse
. This is not recommended however.- Parameters:
data (Iterable[Path | str | Sequence[Sequence] | ndarray] | Path | str | Sequence[Sequence] | ndarray) – The image data to be stored in the
images
listparse_data (bool) – A flag to specify whether to attempt to parse the metadata automatically for the images
preprocessor (bool) – A flag to specify whether to run the preprocessor after loading an image.
metadata_only (bool) – A flag to specify to only load the metadata for an image, not the image data itself.