[Rtk-users] Error in the FFTRampImpageFilter

Jerome Lesaint lesaint.jerome at gmail.com
Mon May 18 17:44:52 EDT 2020


Hi Simon,

sorry for disturbing again.
I've updated my repo and compiled again. It fails with the above message :

*/Users/jerome/src/ITK/Modules/Remote/RTK/src/rtkBioscanGeometryReader.cxx:26:10:
**fatal error: **'gdcmImageReader.h' file not found*

#include <gdcmImageReader.h>

*         ^~~~~~~~~~~~~~~~~~~*

1 error generated.

make[2]: ***
[Modules/Remote/RTK/src/CMakeFiles/RTK.dir/rtkBioscanGeometryReader.cxx.o]
Error 1

make[2]: *** Waiting for unfinished jobs....

Any idea ?
I guess I need to turn some option(s) in cmake, to get the gdcm module ?

Note that I also installed the binary python package you sent in previous
mail. The installation and the import are OK. But the python command

const = rtk.ConstantImageSource[itk.Image[itk.F,3]].New()

output fails with :

itkImageToImageFilterIUL2IUL2 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL2IUL2'

itkImageToImageFilterIUL3IUL3 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL3IUL3'

itkImageToImageFilterIUL2IF2 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL2IF2'

itkImageToImageFilterIUL3IF3 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL3IF3'

itkImageToImageFilterIUL2ID2 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL2ID2'

itkImageToImageFilterIUL3ID3 not loaded from module ITKCommon because of
exception:

 module 'ITKCommonPython' has no attribute 'itkImageToImageFilterIUL3ID3'

stdnumeric_limitsULL not loaded from module ITKCommon because of exception:

 module 'ITKCommonPython' has no attribute 'stdnumeric_limitsULL'

itkNumericTraitsULL not loaded from module ITKCommon because of exception:

 module 'ITKCommonPython' has no attribute 'itkNumericTraitsULL'

Template itk::PyBuffer<itk::Image<itk::Vector<double,2>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD22'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD22'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,2>,2>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,2>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD22'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD22'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,2>,2>>'

Template itk::PyBuffer<itk::Image<itk::Vector<double,3>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD32'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD32'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,3>,2>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,3>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD32'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD32'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,3>,2>>'

Template itk::PyBuffer<itk::Image<itk::Vector<double,4>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD42'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD42'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,4>,2>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,4>,2>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD42'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD42'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,4>,2>>'

Template itk::PyBuffer<itk::Image<itk::Vector<double,2>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD23'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD23'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,2>,3>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,2>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD23'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD23'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,2>,3>>'

Template itk::PyBuffer<itk::Image<itk::Vector<double,3>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD33'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD33'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,3>,3>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,3>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD33'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD33'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,3>,3>>'

Template itk::PyBuffer<itk::Image<itk::Vector<double,4>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferIVD43'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferIVD43'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::Vector<double,4>,3>>'

Template itk::PyBuffer<itk::Image<itk::CovariantVector<double,4>,3>>

 already defined as <class 'itkPyBufferPython.itkPyBufferICVD43'>

 is redefined as <class 'itkPyBufferPython.itkPyBufferICVD43'>

Warning: template already defined
'itk::PyBuffer<itk::Image<itk::CovariantVector<double,4>,3>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<signedchar,2>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2ISC2'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2ISC2'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<signedchar,2>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<signedchar,3>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3ISC3'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3ISC3'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<signedchar,3>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<signedshort,2>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2ISS2'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2ISS2'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<signedshort,2>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<signedshort,3>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3ISS3'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3ISS3'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<signedshort,3>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedchar,2>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IUC2'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IUC2'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedchar,2>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedchar,3>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IUC3'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IUC3'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedchar,3>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedlonglong,2>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IULL2'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IULL2'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedlonglong,2>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedlonglong,3>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IULL3'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IULL3'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedlonglong,3>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedshort,2>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IUS2'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL2IUS2'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,2>,itk::Image<unsignedshort,2>>'

Template
itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedshort,3>>

 already defined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IUS3'>

 is redefined as <class
'itkCastImageFilterPython.itkCastImageFilterIULL3IUS3'>

Warning: template already defined
'itk::CastImageFilter<itk::Image<unsignedlonglong,3>,itk::Image<unsignedshort,3>>'

itkRegularSphereMeshSourceMF2 not loaded from module ITKMesh because of
exception:

 module 'ITKMeshPython' has no attribute 'itkRegularSphereMeshSourceMF2'

itkRegularSphereMeshSourceMD2 not loaded from module ITKMesh because of
exception:

 module 'ITKMeshPython' has no attribute 'itkRegularSphereMeshSourceMD2'

