<div dir="ltr"><div>Can you provide the size, origin and spacing of reader->GetOutput()? It's a bit hard to help you without this information.</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 12, 2023 at 11:01 AM 何明哲 <<a href="mailto:m10512067@yuntech.org.tw">m10512067@yuntech.org.tw</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"><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>Dear Simon </div><div><br></div><div>Thanks for your reply .Its great help for me! </div><div><br></div><div>1.)I was refer your suggestion and modified the code, </div><div>but the result will be a large blank area and I don't understand why <br></div><div><br></div><div>here is the code and result </div><div><br></div><div>sizeOutput[0] = Imagewidth;<br> sizeOutput[1] = 1;<br> sizeOutput[2] = numberOfProjections; <br> spacing[0] = 0.25;<br> spacing[1] = 0.25;<br> spacing[2] = 0.25;<br> origin[0] = (Imagewidth-1)*0.5*spacing[0]; <br> origin[1] = (Imageheigh-1)*0.5*spacing[1]; <br> origin[2] = spacing[2]*SliceN*-1; <br><br> recoVolume->SetSize(sizeOutput);<br> recoVolume->SetSpacing(spacing);<br> recoVolume->SetOrigin(origin);<br> recoVolume->SetConstant(0.); <br></div><div><br></div><div><img src="cid:ii_lcswvu092" alt="image.png" style="margin-right: 0px;" width="294" height="293"> <br></div><div><br></div><div>2.)if you're doing 2D reconstruction, be careful that your projections should not be 1D because the backprojection uses a 2D interpolation. It should have at least 2 lines. </div><div> --> Yes , I hope I can eventually reconstruct a 2D CT Slice, if my read projection step or setting have any problem please let me know, </div><div><br></div><div><div dir="ltr">thanks for your reply </div><div dir="ltr"><br></div><div dir="ltr">BR,</div></div><div><br></div><div><br></div><div><br></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>> 於 2023年1月12日 週四 下午4:30寫道:<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>Hi,</div><div>I'm not sure I have enough information to answer... What I can say is:</div><div>- that the origin is not set to center your volume, for centering, you should use (size-1)*0.5*spacing</div><div>- if you're doing 2D reconstruction, be careful that your projections should not be 1D because the backprojection uses a 2D interpolation. It should have at least 2 lines.<br></div><div>I hope it helps,</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 12, 2023 at 8:46 AM 何明哲 <<a href="mailto:m10512067@yuntech.org.tw" target="_blank">m10512067@yuntech.org.tw</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"><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>HI Everyone ,</div><div><br></div><div>I have a question </div><div>that When I was refer to the official example "Firstcudareconstruction.cpp",</div><div>then I tried to modify the code and reconstruction 2D x ray projection image to 2D ct slice, </div><div>the code is worked but I got the wrong result too, </div><div>I don't understand what the problem I'm have ?</div><div> it's possible that the setting of reconstruction output image size or origin is wrong? </div><div><br></div><div>here is my code and result (I was tried to only reconstruction <span style="color:rgb(32,33,34);font-family:sans-serif;font-size:14px">just a slice NO.100 of the whole volume</span>)</div><div> --------------------------------------------------------------------------------------------</div><div> using GeometryType = rtk::ThreeDCircularProjectionGeometry;<br> GeometryType::Pointer geometry = GeometryType::New();<br> unsigned int numberOfProjections = 280; <br> double firstAngle = 0;<br> double angularArc = 280; <br> unsigned int sid = 510; <br> unsigned int sdd = 690; <br><br> for (unsigned int noProj = 0; noProj < numberOfProjections; noProj++)<br> {<br> double angle = firstAngle + noProj * angularArc / numberOfProjections;<br> geometry->AddProjection(sid, sdd, angle);<br> }<br><br> rtk::ThreeDCircularProjectionGeometryXMLFileWriter::Pointer xmlWriter;<br> xmlWriter = rtk::ThreeDCircularProjectionGeometryXMLFileWriter::New();<br> xmlWriter->SetFilename(".\\RTK_Geometry.xml");<br> xmlWriter->SetObject(geometry);<br> xmlWriter->WriteFile();<br><br> using NameGeneratorType = itk::NumericSeriesFileNames;<br> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br><br> nameGenerator->SetSeriesFormat(ProjectionInage +"\\%d.tif");<br> nameGenerator->SetStartIndex(1);<br> nameGenerator->SetEndIndex(280);<br> nameGenerator->SetIncrementIndex(1);<br><br> using IutputImageType = itk::CudaImage<float, 3>; <br> using ReaderType = rtk::ProjectionsReader<IutputImageType>; <br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileNames(nameGenerator->GetFileNames());<br> reader->Update();<br> <br> using ConstantImageSourceType = rtk::ConstantImageSource<OutputImageType>;<br> ConstantImageSourceType::PointType origin;<br> ConstantImageSourceType::SpacingType spacing;<br> ConstantImageSourceType::SizeType sizeOutput;<br> ConstantImageSourceType::Pointer recoVolume = ConstantImageSourceType::New();<br> <br> sizeOutput[0] = Imagewidth;<br> sizeOutput[1] = Imageheigh;<br> sizeOutput[2] = numofproj; <br> spacing[0] = 0.25;<br> spacing[1] = 0.25;<br> spacing[2] = 0.25;<br> origin[0] = Imagewidth*spacing[0]*0.5*-1; <br> origin[1] = Imageheigh*spacing[0]*0.5*-1; <br> origin[2] = spacing[2]*SliceN*-1; <br><br> recoVolume->SetSize(sizeOutput);<br> recoVolume->SetSpacing(spacing);<br> recoVolume->SetOrigin(origin);<br> recoVolume->SetConstant(0);<br><br> using FDKGPUType = rtk::CudaFDKConeBeamReconstructionFilter;<br> FDKGPUType::Pointer feldkamp = FDKGPUType::New();<br><br> feldkamp->SetInput(0, recoVolume->GetOutput());<br> feldkamp->SetInput(1, reader->GetOutput()); <br> feldkamp->SetGeometry(geometry);<br> feldkamp->SetNumberOfThreads(7);<br> feldkamp->Update();<br><br> using WriterType = itk::ImageFileWriter<OutputImageType>;<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName("C:\\RTK.mhd");<br> writer->SetInput(feldkamp->GetOutput());<br> writer->Update();<br><br><img src="cid:ii_lcss1ndj0" alt="20230112_100.PNG" style="margin-right: 0px;" width="312" height="308"> </div><div><br></div><div>it should be look like this </div><img src="cid:ii_lcss2s4a1" alt="20230109.PNG" style="margin-right: 0px;" width="291" height="240"></div><div dir="ltr"><br></div><div dir="ltr">thanks for your reply </div><div dir="ltr"><br></div><div dir="ltr">BR,<br><div> <br><br> <br></div></div></div></div></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>
</blockquote></div>
</blockquote></div>