Closed didatto closed 6 months ago
Why is [1]
in the command? This is the error.
Why is
[1]
in the command? This is the error.
Hi Gabriel, This was the original code I used. Got the same error. antsApplyTransforms -d 3 -i "$ROI_mask" -r $b0brain -t ["$T1_folder"/b0_T1/out0GenericAffine.mat,1] -t ["$T1_folder"/T1_MNI/out0GenericAffine.mat,1] -t "$T1_folder"/T1_MNI/out1InverseWarp.nii.gz -n NearestNeighbor -o "$new_mask_dir"/$filename_mask/"$filename_mask"_in_T2.nii.gz -v
That's not the same command, this is telling ants to invert the transform before applying, and should be a valid command.
Based on your prompt character you're not using bash.
Can you run "bash" and try the command again, and provide the full output.
Thank you for your reply. I changed the zsh to bash, still received the error message:
bash-3.2$ antsApplyTransforms -d 3 -i "$ROI_mask" -r $b0brain -t ["$T1_folder"/b0_T1/out0GenericAffine.mat,1] -t ["$T1_folder"/T1_MNI/out0GenericAffine.mat,1] -t "$T1_folder"/T1_MNI/out1InverseWarp.nii.gz -n NearestNeighbor -o "$new_mask_dir"/$filename_mask/"$filename_mask"_in_T2.nii.gz -v Using double precision for computations. Input scalar image: /Users/anneliesvantwesteinde/precuneus/precuneus_ROI_Left.nii.gz Reference image: /Volumes/Diana/Preprocessed/DTI/Addison_AllControls/ADDI_013/nodif.nii.gz Transform file does not exist: /Volumes/Diana/Preprocessed/DTI/Test_BedpostX/ANTs/T1_MNI/T1_MNI/out1InverseWarp.nii.gz Can't read initial transform /Volumes/Diana/Preprocessed/DTI/Test_BedpostX/ANTs/T1_MNI/T1_MNI/out1InverseWarp.nii.gz bash-3.2$
This is the full code I was following: At line 54 is this code: antsApplyTransforms -d 3 -i "$ROI_mask" -r $b0brain -t ["$T1_folder"/b0_T1/out0GenericAffine.mat,1] -t ["$T1_folder"/T1_MNI/out0GenericAffine.mat,1] -t "$T1_folder"/T1_MNI/out1InverseWarp.nii.gz -n NearestNeighbor -o "$new_mask_dir"/$filename_mask/"$filename_mask"_in_T2.nii.gz -v
Transform file does not exist: /Volumes/Diana/Preprocessed/DTI/Test_BedpostX/ANTs/T1_MNI/T1_MNI/out1InverseWarp.nii.gz
Does that file exist?
Bash was indeed an error, you were right, and the path was defined twice.
Thank you for your help, now it runs.
Have a nice day :-)
Operating system and version
macOS-14.0
CPU architecture
arm64 (Apple M1/M2)
ANTs code version
antsApplyTransforms
ANTs installation type
Downloaded Github release binaries
Summary of the problem
Hi,
I am trying to run this Linear transformation, however I keep getting the same error message, no matter how I modify the code. Could you please help and assist me in this matter? I tried several ways of using the square brackets, #, and curly bracket, '', and "" - but I keep receiving the error message. Even-though the out0GenericAffine.mat files are existing in the given folder, and the path was clearly defined previously.
Commands to reproduce the problem.
antsApplyTransforms -d 3 -i "$ROI_mask" -r "$b0brain" \ -t "$T1_folder"/b0_T1/out0GenericAffine.mat [1] \ -t "$T1_folder"/out0GenericAffine.mat [1] \ -t "$T1_folder/out1InverseWarp.nii.gz" \ -n NearestNeighbor -o "$T1_folder/new_mask_dir/${filename_mask}_in_T2.nii.gz" -v
Output of the command with verbose output.
~ % antsApplyTransforms -d 3 -i "$ROI_mask" -r "$b0brain" \ -t "$T1_folder"/b0_T1/out0GenericAffine.mat [1] \ -t "$T1_folder"/out0GenericAffine.mat'[1]' \ -t "$T1_folder/out1InverseWarp.nii.gz" \ -n NearestNeighbor -o "$T1_folder/new_mask_dir/${filename_mask}_in_T2.nii.gz" -v
Using double precision for computations. Input scalar image: /Users/anneliesvantwesteinde/precuneus/precuneus_ROI_Left.nii.gz Reference image: /Volumes/Diana/Preprocessed/DTI/Addison_AllControls/ADDI_013/nodif.nii.gz Transform file does not exist: 1 Can't read initial transform 1
Data to reproduce the problem
Sorry the files are too big to upload, even if I compressed them.