itkRegularSphereMeshSourceMF3 not loaded from module ITKMesh because of
exception:

 module 'ITKMeshPython' has no attribute 'itkRegularSphereMeshSourceMF3'

itkRegularSphereMeshSourceMD3 not loaded from module ITKMesh because of
exception:

 module 'ITKMeshPython' has no attribute 'itkRegularSphereMeshSourceMD3'

itkSphereMeshSourceMF2 not loaded from module ITKMesh because of exception:

 module 'ITKMeshPython' has no attribute 'itkSphereMeshSourceMF2'

itkSphereMeshSourceMD2 not loaded from module ITKMesh because of exception:

 module 'ITKMeshPython' has no attribute 'itkSphereMeshSourceMD2'

itkSphereMeshSourceMF3 not loaded from module ITKMesh because of exception:

 module 'ITKMeshPython' has no attribute 'itkSphereMeshSourceMF3'

itkSphereMeshSourceMD3 not loaded from module ITKMesh because of exception:

 module 'ITKMeshPython' has no attribute 'itkSphereMeshSourceMD3'

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-4-718abe43581a> in <module>

----> 1 const = rtk.ConstantImageSource[itk.Image[itk.F,3]].New()


~/src/ITK-build/Wrapping/Generators/Python/itkLazy.py in __getattribute__(self,
attr)

*     50*             module = self.__belong_lazy_attributes[attr]

*     51*             namespace = {}

---> 52             itkBase.LoadModule(module, namespace)

*     53*             self.loaded_lazy_modules.add(module)

*     54*             for k, v in namespace.items():


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*     81*         deps = sorted(data['depends'])

*     82*         for dep in deps:

---> 83             LoadModule(dep, namespace)

*     84*

*     85*     if itkConfig.ImportCallback:


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*     81*         deps = sorted(data['depends'])

*     82*         for dep in deps:

---> 83             LoadModule(dep, namespace)

*     84*

*     85*     if itkConfig.ImportCallback:


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*     81*         deps = sorted(data['depends'])

*     82*         for dep in deps:

---> 83             LoadModule(dep, namespace)

*     84*

*     85*     if itkConfig.ImportCallback:


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*     81*         deps = sorted(data['depends'])

*     82*         for dep in deps:

---> 83             LoadModule(dep, namespace)

*     84*

*     85*     if itkConfig.ImportCallback:


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*     81*         deps = sorted(data['depends'])

*     82*         for dep in deps:

---> 83             LoadModule(dep, namespace)

*     84*

*     85*     if itkConfig.ImportCallback:


~/src/ITK-build/Wrapping/Generators/Python/itkBase.py in LoadModule(name,
namespace)

*    171*         if 'snake_case_functions' in data:

*    172*             for snakeCaseFunction in data['snake_case_functions']:

--> 173                 namespace[snakeCaseFunction] = getattr(module,
snakeCaseFunction)

*    174*                 init_name = snakeCaseFunction + "_init_docstring"

*    175*                 init_function = getattr(module, init_name)


AttributeError: module 'ITKMeshPython' has no attribute
'regular_sphere_mesh_source'


Thanks for your help,
Jérome

Le mer. 13 mai 2020 à 01:07, Simon Rit <simon.rit at creatis.insa-lyon.fr> a
écrit :

