[Rtk-users] WaterPreCorrectionFilter Example - Python

Simon Rit simon.rit at creatis.insa-lyon.fr
Thu Jul 25 08:45:21 CEST 2019


Hi,
Apologies for not working on this before. I have updated the wiki page with
the code adapted to the new wrapping. Look at the diff between the 2
versions to see the necessary modifications with the new wrappings.
I hope this (still) helps,
Simon

On Wed, Feb 13, 2019 at 8:03 AM Amarnath S <amarnaths161 at gmail.com> wrote:

> Hi,
>
>      Thanks for creating the Python version of RTK, and enabling us to get
> it via pip. I downloaded it yesterday, and successfully ran the First
> Reconstruction Python example.
>
>      Am now trying to convert the WaterPreCorrection example, which was
> earlier available using Simple RTK, on this page
> http://wiki.openrtk.org/index.php/WaterPreCorrection
>
>     Am using the same dataset for this, as available in the archive
> "beam_hardening.tgz" available on the same page. However, am getting an
> error while running my code.
>
> Have created a minimal code in Python, for getting the error, and it is
> given here.
>
> import sys
> import itk
> from itk import RTK as rtk
> import glob
> import os
>
> # Script parameter
> dir = "F:\\RTKDir\\output\\"
>
> # List of filenames
> fileNames = []
> for file in os.listdir(dir):
>     if file.startswith("attenuation") and file.endswith(".mha"):
>         fileNames.append(dir + file)
>
> projReader = rtk.ProjectionsReader.New()
> projReader.SetFileNames(fileNames)
> print("Filenames set")
>
> waterPre = rtk.WaterPrecorrectionImageFilter.New();
> wpcoeffs = [0, 0, 0, 0, 0, 0, 1]
> print("Water Pre defined")
>
> waterPre.SetCoefficients(wpcoeffs)
> waterPre.SetInput(projReader.GetOutput())
> print("Gives error on the above line - Expecting argument of type
> itkImageF3 or itkImageSourceIF3")
>
> It gives error for the line where we set the input to waterPre, the
> last-but-one line of this script -
> waterPre.SetInput(projReader.GetOutput()). The error message is TypeError:
> Expecting argument of type itkImageF3 or itkImageSourceIF3.  As far as I
> know, I have replicated the code from the example available for SimpleRTK.
> Note, I have created a folder called F:\RTKDir\, which has the contents of
> the archive "beam_hardening.tgz" have been extracted there.
>
> So, my questions are:
> 1. Have the input types been changed for the WaterPreCorrection Filter,
> since the posting of the earlier example?
> 2. If so, how can I specify projections as read in from 360 files as
> inputs to this filter?
>
> Any pointers in this regard will be greatly appreciated.
>
> Thanks and Regards
> - Amarnath
>
> _______________________________________________
> 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: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20190725/e913793d/attachment.htm>


More information about the Rtk-users mailing list