stnava
(stnava)
June 8, 2022, 4:55pm
1
just trying to update some code for more recent itk version (latest release)
Type definitions:
typedef double RealType;
Rcpp::NumericVector axis( r_axis );
Rcpp::NumericVector axis2( r_axis2 );
Rcpp::NumericVector doReflection( r_reflect );
Rcpp::NumericVector doScale( r_scale );
typedef itk::Image< float , ImageDimension > ImageType;
if( image1.IsNotNull() )
{
typedef typename itk::ImageMomentsCalculator<ImageType> ImageCalculatorType;
typedef itk::AffineTransform<RealType, ImageDimension> AffineType;
typedef typename ImageCalculatorType::MatrixType MatrixType;
typedef itk::Vector<float, ImageDimension> VectorType;
VectorType ccg1;
VectorType cpm1;
MatrixType cpa1;
MatrixType cpa2;
typename ImageCalculatorType::Pointer calculator1 =
ImageCalculatorType::New();
calculator1->SetImage( image1 );
typename ImageCalculatorType::VectorType fixed_center;
fixed_center.Fill(0);
Things that don’t compile b/c they use old vnl types:
typename AffineType::Pointer affine1 = AffineType::New();
typename AffineType::OffsetType trans = affine1->GetOffset();
itk::Point<RealType, ImageDimension> trans2;
trans2.Fill(0);
for( unsigned int i = 0; i < ImageDimension; i++ )
{
trans2[i] = fixed_center[i] * ( 1 );
}
affine1->SetIdentity();
affine1->SetOffset( trans );
affine1->SetMatrix( A_solution );
affine1->SetCenter( trans2 );
// write tx
typedef itk::TransformFileWriter TransformWriterType;
typename TransformWriterType::Pointer transformWriter = TransformWriterType::New();
transformWriter->SetInput( affine1 );
transformWriter->SetFileName( Rcpp::as< std::string >(r_txfn).c_str() );
transformWriter->Update();
/*
typedef itk::ResampleImageFilter<ImageType, ImageType> ResampleFilterType;
typename ResampleFilterType::Pointer resample = ResampleFilterType::New();
But - in brief - this is a question of how to replace old vnl operations with whatever is the right way to do wrt recent ITK.
dzenanz
(Dženan Zukić)
June 8, 2022, 6:30pm
2
Unfortunately, we still use VNL under the hood for Matrix. We want to transition to Eigen, but it is a large refactoring and no one has taken it up so far.