weaver.transform.tiff ===================== .. py:module:: weaver.transform.tiff Module Contents --------------- .. py:function:: normalize_band(image_band: numpy.ndarray) -> numpy.ndarray Normalize a single band of an image to the range [0, 1]. :param image_band: The image band to normalize. :return: The normalized image band. .. py:class:: Tiff(file_path: str) A class for working with TIFF files, including GeoTIFFs and multi-page TIFFs. :ivar file_path: The file path to the TIFF image. :vartype file_path: str :ivar dataset: The rasterio dataset for GeoTIFFs. :vartype dataset: rasterio.Dataset :ivar is_geotiff: A flag indicating whether the image is a GeoTIFF. :vartype is_geotiff: bool :ivar images: The list of image arrays for multi-page TIFFs. :vartype images: List[np.ndarray] :ivar _images: A copy of the list of image arrays. :vartype _images: List[np.ndarray] :ivar nb_bands: The number of bands in the GeoTIFF. :vartype nb_bands: int :ivar width: The width of the image. :vartype width: int :ivar height: The height of the image. :vartype height: int :ivar bands: A dictionary of band indexes and their data types. :vartype bands: dict :ivar coordinates: The coordinates for the GeoTIFF. :vartype coordinates: Tuple[Tuple[float, float], Tuple[float, float]] :ivar crs: The coordinate reference system for the GeoTIFF. :vartype crs: rasterio.crs.CRS Initialize the Tiff object with the given file path. :param file_path: The file path to the TIFF image. .. py:attribute:: file_path .. py:attribute:: dataset .. py:attribute:: is_geotiff .. py:property:: range :type: range Get the range of valid band indexes for the TIFF file. :return: A range object representing valid band indexes. .. py:method:: get_band(index: int) -> Optional[numpy.ndarray] Retrieve a specific band of the image by index. :param index: The band index to retrieve. :return: The band as a NumPy array, or None if not found. :raises RuntimeError: If the band index is invalid or data cannot be read. .. py:method:: get_images(red_band: int = 1, green_band: int = 2, blue_band: int = 3) -> List[PIL.Image.Image] Retrieve RGB images by combining bands from a GeoTIFF or multi-page TIFF. :param red_band: The band index for the red channel. :param green_band: The band index for the green channel. :param blue_band: The band index for the blue channel. :return: A list of PIL Image objects representing the RGB image(s).