'CentreOfRotationCorrector.xcorrelation' doesn't seem to work
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:
Reconstruction using corrected data:
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 @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 increaseang_tolslightly 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_offsetto 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!
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?
Hi @Cosme-liu, sorry for the slow reply. It should work fine with decimals so you should see a difference with sub-pixel values