> Thanks. This was a multi-threading problem which is now fixed by
> processing each projection at a time within a thread:
>
> https://github.com/SimonRit/RTK/commit/a719d8913beb7bé6a39da787980ead720b353f545
> <https://github.com/SimonRit/RTK/commit/a719d8913beb7b6a39da787980ead720b353f545>
> I don't really understand the number you gave but they should depend on
> the number of threads used by ITK. Normally, ITK splits the last dimension
> (here the number of projections) in almost equal pieces for each thread. So
> the last dimension of the processed region will depend on this...
>
> On Sat, May 9, 2020 at 11:08 AM Jerome Lesaint <lesaint.jerome at gmail.com>
> wrote:
>
>> See the code below.
>>
>> I gave you a wrong information. Sorry. My stack has 720 projections and
>> not 360. It actually works fine with 360. But fails with 720 !!
>> After a few trials, the behavior is really strange. It works with 13, 17,
>> 23, 300, 301, 360, 361, 480. But it fails with 400 (13), 401 (13), 540
>> (17), 720 (23), 721 (23). In parentheses, the number which triggers the
>> error (no 2s, 3s 5s in the prime decomp).
>>
>> Jérome
>>
>>
>> -------------------------------------------------------------------
>> sid = 500
>> sdd = 1000
>>
>> spacing = 1
>> nb_pixels = int(257/spacing)
>> nb_pixels_u = nb_pixels
>> nb_pixels_v = nb_pixels_u
>>
>> geo_0 = rtk.ThreeDCircularProjectionGeometry.New()
>> for i in range(nprojs_0) :
>>     geo_0.AddProjection(sid,sdd,i)
>>
>> ImageType = itk.Image[itk.F, 3]
>> const = rtk.ConstantImageSource[ImageType].New()
>> const.SetConstant(0.)
>> const.SetSpacing([spacing,spacing,spacing])
>> const.SetSize([nb_pixels_u,nb_pixels_v,len(geo_0.GetGantryAngles())])
>> const.SetOrigin(-0.5*spacing*(np.array(const.GetSize())-1))
>> sl = rtk.SheppLoganPhantomFilter[ImageType,ImageType].New()
>> sl.SetInput(const.GetOutput())
>> sl.SetGeometry(geo_0)
>> sl.SetPhantomScale(60)
>>
>> sl.Update()
>>
>> #weights = rtk.FDKWeightProjectionFilter[ImageType].New()
>> #weights.SetGeometry(geo_0)
>> #weights.SetInput(sl.GetOutput())
>> #weights.SetNumberOfWorkUnits(1)
>> #weights.InPlaceOff()
>>
>> ramp = rtk.FFTRampImageFilter[ImageType,ImageType,itk.D].New()
>> ramp.SetInput(sl.GetOutput())
>> ramp.Update()
>>
>>
>> Le ven. 8 mai 2020 à 22:15, Simon Rit <simon.rit at creatis.insa-lyon.fr> a
>> écrit :
>>
>>> Hi,
>>> I cannot reproduce the issue with this code
>>>
>>> import itk
>>> from itk import RTK as rtk
>>>
>>> ImageType = itk.Image[itk.F,3]
>>>
>>> constantImageSource = rtk.ConstantImageSource[ImageType].New()
>>> constantImageSource.SetOrigin( [ -127.875, -127.875, 0. ] )
>>> constantImageSource.SetSpacing( [ .25 ] *3 )
>>> constantImageSource.SetSize( [ 1024, 512, 360 ] )
>>> constantImageSource.SetConstant(1.)
>>>
>>> ramp = rtk.FFTRampImageFilter[ImageType, ImageType, itk.D].New()
>>> ramp.SetInput(constantImageSource.GetOutput())
>>> ramp.Update()
>>>
>>> Can you tell me more on the pipeline you're using?
>>> Simon
>>>
>>> On Fri, May 8, 2020 at 9:36 AM Jerome Lesaint <lesaint.jerome at gmail.com>
>>> wrote:
>>>
>>>> Salut,
>>>>
>>>> thanks again for the answer. The streaming workaround seems to work.
>>>> As for the second solution you mentioned : actually there are 360
>>>> projections in my stack (not 23). 360 has only 2s, 3s and 5s in its prime
>>>> decomp. Of course, 23 does not. But where this 23 comes form ???
>>>>
>>>> Anyway, it works fine now. Thank you.
>>>> Jérome
>>>>
>>>>
>>>> Le jeu. 7 mai 2020 à 20:48, Simon Rit <simon.rit at creatis.insa-lyon.fr>
>>>> a écrit :
>>>>
>>>>> Hi,
>>>>> Nope, sorry. We can't distribute the package with FFTW because its
>>>>> license does not allow it. What you can do is put an
>>>>> itkStreamingImageFilter after the fft ramp to process one projection at a
>>>>> time. Or add one empty projection after you 23d.
>>>>> Let me know if we can help with one of the two options.
>>>>> Simon
>>>>>
>>>>> On Thu, May 7, 2020 at 7:24 PM Jerome Lesaint <
>>>>> lesaint.jerome at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to use the ramp filter FFTRampImageFilter and it fails at
>>>>>> Update time with the error message :
>>>>>>
>>>>>> itk::ERROR:
>>>>>> VnlRealToHalfHermitianForwardFFTImageFilter(00000230EC986BA0): Cannot
>>>>>> compute FFT of image with size [1024, 512, 23].
>>>>>> VnlRealToHalfHermitianForwardFFTImageFilter operates only on images whose
>>>>>> size in each dimension has a prime factorization consisting of only 2s, 3s,
>>>>>> or 5s.
>>>>>>
>>>>>> I already read Simon's answer to a previous similar issue, saying
>>>>>> that he recommends using FFTW by turning ITK_USE_FFTW when building
>>>>>> ITK. But I did not compile ITK (on this computer). I simply installed the
>>>>>> pre-compiled Python package.
>>>>>> My question : can I turn any parameter in Python to force the ramp
>>>>>> filter to use this library ?
>>>>>>
>>>>>> Thanks in advance for your help,
>>>>>>
>>>>>> Jérome
>>>>>> _______________________________________________
>>>>>> 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/20200518/33e724c7/attachment-0001.html>


More information about the Rtk-users mailing list