unravel.image_tools.resample_points module#
Use img_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:#
img_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.image_tools.resample_points.resample_and_convert_points(points_csv_input_path, current_res, target_res, ref_img, thresh=None, upper_thresh=None)[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’.
- 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).
Returns:#
- points_resampled_dfpandas.DataFrame
The resampled points with columns ‘x’, ‘y’, ‘z’, and ‘Region_ID’
- 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.