[Rtk-users] Error Result by using FDK algorithm to Reconstruction 2D X- ray Scan projection images into 2D CT Slice image

何明哲 m10512067 at yuntech.org.tw
Thu Jan 12 11:00:28 CET 2023


Dear Simon

Thanks for your reply .Its great help for me!

1.)I was  refer your suggestion and modified the code,
but the result will be a large blank area and I don't understand why

here is the code and result

sizeOutput[0] = Imagewidth;
  sizeOutput[1] = 1;
  sizeOutput[2] = numberOfProjections;
  spacing[0] = 0.25;
  spacing[1] = 0.25;
  spacing[2] = 0.25;
  origin[0] = (Imagewidth-1)*0.5*spacing[0];
  origin[1] = (Imageheigh-1)*0.5*spacing[1];
  origin[2] = spacing[2]*SliceN*-1;

  recoVolume->SetSize(sizeOutput);
  recoVolume->SetSpacing(spacing);
  recoVolume->SetOrigin(origin);
  recoVolume->SetConstant(0.);

[image: image.png]

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.
 --> 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,

thanks for your reply

BR,





Simon Rit <simon.rit at creatis.insa-lyon.fr> 於 2023年1月12日 週四 下午4:30寫道:

> Hi,
> I'm not sure I have enough information to answer... What I can say is:
> - that the origin is not set to center your volume, for centering, you
> should use (size-1)*0.5*spacing
> - 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.
> I hope it helps,
> Simon
>
> On Thu, Jan 12, 2023 at 8:46 AM 何明哲 <m10512067 at yuntech.org.tw> wrote:
>
>>
>> HI Everyone ,
>>
>> I have a question
>> that When I was refer to the official example
>> "Firstcudareconstruction.cpp",
>> then I tried to  modify the code and reconstruction 2D x ray projection
>> image to 2D ct slice,
>> the code is worked but I got the wrong result too,
>> I don't understand what the problem I'm have ?
>>  it's possible that the setting of reconstruction output image size or
>> origin is wrong?
>>
>> here is my code and result (I was tried to only reconstruction just a
>> slice NO.100 of the whole volume)
>>
>>  --------------------------------------------------------------------------------------------
>>  using GeometryType = rtk::ThreeDCircularProjectionGeometry;
>>   GeometryType::Pointer geometry = GeometryType::New();
>>   unsigned int          numberOfProjections = 280;
>>   double                firstAngle = 0;
>>   double                angularArc = 280;
>>   unsigned int          sid = 510;
>>   unsigned int          sdd = 690;
>>
>>   for (unsigned int noProj = 0; noProj < numberOfProjections; noProj++)
>>   {
>>     double angle = firstAngle + noProj * angularArc / numberOfProjections;
>>     geometry->AddProjection(sid, sdd, angle);
>>   }
>>
>>   rtk::ThreeDCircularProjectionGeometryXMLFileWriter::Pointer xmlWriter;
>>   xmlWriter = rtk::ThreeDCircularProjectionGeometryXMLFileWriter::New();
>>   xmlWriter->SetFilename(".\\RTK_Geometry.xml");
>>   xmlWriter->SetObject(geometry);
>>   xmlWriter->WriteFile();
>>
>>   using NameGeneratorType = itk::NumericSeriesFileNames;
>>   NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
>>
>>   nameGenerator->SetSeriesFormat(ProjectionInage +"\\%d.tif");
>>   nameGenerator->SetStartIndex(1);
>>   nameGenerator->SetEndIndex(280);
>>   nameGenerator->SetIncrementIndex(1);
>>
>>   using IutputImageType = itk::CudaImage<float, 3>;
>>   using ReaderType = rtk::ProjectionsReader<IutputImageType>;
>>   ReaderType::Pointer reader = ReaderType::New();
>>   reader->SetFileNames(nameGenerator->GetFileNames());
>>   reader->Update();
>>
>>   using ConstantImageSourceType =
>> rtk::ConstantImageSource<OutputImageType>;
>>   ConstantImageSourceType::PointType   origin;
>>   ConstantImageSourceType::SpacingType spacing;
>>   ConstantImageSourceType::SizeType    sizeOutput;
>>   ConstantImageSourceType::Pointer     recoVolume =
>> ConstantImageSourceType::New();
>>
>>   sizeOutput[0] = Imagewidth;
>>   sizeOutput[1] = Imageheigh;
>>   sizeOutput[2] = numofproj;
>>   spacing[0] = 0.25;
>>   spacing[1] = 0.25;
>>   spacing[2] = 0.25;
>>   origin[0] = Imagewidth*spacing[0]*0.5*-1;
>>   origin[1] = Imageheigh*spacing[0]*0.5*-1;
>>   origin[2] = spacing[2]*SliceN*-1;
>>
>>   recoVolume->SetSize(sizeOutput);
>>   recoVolume->SetSpacing(spacing);
>>   recoVolume->SetOrigin(origin);
>>   recoVolume->SetConstant(0);
>>
>>   using FDKGPUType = rtk::CudaFDKConeBeamReconstructionFilter;
>>   FDKGPUType::Pointer feldkamp = FDKGPUType::New();
>>
>>   feldkamp->SetInput(0, recoVolume->GetOutput());
>>   feldkamp->SetInput(1, reader->GetOutput());
>>   feldkamp->SetGeometry(geometry);
>>   feldkamp->SetNumberOfThreads(7);
>>   feldkamp->Update();
>>
>>   using WriterType = itk::ImageFileWriter<OutputImageType>;
>>   WriterType::Pointer writer = WriterType::New();
>>   writer->SetFileName("C:\\RTK.mhd");
>>   writer->SetInput(feldkamp->GetOutput());
>>   writer->Update();
>>
>> [image: 20230112_100.PNG]
>>
>> it should be look like this
>> [image: 20230109.PNG]
>>
>> thanks for your reply
>>
>> BR,
>>
>>
>>
>> _______________________________________________
>> Rtk-users mailing list
>> rtk-users at openrtk.org
>> https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230112/de18745c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20230112_100.PNG
Type: image/png
Size: 104500 bytes
Desc: not available
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230112/de18745c/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20230109.PNG
Type: image/png
Size: 221917 bytes
Desc: not available
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230112/de18745c/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 39478 bytes
Desc: not available
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230112/de18745c/attachment-0005.png>


More information about the Rtk-users mailing list