(self, item: int)
return img
obtain the image (read and transform)
        Args:
            item: index for the required image
        Returns: img => image array
obtain the image (read and transform)
        Args:
            item: index for the required image
        Returns: img => image array
obtain the image ( read and transform ) Args : item : index for the required image Returns : img = > image array
def __getitem__(self, item: int) -> Tensor:
        """
        obtain the image (read and transform)
        Args:
            item: index for the required image
        Returns: img => image array
        """
        # read the image:
        image = self.files[item]
        if image.name.endswith(".npy"):
            img = np.load(str(image))
            img = Image.fromarray(img.squeeze(0).transpose(1, 2, 0))
        else:
            img = Image.open(image)

        # apply the transforms on the image
        if self.transform is not None:
            img = self.transform(img)

        # bring the image in the required range
        img = adjust_dynamic_range(
            img, drange_in=self.input_data_range, drange_out=self.output_data_range
        )

        return img
def __getitem__ ( self , item : int ) -> Tensor : # read the image: image = self . files [ item ] if image . name . endswith ( ".npy" ) : img = np . load ( str ( image ) ) img = Image . fromarray ( img . squeeze ( 0 ) . transpose ( 1 , 2 , 0 ) ) else : img = Image . open ( image ) # apply the transforms on the image if self . transform is not None : img = self . transform ( img ) # bring the image in the required range img = adjust_dynamic_range ( img , drange_in = self . input_data_range , drange_out = self . output_data_range ) return img