unravel.coordinates.resample_points module#
Use coords_resample_points (resample_points) from UNRAVEL to resample a set of points (coordinates) and optionally convert them to an image, accounting for the number of detections at each voxel.
- Input image types:
.czi, .nii.gz, .ome.tif series, .tif series, .h5, .zarr
- Outputs:
Output image types: .nii.gz, .tif series, .h5, .zarr
A CSV file where each row represents a resampled point corresponding to a detection in the 3D image.
A 3D image where each voxel contains the number of detections at that location.
Usage:#
coords_resample_points -i path/points.csv -ri path/ref_image.nii.gz -cr 3.52 3.52 6 -tr 50 [-co path/resampled_points.csv] [-io path/resampled_image.nii.gz] [-thr 20000 or -uthr 20000] [-v]
- unravel.coordinates.resample_points.resample_and_convert_points(points_csv_input_path, current_res, target_res, ref_img, thresh=None, upper_thresh=None, region_id_col='Region_ID', x_col='x', y_col='y', z_col='z', out_x_col='x_resampled', out_y_col='y_resampled', out_z_col='z_resampled', verbose=False)[source]#
Resample a set of points and optionally convert them to an image.
Parameters:#
- points_csv_input_pathstr
Path to the CSV file containing the points with columns ‘x’, ‘y’, ‘z’, and <region_id_col>.
- current_restuple of floats or float
The current resolution of the points in micrometers, as (x_res, y_res, z_res) or a single float value for isotropic resampling.
- target_restuple of floats or float
The target resolution of the points in micrometers, as (x_res, y_res, z_res) or a single float value for isotropic resampling.
- ref_imgnumpy.ndarray
Reference image for the output image shape and resolution.
- threshfloat, optional
Exclude region IDs below this threshold (e.g., 20000 to obtain left hemisphere data).
- upper_threshfloat, optional
Exclude region IDs above this threshold (e.g., 20000 to obtain right hemisphere data).
- region_id_colstr, optional
The name of the column in the input CSV that contains the region IDs used for filtering. Default is “Region_ID”. Set to None to disable filtering.
- x_col, y_col, z_colstr, optional
Column names for the x, y, z coordinates in the input CSV. Defaults are “x”, “y”, and “z”.
- out_x_col, out_y_col, out_z_colstr, optional
Column names for the resampled x, y, z coordinates in the output CSV. Defaults are “x_resampled”, “y_resampled”, and “z_resampled”.
Returns:#
- points_resampled_dfpandas.DataFrame
The resampled points with columns ‘x’, ‘y’, ‘z’, and <region_id_col> (if present in the input).
- points_resampled_imgnumpy.ndarray or None
The resampled image where each voxel contains the number of detections at that location. Returns None if output_img_path is not provided.