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

Eldridge, Bryce D bdeldri at sandia.gov
Mon Mar 20 17:18:20 CET 2023


Thanks, and yes I think you are right. The PSSF stuff wasn’t making any sense with 185 degrees, so I think this dataset doesn’t have enough projections to do that.

I did try a SART reconstruction and got something that looks more reasonable, so I am pretty sure everything is working correctly at least in terms of the projection pipeline.

Thanks for your help.

From: Simon Rit <simon.rit at creatis.insa-lyon.fr>
Sent: Monday, March 20, 2023 5:31 AM
To: Eldridge, Bryce D <bdeldri at sandia.gov>
Cc: rtk-users at openrtk.org
Subject: Re: [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction example to read TIFF projections

I don't know if it is the problem but according to your geometry, if I haven't done any mistake, you need ~200° of angular coverage (180+np.arctan(3072*0.14*0.5/1219)*2*180/np.pi) and you only have 185°. That will be a problem in my opinion...
Simon

On Wed, Mar 15, 2023 at 8:51 PM Eldridge, Bryce D <bdeldri at sandia.gov<mailto:bdeldri at sandia.gov>> wrote:
More progress: Added some cropping, and called SetIO(0) on the projection reader, this seems to enable the IO estimation filter to run properly. I also went back to the non-inverted input projections, and now the filtered projections from the reader look like this (which looks correct to me):

[cid:image001.png at 01D95B15.43F7E2A0]

Added the PSSF filter, although I’m not sure if that is correct or not, and I’m still getting a very strange looking reconstructed volume:

[cid:image002.png at 01D95B15.43F7E2A0]

From: Eldridge, Bryce D
Sent: Wednesday, March 15, 2023 10:48 AM
To: Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
Cc: rtk-users at openrtk.org<mailto:rtk-users at openrtk.org>
Subject: RE: [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction example to read TIFF projections

Ok, so I finally got to the point where I can run some of this with the debugger (had to switch from python to c++ because of various issues), but now I can try to figure out why the projections don’t look right.

I did verify that the projection reader is using unsigned short, which is correct, and is writing out float, which also seems correct, and looks like it is setting up a scatter correction, IO estimation, and raw to attenuation filter. However, I agree it is strange that the air is still non-zero, and I also don’t understand why the objects are still darker than the air, it seems backwards.

Here's a picture of the raw projection vs the copy written out by the projection reader, I inverted the source (maybe not needed? Got the same results with non-inverted input images though) so that white was the dense part, but that results in the background being really high.

A couple of spot check values in the image:

Background, X=1458,Y=919, Original pixel value= 60751, ProjectionReader value = 0.0758
Object, X=855,Y=1952, Original pixel value= 64512, ProjectionReader value = 0.0157


[cid:image003.png at 01D95B15.43F7E2A0][cid:image004.png at 01D95B15.43F7E2A0]

If you have any ideas what I should be doing differently let me know, otherwise next I’m digging more into the projection reader to see exactly how that conversion is happening. Once I get the projections to look right I’ll move on to the Parker short scan filtering too.

Bryce

From: Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
Sent: Wednesday, March 1, 2023 8:33 AM
To: Eldridge, Bryce D <bdeldri at sandia.gov<mailto:bdeldri at sandia.gov>>
Cc: rtk-users at openrtk.org<mailto:rtk-users at openrtk.org>
Subject: Re: [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction example to read TIFF projections

Is this image the output of the rtk::ProjectionsReader? If so, it does not look right because the air seems to be non zero (assuming that white is non zero). That should have been done automatically for unsigned short projections, I'm not sure what's wrong here. Maybe set the component type of your TIFFImageIO (see doxygen here<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2FDoxygen%2Fhtml%2Fclassitk_1_1TIFFImageIO-members.html&data=05%7C01%7Cbdeldri%40sandia.gov%7C9a3c2d00df1d4cf9d0a308db293696d9%7C7ccb5a20a303498cb0c129007381b574%7C1%7C0%7C638149086730478322%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=awt30fZcc9FuYeRpb%2BWIZIfFev3MrAb5gGShVZZAZwg%3D&reserved=0>)?
The next thing is that the sinogram seems to be incomplete (~180° coverage?) which is a problem for FDK and the probable cause for the bright streaks. You might want to add a ParkerShortScanImageFilter between the output of the ProjectionsReader and the FDK reconstruction, as in rtkfdk<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSimonRit%2FRTK%2Fblob%2Fmaster%2Fapplications%2Frtkfdk%2Frtkfdk.cxx%23L101-L115&data=05%7C01%7Cbdeldri%40sandia.gov%7C9a3c2d00df1d4cf9d0a308db293696d9%7C7ccb5a20a303498cb0c129007381b574%7C1%7C0%7C638149086730478322%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D7Jho74Sqh40eVPLTGWLzpj7G8Aep3i8WWIPpJH8%2F6U%3D&reserved=0>.
Simon

On Wed, Mar 1, 2023 at 3:46 PM Eldridge, Bryce D <bdeldri at sandia.gov<mailto:bdeldri at sandia.gov>> wrote:
Ok, thanks. Writing out the projections like you suggested looks ok, I can load the written projection stack into slicer and the image data looks correct as far as I can tell:

[cid:image005.png at 01D95B15.43F7E2A0]

But the reconstruction volume still does not look right:

[cid:image006.png at 01D95B15.43F7E2A0]

From: Simon Rit <simon.rit at creatis.insa-lyon.fr<mailto:simon.rit at creatis.insa-lyon.fr>>
Sent: Tuesday, February 28, 2023 10:49 PM
To: Eldridge, Bryce D <bdeldri at sandia.gov<mailto:bdeldri at sandia.gov>>
Cc: rtk-users at openrtk.org<mailto:rtk-users at openrtk.org>
Subject: Re: [EXTERNAL] Re: [Rtk-users] Help modifying first reconstruction example to read TIFF projections

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<mailto: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<mailto:simon.rit at creatis.insa-lyon.fr>>
Sent: Tuesday, February 28, 2023 4:33 PM
To: Eldridge, Bryce D <bdeldri at sandia.gov<mailto:bdeldri at sandia.gov>>
Cc: rtk-users at openrtk.org<mailto: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<mailto: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<mailto: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%7C9a3c2d00df1d4cf9d0a308db293696d9%7C7ccb5a20a303498cb0c129007381b574%7C1%7C0%7C638149086730478322%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BDKYtX9wOGMT%2Bk40j0mLyDfbmt1f6CMk8AAKQj25DTs%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 170359 bytes
Desc: image001.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 147701 bytes
Desc: image002.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 279499 bytes
Desc: image003.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 256185 bytes
Desc: image004.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 120376 bytes
Desc: image005.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 298786 bytes
Desc: image006.png
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20230320/2a5f10e4/attachment-0011.png>


More information about the Rtk-users mailing list