[Rtk-users] RTK-user

sare Borhani sareh.borhani at gmail.com
Sun Apr 16 16:27:54 EDT 2017


Dear RTK.User,

I'm using python wrapped version of RTK.

I used the only example of that for reconstruction.It works perfectly.
The problem is that I need to simulate an artifact on projection 2D images,
so first I got each 2D images of stack reiImage by
*srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on that
to simulate an artifact.NOW need to extract these artifacted-images again
to the simpleRTK image to be able to reconstruct it at the end. I thought
maybe *srtk.GetImageFromArray* works, but it doesn't.Can you pls help
me.I'm really hopeless.

Here is the Example;

from __future__ import print_functionimport SimpleRTK as srtkimport
sysimport osimport matplotlib.pyplot as pltimport matplotlib.cm as cm
 if len ( sys.argv ) < 2:
    print( "Usage: RTKFirstReconstruction <output>" )
    sys.exit ( 1 )
 # Defines the RTK geometry object
geometry = srtk.ThreeDCircularProjectionGeometry()
numberOfProjections = 360
firstAngle = 0
angularArc = 360
sid = 600 # source to isocenter distance in mm
sdd = 1200 # source to detector distance in mm
isox = 0 # X coordinate on the projection image of isocenter
isoy = 0 # Y coordinate on the projection image of isocenterfor x in
range(0,numberOfProjections):
  angle = firstAngle + x * angularArc / numberOfProjections
  geometry.AddProjection(sid,sdd,angle,isox,isoy)

constantImageSource = srtk.ConstantImageSource()
origin = [ -127.5, -127.5, 0. ]
sizeOutput = [ 256, 256,  numberOfProjections ]
spacing = [ 1.0, 1.0, 1.0 ]
constantImageSource.SetOrigin( origin )
constantImageSource.SetSpacing( spacing )
constantImageSource.SetSize( sizeOutput )
constantImageSource.SetConstant(0.0)
source = constantImageSource.Execute()

rei = srtk.RayEllipsoidIntersectionImageFilter()
semiprincipalaxis = [ 50, 50, 50]
center = [ 0, 0, 0]# Set GrayScale value, axes, center...
rei.SetDensity(20)
rei.SetAngle(0)
rei.SetCenter(center)
rei.SetAxis(semiprincipalaxis)
rei.SetGeometry( geometry )
reiImage = rei.Execute(source)
 # Create reconstructed image
constantImageSource2 = srtk.ConstantImageSource()
origin = [ -63.5, -63.5, -63.5 ]
sizeOutput = [ 128, 128, 128 ]
constantImageSource2.SetOrigin( origin )
constantImageSource2.SetSpacing( spacing )
constantImageSource2.SetSize( sizeOutput )
constantImageSource2.SetConstant(0.0)
source2 = constantImageSource2.Execute()
 print("Performing reconstruction")
feldkamp = srtk.FDKConeBeamReconstructionFilter()
feldkamp.SetGeometry( geometry );
feldkamp.SetTruncationCorrection(0.0);
feldkamp.SetHannCutFrequency(0.0);
image = feldkamp.Execute(source2,reiImage)
 print("Masking field-of-view")
fov = srtk.FieldOfViewImageFilter()
fov.SetGeometry(geometry)
fov.SetProjectionsStack(reiImage)
image = fov.Execute(image)

plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r)
plt.show()

writer = srtk.ImageFileWriter()
writer.SetFileName ( sys.argv[1] )
writer.Execute ( image );

http://wiki.openrtk.org/index.php/SimpleRTK


Thank you in advance.


Best regards,
Sareh Borhani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20170416/39f3b89f/attachment-0001.html>


More information about the Rtk-users mailing list