<div dir="ltr"><div>The ProjectionsReader usually takes integer projections as input and convert them to float with the appropriate conversions. So I don't think it is the problem here. To be checked...</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 1, 2023 at 12:38 AM Eldridge, Bryce D <<a href="mailto:bdeldri@sandia.gov">bdeldri@sandia.gov</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 class="msg-2422173345283393068">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="m_-2422173345283393068WordSection1">
<p class="MsoNormal">I will try writing out the projections and see what I get. <u></u>
<u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Could it be a data type issue? The images are unsigned short (16-bit grayscale), but I’m using the itk.Image[itk.F,3] type so I’m not sure if the projection reader is defaulting to unsigned short and doing the appropriate conversions or
not. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It looks like ITK doesn’t include wrapping support for unsigned short by default, so I’d have to rebuild it to try to test that.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in">
<p class="MsoNormal"><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> Tuesday, February 28, 2023 4:33 PM<br>
<b>To:</b> Eldridge, Bryce D <<a href="mailto:bdeldri@sandia.gov" target="_blank">bdeldri@sandia.gov</a>><br>
<b>Cc:</b> <a href="mailto:rtk-users@openrtk.org" target="_blank">rtk-users@openrtk.org</a><br>
<b>Subject:</b> [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction example to read TIFF projections<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Maybe you can first check whether the projections are read adequately by adding a line itk.imwrite(projectionsSource)? The ProjectionsReader tries to automatically convert the projections to line integral and it might do something wrong...
I don't see what could be wrong in your code.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Simon<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Feb 28, 2023 at 11:53 PM Eldridge, Bryce D <<a href="mailto:bdeldri@sandia.gov" target="_blank">bdeldri@sandia.gov</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I am trying to modify the first reconstruction example to read a set of 16-bit grayscale TIFF projections that I captured, run the 3D reconstruction, and save the output. The projects
are taken at 5 degree increments over a 180 degree arc. <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">It runs without errors, but the reconstructed volume looks very strange which makes me think I am doing something wrong.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Here is the basic python code I am trying to use (modified from the example), if anyone can see what I might be doing wrong I would appreciate it.
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"># Defines the image type<u></u><u></u></p>
<p class="MsoNormal">ImageType = itk.Image[itk.F,3]<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"># Defines the RTK geometry object<u></u><u></u></p>
<p class="MsoNormal">geometry = rtk.ThreeDCircularProjectionGeometry.New()<u></u><u></u></p>
<p class="MsoNormal">numberOfProjections = 37<u></u><u></u></p>
<p class="MsoNormal">firstAngle = 0.<u></u><u></u></p>
<p class="MsoNormal">angularArc = 185.<u></u><u></u></p>
<p class="MsoNormal">sid = 914 # source to isocenter distance (mm)<u></u><u></u></p>
<p class="MsoNormal">sdd = 1219 # source to detector distance (mm)<u></u><u></u></p>
<p class="MsoNormal">for x in range(0,numberOfProjections):<u></u><u></u></p>
<p class="MsoNormal"> angle = firstAngle + x * angularArc / numberOfProjections<u></u><u></u></p>
<p class="MsoNormal"> geometry.AddProjection(sid,sdd,angle)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Skipping some code … (file name list setup, geometry output writing) …<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">tiffio = itk.TIFFImageIO.New()<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">ProjectionsReaderType = rtk.ProjectionsReader[ImageType]<u></u><u></u></p>
<p class="MsoNormal">projectionsSource = ProjectionsReaderType.New()<u></u><u></u></p>
<p class="MsoNormal">projectionsSource.SetImageIO(tiffio)<u></u><u></u></p>
<p class="MsoNormal">projectionsSource.SetFileNames(fileNameList)<u></u><u></u></p>
<p class="MsoNormal">projOrigin = [ -0.14*(3072-1)/2, -0.14*(2560-1)/2, 0 ] #input images are 3072x2560 pixels with a 0.14mm pixel size<u></u><u></u></p>
<p class="MsoNormal">projSpacing = [ 0.14, 0.14, 1.0 ]<u></u><u></u></p>
<p class="MsoNormal">projectionsSource.SetOrigin( projOrigin )<u></u><u></u></p>
<p class="MsoNormal">projectionsSource.SetSpacing( projSpacing )<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">ConstantImageSourceType = rtk.ConstantImageSource[ImageType]<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"># Create reconstructed image<u></u><u></u></p>
<p class="MsoNormal">constantImageSource2 = ConstantImageSourceType.New()<u></u><u></u></p>
<p class="MsoNormal">sizeOutput = [ 512, 512, 512 ]<u></u><u></u></p>
<p class="MsoNormal">origin = [ -255.5, -255.5, -255.5 ]<u></u><u></u></p>
<p class="MsoNormal">spacing = [ 1.0, 1.0, 1.0 ]<u></u><u></u></p>
<p class="MsoNormal">constantImageSource2.SetOrigin( origin )<u></u><u></u></p>
<p class="MsoNormal">constantImageSource2.SetSpacing( spacing )<u></u><u></u></p>
<p class="MsoNormal">constantImageSource2.SetSize( sizeOutput )<u></u><u></u></p>
<p class="MsoNormal">constantImageSource2.SetConstant(0.)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"># FDK reconstruction<u></u><u></u></p>
<p class="MsoNormal">print("Reconstructing...")<u></u><u></u></p>
<p class="MsoNormal">FDKCPUType = rtk.FDKConeBeamReconstructionFilter[ImageType]<u></u><u></u></p>
<p class="MsoNormal">feldkamp = FDKCPUType.New()<u></u><u></u></p>
<p class="MsoNormal">feldkamp.SetInput(0, constantImageSource2.GetOutput()) # this is the template for the output image type<u></u><u></u></p>
<p class="MsoNormal">feldkamp.SetInput(1, projectionsSource.GetOutput()) # this is the projection stack from rtk.ProjectionsReader<u></u><u></u></p>
<p class="MsoNormal">feldkamp.SetGeometry(geometry)<u></u><u></u></p>
<p class="MsoNormal">feldkamp.GetRampFilter().SetTruncationCorrection(0.0)<u></u><u></u></p>
<p class="MsoNormal">feldkamp.GetRampFilter().SetHannCutFrequency(0.0)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"># Writer<u></u><u></u></p>
<p class="MsoNormal">print("Writing output image...")<u></u><u></u></p>
<p class="MsoNormal">WriterType = rtk.ImageFileWriter[ImageType]<u></u><u></u></p>
<p class="MsoNormal">writer = WriterType.New()<u></u><u></u></p>
<p class="MsoNormal">writer.SetFileName(sys.argv[1])<u></u><u></u></p>
<p class="MsoNormal">writer.SetInput(feldkamp.GetOutput())<u></u><u></u></p>
<p class="MsoNormal">writer.Update()<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Rtk-users mailing list<br>
<a href="mailto:rtk-users@openrtk.org" target="_blank">rtk-users@openrtk.org</a><br>
<a href="https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.creatis.insa-lyon.fr%2Fmailman%2Flistinfo%2Frtk-users&data=05%7C01%7Cbdeldri%40sandia.gov%7Ce5bb218af08f43f47e2808db19e41c0a%7C7ccb5a20a303498cb0c129007381b574%7C1%7C0%7C638132239765187672%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mAh%2Fjvu5PMr%2FmVNrvYxRxMzpKj0%2BJZz3bVQWN7BNJ3Y%3D&reserved=0" target="_blank">https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users</a><u></u><u></u></p>
</div>
</blockquote>
</div>
</div>
</div>
</div></blockquote></div>