LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python and C++ APIs, a PyQt GUI, and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
120 stars 12 forks source link

centerRow param does not work? #101

Closed hws203 closed 2 months ago

hws203 commented 2 months ago

Even I change the centerRow parameter in leap class , it does not work effectively, I can not see any change in volume center shift. Normally, it make the z-slice center shift in volume image. Please check this point at modular beam mode.

kylechampley commented 2 months ago

What geometry are you using? Note that centerRow is not a modular-beam parameter. For modular-beam data, use the shift_detector function.

winguphehe commented 2 months ago

The column shift is more often. In my case, the centerCol takes No effect. I use the tau parameter to handle column shift instead.

kylechampley commented 2 months ago

It has no effect?! It definitely does have an effect, so it makes me think you are using it incorrectly. Definitely don't use tau instead of centerCol. These are different parameters for different things. Sure, tau can be used to effectively shift the detector, but it also implicitly rotates the detector. Can you send me a sample script to demonstrate your issue?

hws203 commented 2 months ago

My meaning of no work on centerRow is as like below sequence for issue regeneration.

  1. leapct->set_centerCol(leapct->params.centerCol+ offx); 1-1. Leap->params.convert_conebeam_to_modularbeam(); 1-2. then offx works on volume image, and I can see volume image change.

  2. leapct->set_centerRow(leapct->params.centerRow+ offy); 2-1. Leap->params.convert_conebeam_to_modularbeam(); 2-2. then offy does not work on volume image, and I can not see any volume image change.

  3. offx, offy is pixel unit for example 10,10.

winguphehe commented 2 months ago

In my case, tau is OK for cone beam CT.

hws203 commented 2 months ago

Yes, tau is effective now, I reported this tau issue a few days ago. You can see it at closed issue list.

kylechampley commented 2 months ago

@hws203 I believe you are confusing things with the tau parameter. The tau parameter always worked with cone-beam data. The issue was that it was not being accounted for in the convert_to_modularbeam() function. But like you said, you reported this issue and I fixed it.

Below is a script that shows you that centerRow does indeed work. This parameter is less sensitive than centerCol, so to see a significant change in the reconstruction you must make a significant change in the centerRow value.

import sys
import os
import time
import numpy as np
from leapctype import *
leapct = tomographicModels()
leapct.about()

numCols = 512
numAngles = 2*2*int(360*numCols/1024)
pixelSize = 0.65*512/numCols
numRows = numCols

leapct.set_conebeam(numAngles, numRows, numCols, pixelSize, pixelSize, 0.5*(numRows-1), 0.5*(numCols-1), leapct.setAngleArray(numAngles, 360.0), 1100, 1400)
leapct.set_default_volume()

g = leapct.allocate_projections()
f = leapct.allocate_volume()

leapct.set_FORBILD(f,True)
leapct.project(g,f)

leapct_modular = tomographicModels()
leapct_modular.copy_parameters(leapct)
leapct_modular.convert_to_modularbeam()
f_orig = leapct_modular.FBP(g)

# Now shift the centerRow parameter
# Remember that shifting centerRow redefines the location of
# the z=0 plane, so we will also shift the offsetZ parameter
# so that the two volumes will be aligned
leapct_modular.copy_parameters(leapct)
leapct_modular.set_centerRow(leapct_modular.get_centerRow()+10)
leapct_modular.convert_to_modularbeam()
leapct_modular.set_offsetZ(-10.0*leapct_modular.get_voxelHeight())
f_shifted = leapct_modular.FBP(g)

leapct.display(f_orig)
leapct.display(f_shifted)
leapct.display(f_orig-f_shifted)
hws203 commented 2 months ago

Yes, I can assure that centerRow is working at leatct package by checking your above test script. The issue is just too small pixel value(10) of centerRow at my own c++ package, because I used too small pixelheight of detector for ct magnification. I will close this issue. Thanks for your test script.