Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CentreOfRotationCorrector.xcorrelation' doesn't seem to work #1922

Open
Cosme-liu opened this issue Aug 30, 2024 · 4 comments
Open

'CentreOfRotationCorrector.xcorrelation' doesn't seem to work #1922

Cosme-liu opened this issue Aug 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Cosme-liu
Copy link

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 Cosme-liu added the bug Something isn't working label Aug 30, 2024
@hrobarts
Copy link
Contributor

hrobarts commented Aug 30, 2024

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')

@Cosme-liu
Copy link
Author

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
Copy link
Author

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?

@hrobarts
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants