ImageNameSubscriber multiple images behaviour


#1

My question is regarding the way CellProfiler handles multiple images.
From what I see, there is a setting which you can include in your module named: ImageNameSubscriber which can be used to access the images. In order to get the image I do:

self.image_name = cellprofiler.setting.ImageNameSubscriber(...) img = workspace.image_set.get_image(self.image_name.value)

What I am wondering is, when using multiple images, does cellprofiler cycle through all the images, running the module once for each image, giving img different values for each run?
If not, do I have to write a for loop myself to perform actions on all images?

Thank you


#2

(I’m guessing you’re all set based on your pull request, but just to have the question answered for future reference)-

CP modules in almost all cases operate on only one image set at a time; for each image set, when you reach that module the subscriber will take the image from that image set with that Name (as specified in NamesAndTypes) and pass it into your module for further processing. The higher level functions of CP will expect you to have multiple image sets and will handle the looping through every image set, so you don’t need to worry about that inside your module.

Does that make sense?