<div dir="ltr"><div>Hi Ruslan,</div><div>You're calling GetOrigin and GetSpacing before calling projectionsSource.Update() which is meaningless. If the values are still incorrect after calling Update, this is a problem because the geometry heavily relies on this. You need to set the spacing to the correct value (possible using <a href="https://itk.org/Doxygen/html/classitk_1_1ChangeInformationImageFilter.html">ChangeInformationImageFilter</a>). For the origin, it strongly depends on the offsets, whether they are wrt the projection center or corner. In the latter case, you can set it to 0. Is the former case, you need to calculate the offset as -0.5*(size-1)*spacing (in each coordinate).</div><div>You will also want to check if the output of the projectionsSource are line integrals as expected by RTK reconstruction filter. If not, you need to fine a way to convert the raw data to line integrals (e.g. taking the log of the values divided by the value in air).</div><div>Best regards,</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 6, 2023 at 2:33 PM Джаркинов, Руслан Бекзатович <<a href="mailto:r.dzharkinov@g.nsu.ru">r.dzharkinov@g.nsu.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p dir="auto" style="box-sizing:border-box;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;margin-top:0px">Hello for everyone,</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">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.</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">Some info about my data:<br style="box-sizing:border-box">I have 7201 projections in .tiff format, angle between projections — 0.05. Detector pixel size — 85.0 micrometer.<br style="box-sizing:border-box">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.</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">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:</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">(some code of import modules)<br style="box-sizing:border-box">tiffio = itk.TIFFImageIO.New()<br style="box-sizing:border-box">ImageType = itk.Image[itk.F,3]</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">ProjectionsReaderType = rtk.ProjectionsReader[ImageType]<br style="box-sizing:border-box">projectionsSource = ProjectionsReaderType.New()<br style="box-sizing:border-box">projectionsSource.SetImageIO(tiffio)<br style="box-sizing:border-box">projectionsSource.SetFileNames(data_names)<br style="box-sizing:border-box">projectionsSource.GetOrigin() # output — itkVectorD3 ([1.79769e+308, 1.79769e+308, 1.79769e+308])<br style="box-sizing:border-box">projectionsSource.GetSpacing() # output — itkPointD3 ([1.79769e+308, 1.79769e+308, 1.79769e+308])<br style="box-sizing:border-box">geometry = rtk.ThreeDCircularProjectionGeometry.New()</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">projOffsetX=0.0375<br style="box-sizing:border-box">projOffsetY=-27.965<br style="box-sizing:border-box">numberOfProjections = 7201<br style="box-sizing:border-box">firstAngle = 0.<br style="box-sizing:border-box">angularArc = 360.<br style="box-sizing:border-box">sid = 17.2 # source to isocenter distance<br style="box-sizing:border-box">sdd = 795 # source to detector distance<br style="box-sizing:border-box">for x in range(0,numberOfProjections):<br style="box-sizing:border-box">angle = firstAngle + x * angularArc / numberOfProjections<br style="box-sizing:border-box">geometry.AddProjection(sid,sdd,angle, projOffsetX, projOffsetY)</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">ConstantImageSourceType = rtk.ConstantImageSource[ImageType]<br style="box-sizing:border-box">constantImageSource2 = ConstantImageSourceType.New()<br style="box-sizing:border-box">origin = [-0.003677988*(1490-1)/2, -0.003677988*(1490-1)/2, 0]<br style="box-sizing:border-box">sizeOutput = [1490, 1490, 1410]<br style="box-sizing:border-box">spacing = [ 0.003677988, 0.003677988, 0.003677988] # Image pixel size — 3.677988 micrometers, so I convert to mm<br style="box-sizing:border-box">constantImageSource2.SetOrigin(origin)<br style="box-sizing:border-box">constantImageSource2.SetSpacing( spacing )<br style="box-sizing:border-box">constantImageSource2.SetSize( sizeOutput )<br style="box-sizing:border-box">constantImageSource2.SetConstant(0.)</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">print("Reconstructing...")<br style="box-sizing:border-box">FDKCPUType = rtk.FDKConeBeamReconstructionFilter[ImageType]<br style="box-sizing:border-box">feldkamp = FDKCPUType.New()<br style="box-sizing:border-box">feldkamp.SetInput(0, constantImageSource2.GetOutput())<br style="box-sizing:border-box">feldkamp.SetInput(1, projectionsSource.GetOutput())<br style="box-sizing:border-box">feldkamp.SetGeometry(geometry)<br style="box-sizing:border-box">feldkamp.GetRampFilter().SetTruncationCorrection(0.0)<br style="box-sizing:border-box">feldkamp.GetRampFilter().SetHannCutFrequency(0.0)</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">feldkamp.Update()<br style="box-sizing:border-box">output = feldkamp.GetOutput()</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">print("Writing output image...")<br style="box-sizing:border-box">WriterType = rtk.ImageFileWriter[ImageType]<br style="box-sizing:border-box">writer = WriterType.New()<br style="box-sizing:border-box">writer.SetFileName("rec.tif")<br style="box-sizing:border-box">writer.SetInput(feldkamp.GetOutput())<br style="box-sizing:border-box">writer.Update()</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;margin-bottom:0px">Regards, Ruslan</p></div>
_______________________________________________<br>
Rtk-users mailing list<br>
<a href="mailto:rtk-users@openrtk.org" target="_blank">rtk-users@openrtk.org</a><br>
<a href="https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users</a><br>
</blockquote></div>