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

ConstImageTypeX cannot be deduced from ImageTypeX #23

Open
2 tasks
DrLutzi opened this issue Jan 14, 2019 · 0 comments
Open
2 tasks

ConstImageTypeX cannot be deduced from ImageTypeX #23

DrLutzi opened this issue Jan 14, 2019 · 0 comments

Comments

@DrLutzi
Copy link
Contributor

DrLutzi commented Jan 14, 2019

The following is only a minor inconvenience, and I have provided a workaround on the bottom of the issue.

Probably because of how itk works, the types for images are not the same between their non-const and const version, so instead of using const ImageX, we use ConstImageX. The current problem with this syntax is that the const version of an image cannot be deduced, which can enforce the use of several redundant template members.

Example: in the following code, I want to make a itk filter that inputs an image using an ASTex Image type as a template. The following is perfectly fine:

template<typename TInput> class FilterGetisGI : public itk::ImageToImageFilter<typename TInput::ItkImg, typename TInput::ItkImg>

But it enforces that TInput is a non ConstImageType, because the output of the filter is necessarily non ConstImageType as well. I would like to use something like:

template<typename TNonConstImage> class FilterGetisGI : public itk::ImageToImageFilter<typename TConstImage::ItkImg (?), typename TNonConstImage::ItkImg>

but it is not currently possible to deduce the Const version of an image from its NonConst version. A current workaround is to use something like:

template<typename TNonConstImage, TConstImage> class FilterGetisGI : public itk::ImageToImageFilter<typename TConstImage::ItkImg, typename TNonConstImage::ItkImg>

which forces the user to provide the Const version of the image type with the NonConst.

  • Add a way to deduce const image types from non const image types
  • Add a way to deduce non const image types from const image types
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

1 participant