docstr: Set up omero image providers inside the image_set_list
docstr_tok: ["Set","up","omero","image","providers","inside","the","image_set_list"]
code: def prepare_run(self, workspace):
      """Set up omero image providers inside the image_set_list"""
      pipeline = workspace.pipeline
      image_set_list = workspace.image_set_list
      if pipeline.in_batch_mode():
          # TODO: Rewrite the OmeroImageProvider such that it can be used in batch mode
          # e.g., omero session keys could be used to attach to existing sessions to
          # keep OmeroImageProviders from creating a new session every time an image should be loaded
          return False
  
      if cpp.get_headless():
          print(
              "OmeroLoadImages running in headless mode: image directory parameter will be used as omero object id"
          )
          self.omero_object_id.set_value(
              int(cpp.get_default_image_directory())
          )
          print("omero object id = %d" % self.omero_object_id.value)
          print("omero object type = %s" % self.omero_object.value)
  
      self.create_omero_gateway()
      if self.omero_object == MS_IMAGE:
          omero_image_list = [
              self.omero_gateway.getImage(self.omero_object_id.value)
          ]
      elif self.omero_object == MS_DATASET:
          # Get dataset without leaves(=images&pixels)
          dataset = self.omero_gateway.getDataset(
              self.omero_object_id.value, False
          )
          self.dataset_name = dataset.getName().getValue()
          omero_image_list = self.get_images_from_dataset(
              self.omero_object_id.value
          )
      elif self.omero_object == MS_PLATE:
          self.wells = self.get_wells_from_plate(
              self.omero_object_id.value
          )
          self.plate_name = (
              self.wells[0].getPlate().getName().getValue()
          )
          omero_image_list = []
          for well in self.wells:
              for wellsample in well.iterateWellSamples():
                  omero_image_list.append(wellsample.getImage())
  
      # get names and pixels from omero images
      pixels_list = []
      for omero_image in omero_image_list:
          image_id = omero_image.getId().getValue()
          pixels_list += self.omero_gateway.getPixelsFromImage(image_id)
  
      # add images to image sets
      image_set_count = len(pixels_list)
      for i in range(0, image_set_count):
          image_set = image_set_list.get_image_set(i)
          pixels = pixels_list[i]
          pixels_id = pixels.getId().getValue()
          sizeZ = pixels.getSizeZ().getValue()
          sizeC = pixels.getSizeC().getValue()
          sizeT = pixels.getSizeT().getValue()
          for channel in self.channels:
              for z in range(0, sizeZ):
                  for t in range(0, sizeT):
                      c = int(channel.channel_number.value)
                      self.save_image_set_info(
                          image_set,
                          channel.cpimage_name.value,
                          P_OMERO,
                          V_OMERO,
                          self.omero_gateway,
                          pixels_id,
                          z,
                          c,
                          t,
                      )
      return True
  
imports: import traceback
  import numpy
  import wx
  import cellprofiler_core.image
  import cellprofiler_core.module
  import cellprofiler_core.measurement
  import cellprofiler_core.preferences
  import cellprofiler_core.setting
  from cellprofiler_core.modules import default_cpimage_name
  import omero
  from omero.rtypes import rlong
  from omero.rtypes import rint
  from omero_version import omero_version
label_desc: Use image node_id 10 for calling the OmeroLoadImages obj's underlying member method code with example usage: obj.prepare_run(workspace) and returns: True, False