Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running example in binder: itk.ShrinkImageFilter is not wrapped for input type None #21

Open
jcfr opened this issue Aug 10, 2020 · 0 comments
Assignees

Comments

@jcfr
Copy link
Contributor

jcfr commented Aug 10, 2020

Step to reproduce

  1. Open https://mybinder.org/v2/gh/InsightSoftwareConsortium/ITKColorNormalization/8b61138b70d780763c3aeac909c27a3026887d2e

  2. Go to examples and open the notebook

  3. Menu Cell -> Run All

Execution of cell with view(input_image) returns the following error:

---------------------------------------------------------------------------
TemplateTypeError                         Traceback (most recent call last)
<ipython-input-5-4c9c2af28ff6> in <module>
----> 1 view(input_image)

/srv/conda/envs/notebook/lib/python3.7/site-packages/itkwidgets/widget_viewer.py in view(image, label_image, label_image_names, label_image_weights, label_image_blend, cmap, lut, select_roi, interpolation, gradient_opacity, opacity_gaussians, channels, slicing_planes, shadow, blend_mode, point_sets, point_set_colors, point_set_opacities, point_set_representations, point_set_sizes, geometries, geometry_colors, geometry_opacities, ui_collapsed, rotate, annotations, axes, mode, **kwargs)
   1084                     rotate=rotate, ui_collapsed=ui_collapsed,
   1085                     annotations=annotations, axes=axes, mode=mode,
-> 1086                     **kwargs)
   1087     return viewer

/srv/conda/envs/notebook/lib/python3.7/site-packages/itkwidgets/widget_viewer.py in __init__(self, **kwargs)
    408                 if size[dim] > self.size_limit_3d[dim]:
    409                     self._downsampling = True
--> 410         self._update_rendered_image()
    411         if self._downsampling:
    412             self.observe(self._on_roi_changed, ['roi'])

/srv/conda/envs/notebook/lib/python3.7/site-packages/itkwidgets/widget_viewer.py in _update_rendered_image(self)
    488             if self.image:
    489                 self.extractor = itk.ExtractImageFilter.New(self.image)
--> 490                 self.shrinker = itk.ShrinkImageFilter.New(self.extractor)
    491                 self.shrinker.SetShrinkFactors(scale_factors[:dimension])
    492             if self.label_image:

/srv/conda/envs/notebook/lib/python3.7/site-packages/itkTemplate.py in New(self, *args, **kwargs)
    522 or via one of the following keyword arguments: %s""" % ", ".join(primary_input_methods))
    523             else:
--> 524                 raise TemplateTypeError(self, input_type)
    525         return self[list(keys)[0]].New(*args, **kwargs)
    526 

TemplateTypeError: itk.ShrinkImageFilter is not wrapped for input type `None`.

To limit the size of the package, only a limited number of
types are available in ITK Python. To print the supported
types, run the following command in your python environment:

    itk.ShrinkImageFilter.GetTypes()

Possible solutions:
* If you are an application user:
** Convert your input image into a supported format (see below).
** Contact developer to report the issue.
* If you are an application developer, force input images to be
loaded in a supported pixel type.

    e.g.: instance = itk.ShrinkImageFilter[itk.Image[itk.SS,2], itk.Image[itk.SS,2]].New(my_input)

* (Advanced) If you are an application developer, build ITK Python yourself and
turned to `ON` the corresponding CMake option to wrap the pixel type or image
dimension you need. When configuring ITK with CMake, you can set
`ITK_WRAP_${type}` (replace ${type} with appropriate pixel type such as
`double`). If you need to support images with 4 or 5 dimensions, you can add
these dimensions to the list of dimensions in the CMake variable
`ITK_WRAP_IMAGE_DIMS`.

Supported input types:

itk.Image[itk.SS,2]
itk.Image[itk.SS,3]
itk.Image[itk.UC,2]
itk.Image[itk.UC,3]
itk.Image[itk.US,2]
itk.Image[itk.US,3]
itk.Image[itk.F,2]
itk.Image[itk.F,3]
itk.Image[itk.D,2]
itk.Image[itk.D,3]
@thewtex thewtex self-assigned this Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants