<div dir="ltr"><div>Hi,</div><div><br></div><div>I created another topic since the content is different from the previous one and people could land here with a different search in the archives.</div><div><br></div><div>While trying to reconstruct a set of images from 0 and 180° without having to add the fan angle, Simon recommended to use the conjugate gradient algorithm in RTK. So, I first tried to replicate in Python the conjugate gradient application written in C++ (<a href="https://github.com/SimonRit/RTK/tree/master/applications/rtkconjugategradient">https://github.com/SimonRit/RTK/tree/master/applications/rtkconjugategradient</a>). But whatever types of input I set, my python kernel dies when updating the filter without any error or debug message. I spent some time thinking about it but I can't find out what is wrong.</div><div>I have attached my code at the end of this message if you have suggestions about what would be wrong.</div><div><br></div><div>Thanks for your help,</div><div><br></div><div>Clément</div><div><br></div><div>------------------------------------------------------------------------------------------------------------</div><div><br></div><div># Defines the image type<br>ImageType = itk.Image[itk.F,3]<br></div><div><br></div><div># Defines the RTK geometry object<br>geometry = rtk.ThreeDCircularProjectionGeometry.New()<br>numberOfProjections = 180<br>firstAngle = 90<br>sid = 600 # source to isocenter distance<br>sdd = 1200 # source to detector distance<br>angularArc = 180<br>for x in range(0,numberOfProjections):<br>  angle = firstAngle + x * angularArc / numberOfProjections<br>  geometry.AddProjection(sid,sdd,angle)<br><br># Create a stack of empty projection images<br>ConstantImageSourceType = rtk.ConstantImageSource[ImageType]<br>constantImageSource = ConstantImageSourceType.New()<br>origin = [ -199, -199, 0. ]<br>sizeOutput = [ 200, 200, 180 ]<br>spacing = [ 2.0, 2.0, 2.0 ]<br>constantImageSource.SetOrigin( origin )<br>constantImageSource.SetSpacing( spacing )<br>constantImageSource.SetSize( sizeOutput )<br>constantImageSource.SetConstant(0.)<br><br># Forward projection of input volume<br>proj = rtk.JosephForwardProjectionImageFilter[ImageType, ImageType].New()<br>proj.SetInput(constantImageSource)<br>proj.SetInput(1, input) # input is ImageType from a reader<br>proj.SetGeometry(geometry)<br></div><div><br></div><div># Create weights<br>weightsSource = ConstantImageSourceType.New()<br>weightsSource.SetInformationFromImage(proj.GetOutput())<br>weightsSource.SetConstant(1.0)</div><div><br></div><div># Create output like volume<br>outputImageSource = ConstantImageSourceType.New()<br>sizeOutput = [ 400, 400, 400]<br>origin = [ -200, -200, -200 ]<br>spacing = [ 1.0, 1.0, 1.0 ]<br>outputImageSource.SetOrigin(origin)<br>outputImageSource.SetSpacing(spacing)<br>outputImageSource.SetSize(sizeOutput)<br>outputImageSource.SetConstant(0.)<br><br># Create reconstructed image</div>RCGType = rtk.ConjugateGradientConeBeamReconstructionFilter[ImageType]<br>conjugateGradient = RCGType.New()<br>conjugateGradient.SetInput(outputImageSource.GetOutput())<br>conjugateGradient.SetInput(1, proj.GetOutput())<br>conjugateGradient.SetInput(2, weightsSource.GetOutput())<br>conjugateGradient.SetGeometry(geometry)<br>conjugateGradient.SetGamma(2.0)<br>conjugateGradient.SetNumberOfIterations(30)<br>conjugateGradient.SetDisableDisplacedDetectorFilter(True)<br><div>conjugateGradient.Update()</div></div>