-
-
Notifications
You must be signed in to change notification settings - Fork 390
Description
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:
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