[Rtk-users] How to use RTK to reconstruction 2D X- ray Scan projection images into 2D CT Slice image?

何明哲 m10512067 at yuntech.org.tw
Thu Jan 5 09:26:28 UTC 2023


Hello Simon

Thanks for your reply,

I also have some question to ask ,

1.  I just tried your suggested code  to implement  projectionreader API ,
in C++ version and use CUDA too,
     but is will be crash on update parameters function ,  What steps am I
doing wrong?

 here is my code :
   ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓  ↓
 using ImageIOType = itk::RawImageIO<unsigned short, 2>; //unsigned short
  using IutputImageType = itk::CudaImage<float, 3>; //float

  ImageIOType::Pointer io = ImageIOType::New();
  io->SetHeaderSize(2048);
  io->SetNumberOfDimensions(2);
  io->SetPixelType(itk::CommonEnums::IOPixel::SCALAR);
  io->SetDimensions(0, 1152);
  io->SetDimensions(1, 1152);
  io->SetByteOrderToLittleEndian();
  io->SetSpacing(0, 0.25);
  io->SetSpacing(1, 0.25);

  string nametostring = "";
  std::vector<std::string> newfilename(272);
  for (int fna = 1; fna < 273; fna++)
  {
    nametostring = std::to_string(fna);
    newfilename.push_back(subfolder);
    newfilename.push_back("\\");
    newfilename.push_back(nametostring + ".raw");
  }

  using ReaderType = rtk::ProjectionsReader<IutputImageType>;
//OutputImageType CPUimagetype
  ReaderType::Pointer reader = ReaderType::New();

  reader->SetFileNames(newfilename);

  reader->SetImageIO(io);

  reader->Update();  <- Crash on here
---------

2.  You can reconstruct one 3D slice by using a size of 1 in the axial
direction
-->  Do you mean Set Z in the size parameter to 1 ?
      for example --> Size (XYZ)=>(1024,1024,1)
     then I get the reconstruct image like this ?

[image: 250.jpg]


Thanks again in advance for your reply.

BR







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

> Hello,
> 1/ Yes, you can read images in raw format but you need to specify the meta
> information for example in python
> rawio = itk.RawImageIO.New()
> rawio.SetNumberOfDimensions(2)
> rawio.SetPixelType(itk.CommonEnums.IOPixel_SCALAR)
> rawio.SetComponentType(itk.CommonEnums.IOComponent_FLOAT)
> rawio.SetDimensions(0, 256)
> rawio.SetDimensions(1, 256)
> rawio.SetSpacing(0, 1)
> rawio.SetSpacing(1, 1)
> rawio.SetByteOrderToLittleEndian()
>
> # List of filenames
> fileNames = []
> for i in range(100):
>     fileNames.append(f'{i}.raw')
>
> # Read projections
> CPUImageType = itk.Image[itk.F,3]
> proj = rtk.projections_reader(ttype=CPUImageType, file_names=fileNames,
> ImageIO=rawio)
>
> 2/ We only work in 3D. You can reconstruct one 3D slice by using a size of
> 1 in the axial direction.
> Simon
>
> On Mon, Dec 26, 2022 at 10:40 AM 何明哲 via Rtk-users <
> rtk-users at public.kitware.com> wrote:
>
>>
>> Hello everyone
>>
>> I am a newbie in using RTK
>>
>> I have  two question to ask,
>> 1. Can the projectionreader API read images in RAW format data set?
>> 2. Which API or method does RTK provide to reconstruct the 2D X-ray scan
>> data set projection image into a 2D CT Slice image ?Or is there any other
>> reference document that can help me reconstruct CT slices in RTK?
>>
>> thanks for reply ,BR
>> _______________________________________________
>> Rtk-users mailing list
>> Rtk-users at public.kitware.com
>> https://public.kitware.com/cgi-bin/mailman/listinfo/rtk-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20230105/e0a51ab4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 250.jpg
Type: image/jpeg
Size: 72845 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20230105/e0a51ab4/attachment-0001.jpg>


More information about the Rtk-users mailing list