<div dir="ltr"><div>Hi,</div><div>You should use SetTruncationCorrection:</div><div><a href="http://www.openrtk.org/Doxygen/classrtk_1_1FFTProjectionsConvolutionImageFilter.html#a4115316de11dee455c74ceb96ce40426">http://www.openrtk.org/Doxygen/classrtk_1_1FFTProjectionsConvolutionImageFilter.html#a4115316de11dee455c74ceb96ce40426</a></div><div>ZeroPadFactors only set the amount of zero padding in both directions.<br></div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 6, 2021 at 7:53 PM Benjamin W. Maloney <<a href="mailto:Benjamin.W.Maloney.TH@dartmouth.edu">Benjamin.W.Maloney.TH@dartmouth.edu</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">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Simon,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks. This is almost certainly what the issue is</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
It's not obvious to me how to do this in C++</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I tried:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
feldkamp->GetRampFilter()->SetZeroPadFactors(1);</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
and</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt">feldkamp->GetRampFilter()->SetZeroPadFactors(2);</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt">but neither seemed to make a difference.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt">I didn't see any other pad functions though</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt">Thanks!</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="margin:0px;font-size:12pt">Ben</span></div>
<div id="gmail-m_-4416174480571049850appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-4416174480571049850divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>><br>
<b>Sent:</b> Friday, April 2, 2021 4:51 PM<br>
<b>To:</b> Benjamin W. Maloney <<a href="mailto:Benjamin.W.Maloney.TH@dartmouth.edu" target="_blank">Benjamin.W.Maloney.TH@dartmouth.edu</a>><br>
<b>Cc:</b> <a href="mailto:rtk-users@public.kitware.com" target="_blank">rtk-users@public.kitware.com</a> <<a href="mailto:rtk-users@public.kitware.com" target="_blank">rtk-users@public.kitware.com</a>><br>
<b>Subject:</b> Re: [Rtk-users] Ring artifact even with homogenous valued projection</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi,</div>
<div>If you pass homogeneous non-zero images, you expect such a ring artefact. The reason is that FDK assumes non-truncated projections, i.e., the projections should be 0 at the border. If not, then the ramp filtering will make a transition from the value to
 0.</div>
<div>Probably, your projections are non-zero on the borders either. This can be because they have not been calibrated to line integrals by taking the log of the flat field divided by the measure, because they have not been well calibrated or because they are
 truncated (detector too small for the object). You can then mitigate the effect by padding with data, see the --pad option in rtkfdk.</div>
<div>Simon<br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Fri, Apr 2, 2021 at 7:35 PM Benjamin W. Maloney <<a href="mailto:Benjamin.W.Maloney.TH@dartmouth.edu" target="_blank">Benjamin.W.Maloney.TH@dartmouth.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi all,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I'm running into an issue where I'm getting a large ring artifact at the edge of my reconstructions. It is in the same place regardless of the input images (including homogeneous images), so it is something I'm doing wrong on the reconstruction side rather
 than a defective pixel on the detector.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I'm happy to share my input images and output reconstructions if that helps</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Relevant code:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
using GeometryType = rtk::ThreeDCircularProjectionGeometry;
<div>GeometryType::Pointer geometry = GeometryType::New();</div>
<div>unsigned int          numberOfProjections = (steps_taken+1);</div>
<div></div>
<div>float firstAngle = 0.;</div>
<div>float angularArc = 360.132;</div>
<div><br>
</div>
<div>const double sid = 306.6; // source to isocenter distance, 306.6mm, 0.3 pixel size, image binned by 4 in x and y</div>
<div>const double sdd = 561.3; // 561.3 source to detector distance</div>
<div><br>
</div>
<div>const double offsetX_d = 0.;</div>
<div>const double offsetY_d = 0.;</div>
<div>const double outOfPlaneAngle = -2.55;</div>
<div>const double inPlaneAngle = 0.0;</div>
<div>const double offsetX_s = 0.;</div>
<div>const double offsetY_s = 0.;</div>
<div><br>
</div>
<div><br>
</div>
<div>for (unsigned int noProj = 0; noProj < numberOfProjections; noProj++)</div>
<div>{</div>
<div>double angle = 205 + ((double)noProj * ((double)angularArc / ((double)steps_taken + 1))); //Adjust the first number (23 before +) to rotate output of reconstruction</div>
<div><br>
</div>
<div>geometry->AddProjection(sid, sdd, angle, offsetX_d, offsetY_d, outOfPlaneAngle, inPlaneAngle, offsetX_s, offsetY_s);</div>
<div>}</div>
<div><br>
</div>
<div>// Write the geometry to disk</div>
<div>rtk::ThreeDCircularProjectionGeometryXMLFileWriter::Pointer xmlWriter;</div>
<div>xmlWriter = rtk::ThreeDCircularProjectionGeometryXMLFileWriter::New();</div>
<div>xmlWriter->SetFilename("..\\..\\..\\data\\geometry_newSystem_full.xml");</div>
<div>xmlWriter->SetObject(geometry);</div>
<div>xmlWriter->WriteFile();</div>
<div></div>
<div>// Defines the image type</div>
<div>using ImageType = itk::CudaImage< float, 3 >;</div>
<div></div>
<div>// Projection Images</div>
<div><br>
</div>
<div>using ConstantImageSourceType = rtk::ConstantImageSource< ImageType >;</div>
<div>ConstantImageSourceType::PointType   origin;</div>
<div>ConstantImageSourceType::SpacingType spacing;</div>
<div>ConstantImageSourceType::SizeType    sizeOutput;</div>
<div><br>
</div>
<div>int size_x = 3072 / binn;</div>
<div>int size_y = 864 / binn;</div>
<div>int size_z = numberOfProjections;</div>
<div><br>
</div>
<div>//Binned x4</div>
<div>origin[0] = -0.5 * (size_x - 1) * 0.3/4.*binn;</div>
<div>origin[1] = -0.5 * (size_y - 1) * 0.3/4.*binn;</div>
<div>origin[2] = 0.;</div>
<div><br>
</div>
<div>sizeOutput[0] = size_x;</div>
<div>sizeOutput[1] = size_y;</div>
<div>sizeOutput[2] = numberOfProjections;</div>
<div><br>
</div>
<div>spacing.Fill(0.3/4.*binn);</div>
<div><br>
</div>
<div>// Load in my data</div>
<div>typedef float                              PixelType;</div>
<div>const unsigned char                        Dimension = 3;</div>
<div>typedef itk::CudaImage< PixelType, Dimension > ImageType;</div>
<div>ImageType::Pointer                         image;</div>
<div><br>
</div>
<div>typedef itk::ImageFileReader< ImageType > ReaderType;</div>
<div>ReaderType::Pointer                       reader;</div>
<div>reader = ReaderType::New();</div>
<div><br>
</div>
<div>reader->SetFileName(projection_file_r); // bin x4</div>
<div>reader->Update();</div>
<div>reader->GetOutput()->SetOrigin(origin);</div>
<div>reader->GetOutput()->SetSpacing(spacing);</div>
<div><br>
</div>
<div>// Create reconstructed image</div>
<div>ConstantImageSourceType::Pointer constantImageSource2 = ConstantImageSourceType::New();</div>
<div><br>
</div>
<div>// x4</div>
<div>sizeOutput.Fill(size_x);</div>
<div>sizeOutput[1] = size_y;</div>
<div>origin.Fill(-0.5 * (size_x - 1) * 0.3/4.*binn*sid / sdd);</div>
<div>origin[1] = (-0.5 * (size_y - 1) * 0.3/4.*binn*sid / sdd);</div>
<div><br>
</div>
<div>spacing.Fill(0.3/4.*binn*sid / sdd);</div>
<div>constantImageSource2->SetOrigin(origin);</div>
<div>constantImageSource2->SetSpacing(spacing);</div>
<div>constantImageSource2->SetSize(sizeOutput);</div>
<div>constantImageSource2->SetConstant(0.);</div>
<div><br>
</div>
<div>// FDK reconstruction</div>
<div>//GPU</div>
<div>using FDKGPUType = rtk::CudaFDKConeBeamReconstructionFilter;</div>
<div>FDKGPUType::Pointer feldkamp = FDKGPUType::New();</div>
<div><br>
</div>
<div>feldkamp->SetInput(0, constantImageSource2->GetOutput());</div>
<div>feldkamp->SetInput(1, reader->GetOutput());</div>
<div>feldkamp->SetGeometry(geometry);</div>
<div><br>
</div>
<div><br>
</div>
<div>using WriterType = itk::ImageFileWriter< ImageType >;</div>
<div>WriterType::Pointer writer = WriterType::New();</div>
<div><br>
</div>
<div>writer->SetFileName(reconstruction_file_w);</div>
<div><br>
</div>
<div>writer->SetInput(feldkamp->GetOutput());</div>
writer->Update();<br>
</div>
<div>
<div id="gmail-m_-4416174480571049850x_gmail-m_4752658608175596641Signature">
<div></div>
</div>
</div>
</div>
_______________________________________________<br>
Rtk-users mailing list<br>
<a href="mailto:Rtk-users@public.kitware.com" target="_blank">Rtk-users@public.kitware.com</a><br>
<a href="https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Frtk-users&data=04%7C01%7CBenjamin.W.Maloney.TH%40dartmouth.edu%7C4d50d70e01ba4520ce5808d8f6192adf%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C637529935259373895%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pq9c3k0Rh60WeSzEvtwqmsOnAL3MFmUGv1yZvz560lo%3D&reserved=0" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/rtk-users</a><br>
</blockquote>
</div>
</div>
</div>

</blockquote></div>