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
imageswhile also ensuring that theimage_masklist remains the same size as theimageslist.This method is the only way that a user should add images to a
Cameraobject after the object has been initialized. It ensures that theimagesandimage_masklists do not get out of sync, ensures that the new images are turned on (their correspondingimage_maskvalues are set toTrue) and also interprets the input in order to create anOpNavImagefor 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
OpNavImageclass to retrieve the required metadata for each image, assuming the user has successfully subclassed theOpNavImageclass 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
OpNavImageobjects. 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
OpNavImageobject. 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_masklist by the number of images that are being added and turns each of the new images on. In addition, if thepreprocessorargument is set toTruethepreprocessor()method is called on each image before it is stored in theimageslist.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_datakeyword argument toFalse. This is not recommended however.- Parameters:
data (Iterable[Path | str | ndarray] | Path | str | ndarray) – The image data to be stored in the
imageslistparse_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.
- Return type:
None