Skip to content

AverageAffineTransform not working #1602

@Grace-93

Description

@Grace-93

Describe the problem

I want to use AverageAffineTransform to average a group of affine matrices I got from antsRegistration. The resulting matrices seem in binary format and when I ran AverageAffineTransform, I got the error
"libc++abi: terminating with uncaught exception of type std::invalid_argument: stoi: no conversion".
I realized that AverageAffineTransform cannot process binary matrices.
Therefore, I used ConvertTransformFile to convert binary to text, but still got the same error.

To Reproduce

Run antsRegsitrtion as follow:
Screen Shot 2023-09-20 at 3 19 44 PM

Run ConvertTransformFile 3 inputBinaryTransform.mat outputTextTransform.txt to convert binary to text.

Then run

#!/bin/bash

for file in *.txt; do
    output_file="cleaned_${file}"
    # Extract the line with the transformation parameters and remove the "Parameters:" label
    grep "Parameters:" $file | sed 's/Parameters: //' > $output_file
    # Remove the line containing "Fixed"
    sed -i '' '/Fixed/d' $output_file
done

to take out the Parameter that is useful for AverageAffineTransform.

Finally, run AverageAffineTransform average_transform.txt input_matrix.txt

System information (please complete the following information)

  • OS: Mac OS, M1 chip
  • OS version: 12.2.1
  • Type of system: MacBook pro laptop

ANTs version information

  • ANTs code version: 2.4.4.dev
  • ANTs installation type: Compiled from source: Jun 24 2023 21:17:36

Additional information

Metadata

Metadata

Assignees

Labels

docsIssues relating to ANTs documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions