megafish.seqfish module
- dog_sds(NA, wavelength, pitch, psf_size_factor=1, dog_sd_factor=1)[source]
Calculates the standard deviations for the Difference of Gaussians (DoG) based on the point spread function (PSF) and imaging parameters.
- Parameters:
NA (float) – Numerical aperture of the imaging system.
wavelength (float) – Wavelength of the fluorescence (in the same units as pitch).
pitch (float) – Pixel size or sampling interval (in the same units as wavelength).
psf_size_factor (float, optional) – Factor to scale the PSF size; defaults to 1.
dog_sd_factor (float, optional) – Factor to scale the second standard deviation for the DoG; defaults to 1.
- Returns:
A tuple containing the two standard deviations (dog_sd1, dog_sd2) for the DoG filter.
- Return type:
- DoG_filter(zarr_path, group_name, dog_sd1, dog_sd2, axes, mask_radius=None, footer='_dog')[source]
Applies a Difference of Gaussians (DoG) filter to the image data in a Zarr file.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group_name (str) – Group name in the Zarr file where the image data is stored.
dog_sd1 (float) – The first standard deviation for the DoG filter.
dog_sd2 (float) – The second standard deviation for the DoG filter.
axes (list of int) – List of axes along which the filter will be applied.
mask_radius (int, optional) – Radius for binary dilation mask to exclude specific regions; defaults to None.
footer (str, optional) – Footer string to append to the output group name; defaults to “_dog”.
- Returns:
This function saves the filtered data as a new group in the Zarr file.
- Return type:
None
- local_maxima_footprint(NA, wavelength_um, pitch_um)[source]
Calculates the footprint for detecting local maxima based on the point spread function (PSF) and imaging parameters.
- Parameters:
- Returns:
A binary footprint (structuring element) for local maxima detection.
- Return type:
- local_maxima(zarr_path, group_name, footprint, axes, footer='_lmx')[source]
Detects local maxima in the image data within a Zarr file using a specified footprint.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group_name (str) – Group name in the Zarr file where the image data is stored.
footprint (numpy.ndarray) – The structuring element used for detecting local maxima.
axes (list of int) – List of axes along which the footprint will be expanded.
footer (str, optional) – Footer string to append to the output group name; defaults to “_lmx”.
- Returns:
This function saves the detected local maxima as a new group in the Zarr file.
- Return type:
None
- select_by_intensity_sd(zarr_path, group, sd_factor=0, footer='_isd')[source]
Selects spots in the image data based on intensity, using a threshold defined by the mean intensity and standard deviation.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group (str) – Group name in the Zarr file where the image data is stored.
sd_factor (float, optional) – Factor to multiply the standard deviation for the threshold; defaults to 0.
footer (str, optional) – Footer string to append to the output group name; defaults to “_isd”.
- Returns:
This function saves the filtered data as a new group in the Zarr file.
- Return type:
None
- select_by_intensity_threshold(zarr_path, group, threshold=0, footer='_ith')[source]
Selects spots in the image data based on a specified intensity threshold.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group (str) – Group name in the Zarr file where the image data is stored.
threshold (float, optional) – Intensity threshold for selecting spots; defaults to 0.
footer (str, optional) – Footer string to append to the output group name; defaults to “_ith”.
- Returns:
This function saves the filtered data as a new group in the Zarr file.
- Return type:
None
- count_spots(zarr_path, group_spot, group_label, footer='_cnt', delete_chunk_csv=True)[source]
Counts spots within labeled segments in the image data stored in a Zarr file and saves the results as CSV files.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group_spot (str) – Group name for the spot data in the Zarr file.
group_label (str) – Group name for the label data in the Zarr file.
footer (str, optional) – Footer string to append to the output CSV group name; defaults to “_cnt”.
delete_chunk_csv (bool, optional) – Whether to delete temporary chunk CSV files after merging; defaults to True.
- Returns:
This function saves the spot counts as CSV files in the csv directory.
- Return type:
None
- count_summary(zarr_path, groups, group_seg, group_out, channels, genename_path=None)[source]
Summarizes spot counts across multiple groups and cycles, merging the results with segment data and optionally gene names.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
groups (list of str) – List of group names in the Zarr file for which spot counts are available.
group_seg (str) – Group name for the segment data.
group_out (str) – Output group name for saving the summary CSV.
channels (list of int) – List of channels corresponding to each group.
genename_path (str, optional) – Path to a CSV file containing gene names for each channel; defaults to None.
- Returns:
This function saves the summarized data as a CSV file.
- Return type:
None
- spot_coordinates(zarr_path, group, footer='_scd')[source]
Extracts coordinates of spots from the image data stored in a Zarr file and saves them as CSV files.
- Parameters:
- Returns:
This function saves the spot coordinates as CSV files.
- Return type:
None
- spot_intensity(zarr_path, group_spt, group_seg, group_int, footer='_sit')[source]
Computes the intensity of spots within segmented regions for each chunk of the image data and saves the results as CSV files.
- Parameters:
zarr_path (str) – Path to the Zarr file containing the image data.
group_spt (str) – Group name for the spot data in the Zarr file.
group_seg (str) – Group name for the segmentation data in the Zarr file.
group_int (str) – Group name for the intensity data in the Zarr file.
footer (str, optional) – Footer string to append to the output CSV group name; defaults to “_sit”.
- Returns:
This function saves the spot intensity data as CSV files.
- Return type:
None