question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'itk' has no attribute 'BinShrinkImageFilter'

See original GitHub issue

When displaying large images I get the error bellow. I can set size_limit_2d large enough to avoid downsampling as a workaround.

This is from a relatively bare docker container. I installed with pip install itkwidgets. To my knowledge no other packages requires itk. import itk;itk.Version.GetITKVersion() yields 4.13.0.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-26-4c0603b3ae2d> in <module>
----> 1 view(pixels,annotations=False, ui_collapsed=True, cmap=cm.grayscale)

/usr/local/lib/python3.6/dist-packages/itkwidgets/widget_viewer.py in view(image, ui_collapsed, annotations, interpolation, cmap, mode, shadow, slicing_planes, gradient_opacity, **kwargs)
    436             annotations=annotations, interpolation=interpolation, cmap=cmap,
    437             mode=mode, shadow=shadow, slicing_planes=slicing_planes,
--> 438             gradient_opacity=gradient_opacity, **kwargs)
    439     return viewer

/usr/local/lib/python3.6/dist-packages/itkwidgets/widget_viewer.py in __init__(self, **kwargs)
    225             self.extractor = itk.ExtractImageFilter.New(self.image)
    226             self.extractor.InPlaceOn()
--> 227             self.shrinker = itk.BinShrinkImageFilter.New(self.extractor)
    228         self._update_rendered_image()
    229         if self._downsampling:

/usr/local/lib/python3.6/dist-packages/itkLazy.py in __getattribute__(self, attr)
     38 
     39     def __getattribute__(self, attr):
---> 40         value = types.ModuleType.__getattribute__(self, attr)
     41         if value is not_loaded:
     42             module = self.__belong_lazy_attributes[attr]

AttributeError: module 'itk' has no attribute 'BinShrinkImageFilter'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jpambruncommented, Dec 5, 2018

Manually installing itk with pip install itk fixed it. import itk;itk.Version.GetITKVersion() still yields ‘4.13.0’, but now itk.BinShrinkImageFilter is available.

0reactions
thewtexcommented, Dec 5, 2018

Probably because itk-core in setup.py is not enough.

@jpambrun great catch! 🦅 Would you mind creating a PR to add itk-filtering to setup.py?

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'itk' has no attribute 'BinShrinkImageFilter' #118 - GitHub
I installed with pip install itkwidgets . To my knowledge no other packages requires itk. import itk;itk.Version.GetITKVersion() yields 4.13.0 .
Read more >
AttributeError: module 'itk' has no attribute ... - ITK Discourse
I have install through pip ITK 5.2 into an anaconda virtual environment running python 3.8.
Read more >
Python error: module 'itk' has no attribute 'ParameterObject'
If you are building ITK from source, you need to build ITKElastix from source and point to the main ITK build.
Read more >
itk::simple::BinShrinkImageFilter Class Reference - SimpleITK
Reduce the size of an image by an integer factor in each dimension while performing averaging of an input neighborhood. ... This filter...
Read more >
simvascular.stanford.edu/downloads/public/simvascu...
Version 3.0.12 # # Do not make changes to this file unless you know what you are ... raise AttributeError("'%s' object has no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found