[Rtk-users] segfault in RTK 2.0

Simon Rit simon.rit at creatis.insa-lyon.fr
Tue Feb 19 17:15:12 EST 2019


Hi,
Thanks for sharing your experience. I tried to use your code to reproduce
your problem but I couldn't. Enclosed is the code that I run with

import daye
simulator = daye.simulator()
simulator.runCBCT('proj.mha', 0, 0)
simulator.buildVolumeFromFile('proj.mha','recon.mha',simulator)

Does it work for you? If yes, can you send your full example?
Simon

On Mon, Feb 18, 2019 at 7:51 AM Pierre Daye <Pierre.Daye at iba-group.com>
wrote:

>
>
> Hello,
>
>
>
> First of all congrats for the update of RTK and the new Python
> integration. This is really great for Python users who don’t want the whole
>
> C++ armada to test a small reconstruction principle!
>
> I could easily run the first reconstruction and it worked perfectly!
> However, I tried then to first save the images using these method within
>
> a simulator python class:
>
>
>
>     def buildGeometry(self, offsetZ, offsetY):
>
>         geometry = rtk.ThreeDCircularProjectionGeometry.New()
>
>         for x in range(0, self.param['numberOfProjections']):
>
>             angle = self.param['firstAngle'] + x *
> self.param['angularArc'] / self.param['numberOfProjections']
>
>             geometry.AddProjection(self.param['sid'] + offsetZ,
>
>                 self.param['sdd'], angle, self.param['isox'],
>
>                 self.param['isoy'], self.param['outOfPlaneAngle'],
>
>                 self.param['inPlaneAngle'], self.param['sourceOffsetX'],
> offsetY)
>
>
>
>         return geometry
>
>
>
>     def runCBCT(self, filename, offsetZ, offsetY):
>
>         geometry = self.buildGeometry(offsetZ, offsetY)
>
>
>
>         constantImageSource =
> rtk.ConstantImageSource[self.param['TImageType']].New()
>
>         constantImageSource.SetOrigin( self.param['origin'] )
>
>         constantImageSource.SetSpacing( self.param['spacing'] )
>
>         constantImageSource.SetSize( self.param['sizeOutput'] )
>
>         constantImageSource.SetConstant(0.0)
>
>         source = constantImageSource.GetOutput()
>
>
>
>         self.rei.SetGeometry(geometry)
>
>         self.rei.SetInput(source)
>
>
>
>         projections = self.rei.GetOutput()
>
>
>
>         writer = itk.ImageFileWriter[self.param['TImageType']].New()
>
>         writer.SetFileName(filename)
>
>         writer.SetInput(projections)
>
>         writer.Update()
>
>
>
> This parts works perfectly and the generated images are OK (checked with
> IMageJ).
>
> The problems start when I want to reconstruct the volume.
>
>
>
> def buildVolumeFromFile(self, file, fileOUT, CBCT):
>
>         geometry = CBCT.buildGeometry(0, 0)
>
>         print("Performing reconstruction")
>
>         TImageType = self.param['TImageType']
>
>         reader = itk.ImageFileReader[TImageType].New()
>
>         reader.SetFileName(file)
>
>         reiImage = reader.GetOutput()
>
>
>
>         # Create reconstructed image
>
>         constantImageSource2 = rtk.ConstantImageSource[TImageType].New()
>
>         origin = [ -63.5, -63.5, -63.5 ]
>
>         sizeOutput = [ 128, 128, 128 ]
>
>         constantImageSource2.SetOrigin( origin )
>
>         constantImageSource2.SetSpacing( [1, 1, 1] )
>
>         constantImageSource2.SetSize( sizeOutput )
>
>         constantImageSource2.SetConstant(0.0)
>
>         source2 = constantImageSource2.GetOutput()
>
>
>
>         print("Performing reconstruction")
>
>         feldkamp = rtk.FDKConeBeamReconstructionFilter[TImageType].New()
>
>         feldkamp.SetGeometry( geometry )
>
>         feldkamp.SetInput(0, source2)
>
>         feldkamp.SetInput(1, reiImage)
>
>         image = feldkamp.GetOutput()
>
>
>
>         print("Masking field-of-view")
>
>         fov = rtk.FieldOfViewImageFilter[TImageType, TImageType].New()
>
>         fov.SetGeometry(geometry)
>
>         fov.SetProjectionsStack(reiImage)
>
>         fov.SetInput(image)
>
>         image = fov.GetOutput()
>
>
>
>         writer = itk.ImageFileWriter[TImageType].New()
>
>         writer.SetFileName ( fileOUT )
>
>         writer.SetInput(image)
>
>         writer.Update()
>
>
>
> I cannot run this script. It generates a criptic segfault… What am I doing
> wrong here?
>
> If one of you RTK gurus  could help me, I would greatly appreciate it!
>
>
>
> Thanks,
>
>
>
> Pierre
>
> Disclaimer | Use of IBA e-communication
> <https://iba-worldwide.com/disclaimer>
>
> The contents of this e-mail message and any attachments are intended
> solely for the recipient (s) named above. This communication is intended to
> be and to remain confidential and may be protected by intellectual property
> rights. Any use of the information contained herein (including but not
> limited to, total or partial reproduction, communication or distribution of
> any form) by persons other than the designated recipient(s) is prohibited.
> Please notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system. E-mail
> transmission cannot be guaranteed to be secure or error-free. Ion Beam
> Applications does not accept liability for any such errors. Thank you for
> your cooperation.
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> https://public.kitware.com/mailman/listinfo/rtk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/rtk-users/attachments/20190219/d09350da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: daye.py
Type: text/x-python
Size: 3703 bytes
Desc: not available
URL: <https://public.kitware.com/pipermail/rtk-users/attachments/20190219/d09350da/attachment.py>


More information about the Rtk-users mailing list