Export scripts
Batch Image Export
This script takes a number of images and saves individual image planes in a zip file for download.
- Batch_Image_Export.compress(target, base)
Creates a ZIP recursively from a given base directory.
- Parameters
target – Name of the zip file we want to write e.g. “folder.zip”
base – Name of folder that we want to zip up E.g. “folder”
- Batch_Image_Export.log(text)
Adds the text to a list of logs. Compiled into text file at the end.
- Batch_Image_Export.make_image_name(original_name, c_name, z_range, t, extension, folder_name)
Produces the name for the saved image. E.g. imported/myImage.dv -> myImage_DAPI_z13_t01.png
- Batch_Image_Export.run_script()
The main entry point of the script, as called by the client via the scripting service, passing the required parameters.
- Batch_Image_Export.save_as_ome_tiff(conn, image, folder_name=None)
Saves the image as an ome.tif in the specified folder
- Batch_Image_Export.save_plane(image, format, c_name, z_range, project_z, t=0, channel=None, greyscale=False, zoom_percent=None, folder_name=None)
Renders and saves an image to disk.
- Parameters
image – The image to render
format – The format to save as
c_name – The name to use
z_range – Tuple of (zIndex,) OR (zStart, zStop) for projection
t – T index
channel – Active channel index. If None, use current rendering settings
greyscale – If true, all visible channels will begreyscale
zoom_percent – Resize image by this percent if specified
folder_name – Indicate where to save the plane
- Batch_Image_Export.save_planes_for_image(conn, image, size_c, split_cs, merged_cs, channel_names=None, z_range=None, t_range=None, greyscale=False, zoom_percent=None, project_z=False, format='PNG', folder_name=None)
Saves all the required planes for a single image, either as individual planes or projection.
- Parameters
renderingEngine – Rendering Engine, NOT initialised.
queryService – OMERO query service
imageId – Image ID
zRange – Tuple: (zStart, zStop). If None, use default Zindex
tRange – Tuple: (tStart, tStop). If None, use default Tindex
greyscale – If true, all visible channels will be greyscale
zoomPercent – Resize image by this percent if specified.
projectZ – If true, project over Z range.
Batch ROI Export
This script exports ROI intensities for selected images.
- Batch_ROI_Export.add_shape_coords(shape, row_data, pixel_size_x, pixel_size_y, include_points=True)
Add shape coordinates and length or area to the row_data dict.
- Batch_ROI_Export.batch_roi_export(conn, script_params)
Main entry point. Get images, process them and return result.
- Batch_ROI_Export.get_export_data(conn, script_params, image, units=None)
Get pixel data for shapes on image and returns list of dicts.
- Batch_ROI_Export.link_annotation(objects, file_ann)
Link the File Annotation to each object.
- Batch_ROI_Export.log(data)
Handle logging or printing in one place.
- Batch_ROI_Export.run_script()
The main entry point of the script, as called by the client.