This library introduces Differentiable Forward Projection (FPJ) and Filtered Back Projection (FBP) in PyTorch to enable dual-domain deep learning and optimization.
Now support:
- equidistant fan-beam
- geometric calibration
-
Check the prerequisites
- torch-mando only works on Linux.
- Prepare CUDA compiler nvcc, PyTorch, and GCC compiler.
-
Clone the repository
git clone [email protected]:CandleHouse/torch-mando.git --depth 1 cd torch-mando
-
Install by running
python setup.py install
Now support the following "parameter.jsonc" files to reduce the influence of geometry on the final results:
- PMatrixFile
- SIDFile
- SDDFile
- ScanAngleFile
- DetectorOffcenterFile
cfg = MandoFanBeamConfig(...)
# add params file
cfg.addPmatrixFile(readParamsFile('./params/pmatrix_file.jsonc'), pmatrixDetEltSize=0.4)
cfg.addSIDFile(readParamsFile('./params/sid_file.jsonc'))
cfg.addSDDFile(readParamsFile('./params/sdd_file.jsonc'))
cfg.addScanAngleFile(readParamsFile('./params/scan_angle.jsonc'))
cfg.addDetectorOffCenterFile(readParamsFile('./params/offcenter_file.jsonc'))
The main idea is to assemble a Config
object which includes all necessary settings to perform FPJ and FBP, and pass it to MandoFanbeamFpj
/ MandoFanbeamFbp
along with the image / sinogram.
cfg = MandoFanBeamConfig(imgDim=imgDim, pixelSize=imgPixelSize, sid=750, sdd=1250, detEltCount=detEleCount,
detEltSize=detEleSize, views=views, reconKernelEnum=KERNEL_RAMP, reconKernelParam=1, fovCrop=False)
# In your network
# If you prefer nn.functional F style
def forward(self, x):
x = MandoFanbeamFbp(x, cfg)
# If you prefer nn.Module layer style
def __init__(self) -> None:
self.fbpLayer = MandoFanbeamFbpLayer(cfg)
def forward(self, x):
x = self.fbpLayer(x)
View example for code details.
This work highly depends on previous works by ustcfdm/mangoct, njjixu/mangoct, SEU-CT-Recon/mandoct and matteo-ronchetti/torch-radon. This work draws lots of lessons from them. Thanks for their wonderful work.
Please use the following BibTex to cite this work, or click Cite this repository on the right.
@software{torch_mando,
author = {SEU-CT-Recon},
license = {MIT},
title = {torch-mando: Differentiable Domain Transform in PyTorch based on MandoCT},
url = {https://github.com/SEU-CT-Recon/torch-mando}
}
MIT