CIL icon indicating copy to clipboard operation
CIL copied to clipboard

'CentreOfRotationCorrector.xcorrelation' doesn't seem to work

Open Cosme-liu opened this issue 1 year ago • 4 comments

Description

I try to find the rotation center by using CentreOfRotationCorrector.xcorrelation, but the reconstruction result (original data vs corrected data) seems the same, which still has many crescent-shaped artifacts. It seems that the CentreOfRotationCorrector.xcorrelation doesn't work.

Is there other methods to find or correct the rotation center? For example, in Tomopy, we can use tomopy.find_center() and define the rotation center during reconstrution tomopy.recon(minus_log, angles, center=center, algorithm='gridrec')

Code

proj = TIFFStackReader(file_name=path_input)
ag = AcquisitionGeometry.create_Parallel3D(detector_position=[0,800,0])\
    .set_panel(num_pixels=[622,450])\
    .set_angles(angles=np.linspace(0,180,1080))
pj = proj.read_as_AcquisitionData(ag)

processor = CentreOfRotationCorrector.xcorrelation(slice_index='centre',projection_index=0, ang_tol = 0.1)
processor.set_input(pj) 
pj_centred=processor.get_output()
recon0 = FBP(pj)
recon1 = FBP(pj_centred)
output0 = recon0.run()
output1 = recon1.run()

Reconstruction using origianl data: original

Reconstruction using corrected data: corrected

Cosme-liu avatar Aug 30 '24 13:08 Cosme-liu

Hi @Cosme-liu , thanks for submitting an issue.

The xcorrelation method is trying to correlate between your 0 index projection and another projection 180 degrees apart from that (presumably the last one), so it might be worth checking that the first and last projections are representative of your data. If not you could set projection_index=(1, 1078) to see if it can correlate with a different pair of angles that are close to 180 degrees apart. You might need to increase ang_tol slightly so the difference between the angles you choose is within the tolerance.

Alternatively if you know roughly what the offset is you can set it manually and try several different values of pixel_offset to see if the artefacts are reduced.

pj_centred = pj.copy()
pj_centred.geometry.set_centre_of_rotation(pixel_offset, distance_units='pixels')

hrobarts avatar Aug 30 '24 14:08 hrobarts

Hi @Cosme-liu , thanks for submitting an issue.

The xcorrelation method is trying to correlate between your 0 index projection and another projection 180 degrees apart from that (presumably the last one), so it might be worth checking that the first and last projections are representative of your data. If not you could set projection_index=(1, 1078) to see if it can correlate with a different pair of angles that are close to 180 degrees apart. You might need to increase ang_tol slightly so the difference between the angles you choose is within the tolerance.

Alternatively if you know roughly what the offset is you can set it manually and try several different values of pixel_offset to see if the artefacts are reduced.

pj_centred = pj.copy()
pj_centred.geometry.set_centre_of_rotation(pixel_offset, distance_units='pixels')

Hi @hrobarts , thanks for your advice.

I set projection_index=(0, 1079) and modify ang_tol, but the artefacts still exist. Then, I set the rotation center manually by set_centre_of_rotation(pixel_offset, distance_units='pixels'), and it works!

Cosme-liu avatar Aug 31 '24 07:08 Cosme-liu

Hi @hrobarts, for the pixel_offset in set_centre_of_rotation(pixel_offset, distance_units='pixels'), could it be decimals? Or it must be int? For example, if I set manually pixel_offset = 1.1, is it the same with pixel_offset = 1?

Cosme-liu avatar Sep 02 '24 13:09 Cosme-liu

Hi @Cosme-liu, sorry for the slow reply. It should work fine with decimals so you should see a difference with sub-pixel values

hrobarts avatar Sep 11 '24 08:09 hrobarts