Image processing

Image processing module for manipulating image data, e.g. filtered backprojection, flat field correction and other operations on images.

concert.imageprocessing.center_of_mass(frame)

Calculates the center of mass of the whole frame wheighted by value.

concert.imageprocessing.center_of_points(points)

Find a simplified center of mass withouth point-weighing from a set of points.

concert.imageprocessing.compute_pearson_correlation_coefficient(first, second, dx, dy)

Compute Pearson correlation coefficient. Image second is shifted by dx and dy pixels and the correlation is computed with respect to image first. Both images are cropped with respect to the dx, dy shift in order not to correlate regions overflowing over image edges.

concert.imageprocessing.compute_rotation_axis(first_projection, last_projection)

Compute the tomographic rotation axis based on cross-correlation technique. first_projection is the projection at 0 deg, last_projection is the projection at 180 deg.

concert.imageprocessing.correlate(first, second, first_y=0, second_y=0, overlap_height=None, supersampling=1)

Correlate first and second image, use supersampling for sub-pixel precision. Crop first image vertically to (first_y, first_y + overlap_height) and second to (second_y, second_y + overlap_height).

concert.imageprocessing.filter_low_frequencies(data, fwhm=32.0)

Filter low frequencies in 1D data. fwhm is the FWHM of the gaussian used to filter out low frequencies in real space. The window is then computed as fft(1 - gauss).

concert.imageprocessing.find_needle_tip(image)

Extract needle tip from image.

await concert.imageprocessing.find_needle_tips(producer)

Get sample tips in images from producer.

await concert.imageprocessing.find_sphere_centers(producer, supersampling=1, correlation_threshold=None)

Get sphere centers in images from producer. by finding the image with the largest portion of a sphere inside (the sphere may partially go out of the FOV) and correlate other images with the found one, from which relative shifts are computed and converted to absolute sphere centers. This is done by first computing the center of mass of the best image and then subtracting the respective shifts. Use supersampling for sub-pixel precision and filter out the centers for which the correlation coefficient computed by compute_pearson_correlation_coefficient() is worse than correlation_threshold. The correlation coefficient is computed by shifting an image based on the shift found by correlation and computing the correlation coefficient of such shifted image with respect to the best one.

await concert.imageprocessing.find_sphere_centers_by_mass(producer, border_crossing_ok=True)

Get sphere centers in images from producer by computing their center of mass. The images must be absorption images. If border_crossing_ok is False skip images where sphere goes outside the field of view.

concert.imageprocessing.flat_correct(radio, flat, dark=None)

Flat field correction of a radiograph radio with flat field. If dark field is supplied it is taken into account as well.

concert.imageprocessing.normalize(image, minimum=0.0, maximum=1.0)

Normalize image intensities to start at minimum and end at maximum.

concert.imageprocessing.ramp_filter(width)

Get a 1D ramp filter for filtering sinogram rows.

concert.imageprocessing.segment_convex_object(image)

Extract convex object from image (e.g. needle or sphere). It doesn’t matter if object is brigher or darker than the background (e.g. non flat corrected radiograph on input).