self.transform_images would be a list containing all image names which should be transformed.
In __getitem__ the current image path will be checked against all image names in self.transform_images (the self. is missing in my code snippet).
I’m not sure, how you are creating the image paths, but once you get all the paths, you could use the .index() method on this list or alternatively use a condition to get the image indices.