Utility scripts

Channel Offsets

This script creates new images from existing images, applying x, y, and z shifts to each channel independently, as specified in the parameters.

Channel_Offsets.new_image_with_channel_offsets(conn, image_id, channel_offsets, dataset=None)

Process a single image here: creating a new image and passing planes from original image to new image - applying offsets to each channel as we go.

Parameters
  • image_id – Original image

  • channel_offsets – List of map for each channel {‘index’:index, ‘x’:x, ‘y’y, ‘z’:z}

Channel_Offsets.process_images(conn, script_params)

Process the script params to make a list of channel_offsets, then iterate through the images creating a new image from each with the specified channel offsets

Combine Images

This script takes a number of images (or Z-stacks) and merges them to create additional C, T, Z dimensions.

Combine_Images.get_plane(raw_pixel_store, pixels, the_z, the_c, the_t)

This method downloads the specified plane of the OMERO image and returns it as a numpy array.

Parameters
  • session – The OMERO session

  • imageId – The ID of the image to download

  • pixels – The pixels object, with pixelsType

  • imageName – The name of the image to write. If no path, saved in the current directory.

Combine_Images.make_single_image(services, parameter_map, image_ids, dataset, colour_map)

This takes the images specified by image_ids, sorts them in to Z,C,T dimensions according to parameters in the parameter_map, assembles them into a new Image, which is saved in dataset.

Combine_Images.pick_pixel_sizes(pixel_sizes)

Process a list of pixel sizes and pick sizes to set for new image. If we have different sizes from different images, return None

Combine_Images.run_script()

The main entry point of the script, as called by the client via the scripting service, passing the required parameters.

Dataset To Plate

This script converts a Dataset of Images to a Plate, with one image per Well.

Dataset_To_Plate.add_images_to_plate(conn, images, plate_id, column, row, remove_from=None)

Add the Images to a Plate, creating a new well at the specified column and row NB - This will fail if there is already a well at that point

Dataset_To_Plate.run_script()

The main entry point of the script, as called by the client via the scripting service, passing the required parameters.

Images From ROIs

This script gets all the Rectangles from a particular image, then creates new images with the regions within the ROIs, and saves them back to the server.

Images_From_ROIs.get_rectangles(conn, image_id)

Returns a list of (x, y, width, height, zStart, zStop, tStart, tStop) of each rectange ROI in the image

Images_From_ROIs.make_images_from_rois(conn, parameter_map)

Processes the list of Image_IDs, either making a new image-stack or a new dataset from each image, with new image planes coming from the regions in Rectangular ROIs on the parent images.

Images_From_ROIs.process_image(conn, image_id, parameter_map)

Process an image. If imageStack is True, we make a Z-stack using one tile from each ROI (c=0) Otherwise, we create a 5D image representing the ROI “cropping” the original image Image is put in a dataset if specified.

Images_From_ROIs.run_script()

The main entry point of the script, as called by the client via the scripting service, passing the required parameters.

Move Annotations

Moves Annotations from Images to their parent Wells.

Move_Annotations.log(text)

Handle logging statements in a single place.

Move_Annotations.move_annotations(conn, script_params)

Process script parameters and move annotations as specified.

Move_Annotations.move_well_annotations(conn, well, ann_type, remove_anns, ns)

Move annotations from Images in this Well onto the Well itself.

Move_Annotations.run_script()

The main entry point of the script.