From simon.rit at creatis.insa-lyon.fr Wed Jan 4 12:23:19 2023 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Wed, 4 Jan 2023 13:23:19 +0100 Subject: [Rtk-users] How to use RTK to reconstruction 2D X- ray Scan projection images into 2D CT Slice image? In-Reply-To: References: Message-ID: 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: From m10512067 at yuntech.org.tw Thu Jan 5 09:26:28 2023 From: m10512067 at yuntech.org.tw (=?UTF-8?B?5L2V5piO5ZOy?=) Date: Thu, 5 Jan 2023 17:26:28 +0800 Subject: [Rtk-users] How to use RTK to reconstruction 2D X- ray Scan projection images into 2D CT Slice image? In-Reply-To: References: Message-ID: 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 using IutputImageType = itk::CudaImage; //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 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; //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 ? 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: 250.jpg Type: image/jpeg Size: 72845 bytes Desc: not available URL: From simon.rit at creatis.insa-lyon.fr Thu Jan 5 09:32:40 2023 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Thu, 5 Jan 2023 10:32:40 +0100 Subject: [Rtk-users] How to use RTK to reconstruction 2D X- ray Scan projection images into 2D CT Slice image? In-Reply-To: References: Message-ID: Hi, 1. Try to catch the exception on Update to know what is the problem. 2. In RTK, the default rotation axis is Y so I meant Y. See the doc . Simon On Thu, Jan 5, 2023 at 10:27 AM ??? wrote: > > 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 > using IutputImageType = itk::CudaImage; //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 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; > //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 ? 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: 250.jpg Type: image/jpeg Size: 72845 bytes Desc: not available URL: