[Rtk-users] [EXTERNAL] Re: Help modifying first reconstruction example to read TIFF projections

Simon Rit simon.rit at creatis.insa-lyon.fr
Wed Mar 1 06:49:07 CET 2023


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

On Wed, Mar 1, 2023 at 12:38 AM Eldridge, Bryce D <bdeldri at sandia.gov>
wrote:

> I will try writing out the projections and see what I get.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> *From:* Simon Rit <simon.rit at creatis.insa-lyon.fr>
> *Sent:* Tuesday, February 28, 2023 4:33 PM
> *To:* Eldridge, Bryce D <bdeldri at sandia.gov>
> *Cc:* rtk-users at openrtk.org
> *Subject:* [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction
> example to read TIFF projections
>
>
>
> Hi,
>
> 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.
>
> Simon
>
>
>
> On Tue, Feb 28, 2023 at 11:53 PM Eldridge, Bryce D <bdeldri at sandia.gov>
> wrote:
>
> Hi,
>
>
>
> 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.
>
>
>
> It runs without errors, but the reconstructed volume looks very strange
> which makes me think I am doing something wrong.
>
>
>
> 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.
>
>
>
> # Defines the image type
>
> ImageType = itk.Image[itk.F,3]
>
>
>
> # Defines the RTK geometry object
>
> geometry = rtk.ThreeDCircularProjectionGeometry.New()
>
> numberOfProjections = 37
>
> firstAngle = 0.
>
> angularArc = 185.
>
> sid = 914 # source to isocenter distance (mm)
>
> sdd = 1219 # source to detector distance (mm)
>
> for x in range(0,numberOfProjections):
>
>   angle = firstAngle + x * angularArc / numberOfProjections
>
>   geometry.AddProjection(sid,sdd,angle)
>
>
>
> Skipping some code … (file name list setup, geometry output writing) …
>
>
>
> tiffio = itk.TIFFImageIO.New()
>
>
>
> ProjectionsReaderType = rtk.ProjectionsReader[ImageType]
>
> projectionsSource = ProjectionsReaderType.New()
>
> projectionsSource.SetImageIO(tiffio)
>
> projectionsSource.SetFileNames(fileNameList)
>
> projOrigin = [ -0.14*(3072-1)/2, -0.14*(2560-1)/2, 0 ] #input images are
> 3072x2560 pixels with a 0.14mm pixel size
>
> projSpacing = [ 0.14, 0.14, 1.0 ]
>
> projectionsSource.SetOrigin( projOrigin )
>
> projectionsSource.SetSpacing( projSpacing )
>
>
>
> ConstantImageSourceType = rtk.ConstantImageSource[ImageType]
>
>
>
> # Create reconstructed image
>
> constantImageSource2 = ConstantImageSourceType.New()
>
> sizeOutput = [ 512, 512, 512 ]
>
> origin = [ -255.5, -255.5, -255.5 ]
>
> spacing = [ 1.0, 1.0, 1.0 ]
>
> constantImageSource2.SetOrigin( origin )
>
> constantImageSource2.SetSpacing( spacing )
>
> constantImageSource2.SetSize( sizeOutput )
>
> constantImageSource2.SetConstant(0.)
>
>
>
> # FDK reconstruction
>
> print("Reconstructing...")
>
> FDKCPUType = rtk.FDKConeBeamReconstructionFilter[ImageType]
>
> feldkamp = FDKCPUType.New()
>
> feldkamp.SetInput(0, constantImageSource2.GetOutput()) # this is the
> template for the output image type
>
> feldkamp.SetInput(1, projectionsSource.GetOutput()) # this is the
> projection stack from rtk.ProjectionsReader
>
> feldkamp.SetGeometry(geometry)
>
> feldkamp.GetRampFilter().SetTruncationCorrection(0.0)
>
> feldkamp.GetRampFilter().SetHannCutFrequency(0.0)
>
>
>
> # Writer
>
> print("Writing output image...")
>
> WriterType = rtk.ImageFileWriter[ImageType]
>
> writer = WriterType.New()
>
> writer.SetFileName(sys.argv[1])
>
> writer.SetInput(feldkamp.GetOutput())
>
> writer.Update()
>
>
>
>
>
> Thanks
>
>
>
>
>
> _______________________________________________
> Rtk-users mailing list
> rtk-users at openrtk.org
> https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users
> <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>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230301/b78bb8e2/attachment.htm>


More information about the Rtk-users mailing list