You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: