pyUSID.io.image.ImageTranslator¶
- class pyUSID.io.image.ImageTranslator(*args, **kwargs)[source]¶
Bases:
ArrayTranslator
Translates data from an image file to an HDF5 file
- Return type:
Translator object
Methods
Checks whether the provided file can be read by this translator.
Translates the image in the provided file into a USID HDF5 file
- static is_valid_file(file_path, *args, **kwargs)¶
Checks whether the provided file can be read by this translator.
This basic function compares the file extension against the “extension” keyword argument. If the extension matches, this function returns True
- translate(image_path, h5_path=None, bin_factor=None, interp_func=Resampling.BICUBIC, normalize=False, **image_args)[source]¶
Translates the image in the provided file into a USID HDF5 file
- Parameters:
image_path (str) – Absolute path to folder holding the image files
h5_path (str, optional) – Absolute path to where the HDF5 file should be located. Default is None
bin_factor (uint or array-like of uint, optional) – Down-sampling factor for each dimension. Default is None. If specifying different binning for each dimension, please specify as (height binning, width binning)
interp_func (int, optional.) – Default =
PIL.Image.BICUBIC
for pillow<9.0.0 or PIL.Image.Resampling.BICUBIC for pillow>9.0.0 How the image will be interpolated to provide the down-sampled or binned image. For more information see instructions for the resample argument forPIL.Image.resize()
normalize (boolean, optional. Default = False) – Should the raw image be normalized between the values of 0 and 1
image_args (dict) – Arguments to be passed to read_image. Arguments depend on the type of image.
- Returns:
h5_main – HDF5 Dataset object that contains the flattened images
- Return type: