RTKConsortium / RTK

Reconstruction Toolkit
Apache License 2.0
241 stars 142 forks source link

Problem with reconstruction on Python #566

Closed Ruslan1541 closed 8 months ago

Ruslan1541 commented 8 months ago

Hello for everyone,

I have a 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 a 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 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

SimonRit commented 8 months ago

Hi Ruslan, Thanks for your interest. Can you please post your question on the mailing list? GitHub issues are used to track bugs or feature requests. Thanks, Simon

Ruslan1541 commented 8 months ago

Hi, Simon Actually I have already sent a message to rtk-users@public.kitware.com, but I dont know what the status of my question is. Maybe the e-mail address is incorrect? Thank you,

Regards, Ruslan.

SimonRit commented 8 months ago

This mailing list is no longer in use, it's been transferred to my lab CREATIS. Please use rtk-users@openrtk.org which is always redirected to the correct one.