Skip to content

Commit

Permalink
COMP: Fix -fpermissive error in StrainWindowBlockAffineTransformCommand
Browse files Browse the repository at this point in the history
This commit fixes the following error reported when building
SlicerITKUltrasound extension againg Slicer 4.13 and ITK 5.3:

  In file included from /path/to/SlicerITKUltrasound-Release/ITKUltrasound/include/itkBlockMatchingStrainWindowBlockAffineTransformCommand.h:105,
                   from /path/to/SlicerITKUltrasound/GenerateDisplacementFromTimeSeries/GenerateDisplacementFromTimeSeries.cxx:38:
  /path/to/SlicerITKUltrasound-Release/ITKUltrasound/include/itkBlockMatchingStrainWindowBlockAffineTransformCommand.hxx: In instantiation of ‘void itk::BlockMatching::StrainWindowBlockAffineTransformCommand<TStrainWindowDisplacemenCalculator, TBlockAffineTransformMetricImageFilter, TStrainImageFilter>::Execute(const itk::Object*, const itk::EventObject&) [with TStrainWindowDisplacemenCalculator = itk::BlockMatching::StrainWindowDisplacementCalculator<itk::Image<float, 2>, itk::Image<itk::Vector<float, 2>, 2>, float>; TBlockAffineTransformMetricImageFilter = itk::BlockMatching::BlockAffineTransformMetricImageFilter<itk::Image<unsigned char, 2>, itk::Image<unsigned char, 2>, itk::Image<float, 2>, float>; TStrainImageFilter = itk::StrainImageFilter<itk::Image<itk::Vector<float, 2>, 2>, float, float>]’:
  /path/to/SlicerITKUltrasound-Release/ITKUltrasound/include/itkBlockMatchingStrainWindowBlockAffineTransformCommand.hxx:49:1:   required from here
  /path/to/SlicerITKUltrasound-Release/ITKUltrasound/include/itkBlockMatchingStrainWindowBlockAffineTransformCommand.hxx:73:5: error: invalid conversion from ‘const OutputImageType*’ {aka ‘const itk::Image<itk::SymmetricSecondRankTensor<float, 2>, 2>*’} to ‘itk::BlockMatching::BlockAffineTransformMetricImageFilter<itk::Image<unsigned char, 2>, itk::Image<unsigned char, 2>, itk::Image<float, 2>, float>::StrainImageType*’ {aka ‘itk::Image<itk::SymmetricSecondRankTensor<float, 2>, 2>*’} [-fpermissive]
     73 |     m_BlockAffineTransformMetricImageFilter->SetStrainImage(strainWindower->GetStrainImageFilter()->GetOutput());
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |     |
        |     const OutputImageType* {aka const itk::Image<itk::SymmetricSecondRankTensor<float, 2>, 2>*}
  In file included from /path/to/Slicer-Release/ITK/Modules/IO/ImageBase/include/itkImageFileReaderException.h:22,
                   from /path/to/Slicer-Release/ITK/Modules/IO/ImageBase/include/itkImageFileReader.h:20,
                   from /path/to/SlicerITKUltrasound/GenerateDisplacementFromTimeSeries/GenerateDisplacementFromTimeSeries.cxx:19:
  /path/to/Slicer-Release/ITK/Modules/Core/Common/include/itkMacro.h:1097:33: note:   initializing argument 1 of ‘void itk::BlockMatching::BlockAffineTransformMetricImageFilter<TFixedImage, TMovingImage, TMetricImage, TStrainValueType>::SetStrainImage(itk::BlockMatching::BlockAffineTransformMetricImageFilter<TFixedImage, TMovingImage, TMetricImage, TStrainValueType>::StrainImageType*) [with TFixedImage = itk::Image<unsigned char, 2>; TMovingImage = itk::Image<unsigned char, 2>; TMetricImage = itk::Image<float, 2>; TStrainValueType = float; itk::BlockMatching::BlockAffineTransformMetricImageFilter<TFixedImage, TMovingImage, TMetricImage, TStrainValueType>::StrainImageType = itk::Image<itk::SymmetricSecondRankTensor<float, 2>, 2>]’
   1097 |   virtual void Set##name(type * _arg)                  \
  /path/to/SlicerITKUltrasound-Release/ITKUltrasound/include/itkBlockMatchingBlockAffineTransformMetricImageFilter.h:104:3: note: in expansion of macro ‘itkSetObjectMacro’
    104 |   itkSetObjectMacro(StrainImage, StrainImageType);
        |   ^~~~~~~~~~~~~~~~~
  • Loading branch information
jcfr committed Apr 27, 2022
1 parent 4390a23 commit 265d190
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ StrainWindowBlockAffineTransformCommand<TStrainWindowDisplacemenCalculator,

if (m_UseStrainWindowStrain)
{
m_BlockAffineTransformMetricImageFilter->SetStrainImage(strainWindower->GetStrainImageFilter()->GetOutput());
m_BlockAffineTransformMetricImageFilter->SetStrainImage(
const_cast<typename BlockAffineTransformMetricImageFilterType::StrainImageType *>(strainWindower->GetStrainImageFilter()->GetOutput()));
}
else
{
m_StrainImageFilter->SetInput(strainWindower->GetStrainImageFilter()->GetInput());
m_StrainImageFilter->Update();
m_BlockAffineTransformMetricImageFilter->SetStrainImage(m_StrainImageFilter->GetOutput());
m_BlockAffineTransformMetricImageFilter->SetStrainImage(
const_cast<typename BlockAffineTransformMetricImageFilterType::StrainImageType *>(m_StrainImageFilter->GetOutput()));
}
}

Expand Down

0 comments on commit 265d190

Please sign in to comment.