[Rtk-users] Problem with reconstruction on Python

Джаркинов, Руслан Бекзатович r.dzharkinov at g.nsu.ru
Wed Dec 6 14:11:28 CET 2023


Hello for everyone,

I have some problems with reconstruction of real data. If I use the code
below, then the resulting reconstructions are of very poor quality. It
seems to me that I don't understand something fundamental.

Some info about my data:
I have 7201 projections in .tiff format, angle between projections — 0.05.
Detector pixel size — 85.0 micrometer.
I also already have a reconstruction of this data (1490x1490x1408) from a
different company, but I also want to try to reconstruct and compare the
quality of resulting images.

Here is the basic python code I am trying to use (modified from the
example), if anyone can see what I might be doing wrong I would appreciate
it:

(some code of import modules)
tiffio = itk.TIFFImageIO.New()
ImageType = itk.Image[itk.F,3]

ProjectionsReaderType = rtk.ProjectionsReader[ImageType]
projectionsSource = ProjectionsReaderType.New()
projectionsSource.SetImageIO(tiffio)
projectionsSource.SetFileNames(data_names)
projectionsSource.GetOrigin() # output — itkVectorD3 ([1.79769e+308,
1.79769e+308, 1.79769e+308])
projectionsSource.GetSpacing() # output — itkPointD3 ([1.79769e+308,
1.79769e+308, 1.79769e+308])
geometry = rtk.ThreeDCircularProjectionGeometry.New()

projOffsetX=0.0375
projOffsetY=-27.965
numberOfProjections = 7201
firstAngle = 0.
angularArc = 360.
sid = 17.2 # source to isocenter distance
sdd = 795 # source to detector distance
for x in range(0,numberOfProjections):
angle = firstAngle + x * angularArc / numberOfProjections
geometry.AddProjection(sid,sdd,angle, projOffsetX, projOffsetY)

ConstantImageSourceType = rtk.ConstantImageSource[ImageType]
constantImageSource2 = ConstantImageSourceType.New()
origin = [-0.003677988*(1490-1)/2, -0.003677988*(1490-1)/2, 0]
sizeOutput = [1490, 1490, 1410]
spacing = [ 0.003677988, 0.003677988, 0.003677988] # Image pixel size —
3.677988 micrometers, so I convert to mm
constantImageSource2.SetOrigin(origin)
constantImageSource2.SetSpacing( spacing )
constantImageSource2.SetSize( sizeOutput )
constantImageSource2.SetConstant(0.)

print("Reconstructing...")
FDKCPUType = rtk.FDKConeBeamReconstructionFilter[ImageType]
feldkamp = FDKCPUType.New()
feldkamp.SetInput(0, constantImageSource2.GetOutput())
feldkamp.SetInput(1, projectionsSource.GetOutput())
feldkamp.SetGeometry(geometry)
feldkamp.GetRampFilter().SetTruncationCorrection(0.0)
feldkamp.GetRampFilter().SetHannCutFrequency(0.0)

feldkamp.Update()
output = feldkamp.GetOutput()

print("Writing output image...")
WriterType = rtk.ImageFileWriter[ImageType]
writer = WriterType.New()
writer.SetFileName("rec.tif")
writer.SetInput(feldkamp.GetOutput())
writer.Update()

Regards, Ruslan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20231206/b895ff68/attachment.htm>


More information about the Rtk-users mailing list