ctrappy.image

This module contains the Image class for opening a C-trap scan image.

class ctrappy.image.Image(name, lumicks_scan, metadata=None, df_force_distance=None)

C-trap scan image object. Initialization converts scan data to shape (frames, y, x, channels), also for single frame scans.

Parameters:
  • name (int or str) – Blob name; should be int or str(int).

  • lumicks_scan (lumicks.pylake scan object) – Scan data.

  • metadata (dict) – Scan metadata. Default: None

  • df_force_distance (pandas DataFrame) – Force/distance data during the scan. Default: None

apply_offset_mask(offset_values)

Apply offset mask to self.data, getting rid of any bead data to prevent spot detection on the beads.

export(file_tiff, file_metadata, file_fddata)

Export image data to tiff, metadata to yaml and force-distance data to csv.

export_video(output_path, display_max)

Export scan as .avi video.

frame(frame, colors=None)

Return a single frame.

Parameters:
  • frame (int) – Frame number.

  • colors (list of 3 bools or None) – For each color (r, g, b), apply a mask. If None, use all colors.

Returns:

frame_data – Frame data.

Return type:

numpy array with shape (y_size_fig, x_size_fig, 3)

plot(frame, display_max)

Plot frame.

to_tiff(filename, resolution=(200000.0, 200000.0, 'CENTIMETER'))

Save to tiff.

ctrappy.image.get_spots(data, thresholds, radius, offset_values=None, frame=None, colors=None, remove_edge_spots=False)

Detect spots in the image, given user input values for detection thresholds, radius and image offsets.

ctrappy.image.track_spots(df_spots, frame_skip, spot_dist)

Track spots in df_spots dataframe, given user input values for max frame skip and max spot distance.