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

issue: cone-beam with truncatedscan #66

Closed ProjX0 closed 5 months ago

ProjX0 commented 5 months ago

Hello, I have discovered a blurring artifact in the image below. The image was reconstructed by cropping only the middle overlapping part (where half weighting is applied) from the half-beam scan data. In other words, the intention is to reconstruct only the symmetric part of the cone-beam in the middle without using leapct.set_offsetScan(True).

image

Below are the details of the geometry and volume parameters I used.


bin_mode = True
# Original dimensions and parameters
numAngles = 753
numRows_orig = 1628
numCols_orig = 1628
pixelSize_orig = 0.098  # mm
p0x = 0    # mm
p0y = 5.11 # mm
half_overlap = 38.139   # mm
start_index = 45

if bin_mode:
    # Binning factor (2x2 binning implies reduction by a factor of 2)
    bin_factor = 2

    # Adjusted dimensions and pixel size for binned mode
    pixelSize = pixelSize_orig * bin_factor  # new pixel size is the original times the binning factor
    numRows = numRows_orig // bin_factor
    numCols = numCols_orig // bin_factor

    # Recalculate centers based on new dimensions and pixel size
    centerCol = p0x / pixelSize
    centerRow = (numRows - 1) - (p0y / pixelSize)
    numCols_to_crop = int((half_overlap * 2) / pixelSize / bin_factor)
else:
    # No binning: use original parameters
    pixelSize = pixelSize_orig
    numRows = numRows_orig
    numCols = numCols_orig

    # Calculate center using original dimensions and pixel size
    centerCol = p0x / pixelSize
    centerRow = (numRows - 1) - (p0y / pixelSize)
    numCols_to_crop = int((half_overlap * 2) / pixelSize)

# Set the scanner geometry
leapct.set_conebeam(numAngles-start_index, numRows, numCols_to_crop, pixelSize, pixelSize, centerRow, centerCol, leapct.setAngleArray(numAngles-start_index, -360.0), 410, 660)
# Set LEAP CT volume parameters
leapct.set_default_volume()
leapct.set_volume(750, 750, 450, 0.2, 0.2, 0.0, 0.0, leapct.get_offsetZ())
leapct.set_diameterFOV(leapct.get_voxelWidth()*leapct.get_numX())
leapct.set_truncatedScan(True)
leapct.print_parameters()
ProjX0 commented 5 months ago

I have sent the projection data and the full code to your email. I would appreciate it if you could check them. Thank you.

ProjX0 commented 5 months ago

For reference, I have confirmed that the reconstruction works well without cropping. image

kylechampley commented 5 months ago

I am currently on travel, so I can't try out the script you sent me, but I do have a few comments about this. First of all, are you sure, the centerCol parameter is set correctly? One thing I recommend is to use leapct.crop_cols(...) command. This command can be used to crop and data, and in addition, it will update the centerCol parameter. This will help ensure that when you crop the data, everything gets updated correctly.

Secondly, in general, this approach will not work. Strictly speaking, CT requires non-truncated projections. When one uses the leapct.set_truncatedScan(True), it mitigates the edge artifacts, but these reconstructions are not quantitatively accurate (there are low frequency errors) and the accuracy degrades with more and more truncation. If one wishes to do a region of interest reconstruction, they have to prep the data by applying the Ziegler method.

The Ziegler method is used and discussed in a new demo script: d34_iterative_reconstruction_long_object.py

ProjX0 commented 5 months ago

Thank you for your insightful feedback.

I appreciate your suggestions about the 'centercol' parameter. I realized that it might not have been set correctly. Following your recommendation, I used the 'leapct.cropCols()' command to crop the data. This not only helped in cropping the data accurately but also ensured that the 'centercol'parameter was updated correctly.

Additionally, I understand your point about the limitations of the current approach with truncated projections in CT. As you mentioned, while the leapct.set_truncatedScan(True) command can mitigate edge artifacts, it doesn't ensure quantitatively accurate reconstructions, especially with increasing truncation. To address this issue, I will apply the Ziegler method for region of interest reconstruction, as detailed in the demo script d34_iterative_reconstruction_long_object.py. I believe this method will significantly improve the accuracy of the reconstructions.

Thank you again for your valuable advice. you can close this issue.