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

Development build problems #1130

Open
melrobin opened this issue Aug 1, 2019 · 2 comments

Comments

@melrobin
Copy link

commented Aug 1, 2019

Description

Development ITK fails to build for me. There are numerous errors of this sort:
/home/melrobin/packages/ITK/Modules/Filtering/ImageFilterBase/include/itkCastImageFilter.hxx:93:73: required from ‘void itk::CastImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(const OutputImageRegionType&) [with TInputImage = itk::Image<itk::RGBPixel >; TOutputImage = itk::Image<itk::Vector<float, 3> >; itk::CastImageFilter<TInputImage, TOutputImage>::OutputImageRegionType = itk::ImageRegion<2>]’
/home/melrobin/packages/ITK/Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx:53:21: required from here
/home/melrobin/packages/ITK/Modules/Core/Common/include/itkMetaProgrammingLibrary.h:183:36: error: no matching function for call to ‘itk::Vector<float, 3>::Vector(itk::RGBPixel)’
decltype(static_cast(std::declval()))>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Steps to Reproduce

The error comes when building this object:
Building CXX object Modules/Filtering/ImageFilterBase/test/CMakeFiles/ITKImageFilterBaseTestDriver.dir/itkCastImageFilterTest.cxx.o

Expected behavior

Completed build

Actual behavior

Build Error

Reproducibility

Versions

Development

Environment

Fedora 29, gcc 8.3.1

Additional Information

@melrobin melrobin added the type:Bug label Aug 1, 2019

@issakomi

This comment has been minimized.

Copy link
Member

commented Aug 4, 2019

FYI, one my old module fails to build with current master branch too, many errors like that:

itkMetaProgrammingLibrary.h:183:36: error:
no matching function for call to
‘itk::Vector<float, 3>::Vector(itk::RGBPixel<float>)’
decltype(static_cast<TToType>(std::declval<TFromType>()))>
Modules/Core/Common/include/itkMetaProgrammingLibrary.h:183:36: error:
no matching function for call to
‘itk::Vector<float, 3>::Vector(itk::RGBPixel<short int>)’
decltype(static_cast<TToType>(std::declval<TFromType>()))>
Modules/Core/Common/include/itkImageAlgorithm.hxx:45:17: error:
no matching function for call to
‘itk::Vector<float, 3>::Vector(itk::ImageConstIterator<itk::Image<itk::RGBPixel<short int>, 3> >::PixelType)’
ot.Set( static_cast< typename OutputImageType::PixelType >( it.Get() ) );

Best regards

Edit May be after this commit, not tested, not sure Add Vector constructor from C arrays with cast

Edit 2 Errors are from usage of itk::VectorGradientMagnitudeImageFilter<T1, float, T2> with RGB type images

Edit 3 Min. example

#include "itkImage.h"
#include "itkVectorImage.h"
#include "itkSliceBySliceImageFilter.h"
#include "itkVectorGradientMagnitudeImageFilter.h"
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
#include <iostream>

typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType,3> RGBImageTypeUC;
typedef itk::Image<RGBPixelType,2> RGBImage2DTypeUC;
typedef itk::Image<float,3> ImageTypeF;
typedef itk::Image<float,2> Image2DTypeF;
typedef itk::ImageFileReader<RGBImageTypeUC> ReaderType;
typedef itk::ImageFileWriter<ImageTypeF> WriterType;

template<typename T, typename T2D>
bool gradientmagn_rgb_sbs(
  const typename T::Pointer & image,
  typename ImageTypeF::Pointer & out_image)
{
  if (image.IsNull()) return false;
  typedef itk::VectorGradientMagnitudeImageFilter<T2D,float,Image2DTypeF>
    VectorGradientMagnitudeImageFilterType;
  typedef  itk::SliceBySliceImageFilter<T,ImageTypeF>
  SliceBySliceType;
  typename VectorGradientMagnitudeImageFilterType::Pointer filter =
    VectorGradientMagnitudeImageFilterType::New();
  typename SliceBySliceType::Pointer slicebyslice =
    SliceBySliceType::New();
  try
  {
    slicebyslice->SetFilter(filter);
    slicebyslice->SetInput(image);
    slicebyslice->Update();
    out_image = slicebyslice->GetOutput();
  }
  catch (itk::ExceptionObject & ex)
  {
    std::cout << ex.GetDescription() << std::endl;
    return false;
  }
  if (out_image.IsNotNull())
  {
    out_image->DisconnectPipeline();
  }
  else
  {
    return false;
  }
  return true;
}

int main(int argc, char ** argv)
{
  if (argc < 2)
  {
    std::cout << "Input RGB image is required" << std::endl;
    return 0;
  }
  ReaderType::Pointer reader = ReaderType::New();
  try
  {
    reader->SetFileName(argv[1]);
    reader->Update();
  }
  catch (itk::ExceptionObject & ex)
  {
    std::cout << ex.GetDescription() << std::endl;
    return 1;
  }
  RGBImageTypeUC::Pointer image = reader->GetOutput();
  ImageTypeF::Pointer out_image;
  bool ok = gradientmagn_rgb_sbs<RGBImageTypeUC,RGBImage2DTypeUC>(
    image, out_image);
  if (!ok)
  {
    return 1;
  }
  WriterType::Pointer writer = WriterType::New();
  try
  {
    writer->SetFileName("out.mha");
    writer->SetInput(out_image);
    writer->Update();
  }
  catch (itk::ExceptionObject & ex)
  {
    std::cout << ex.GetDescription() << std::endl;
    return 1;
  }
  std::cout << "... OK" << std::endl;
  return 0;
}

@thewtex thewtex added this to the ITK v5.0.2 milestone Aug 14, 2019

@blowekamp

This comment has been minimized.

Copy link
Member

commented Aug 22, 2019

I have been able to reproduce the issue on centos 7.6 with gcc8 from the devtoolset-8-toolchain package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.