@afni_refacer_run with FLAIR

Hello, I am trying to reface FLAIR scans using @afni_refacer_run. The script worked perfectly fine for T1 images, but when I chose FLAIR images as input I only get the error

Need to have an input anatomical, at least

Is it possible to use @afni_refacer_run on FLAIR images?

Thank you very much for your help!

Johannes

Hi, Johannes-

Hmm, it should be possible to do so, yes. Seeing that error surprises me. Would you mind posting the full command you are using?

What might need to be tweaked is that, since the flair has a different tissue contrast than a standard T1w volume, a different cost function might need to be used (e.g., lpc), and maybe a different dataset for the “replacer” face to more closely match the input contrast—though, since the latter gets scaled by the image brightness, the default one might actually be OK.

But please let me know about the command being used, so we can troubleshoot what is happening there.

–pt

Hi Taylor,

here is the command I am using (which worked for the T1 images):


for folder in /Users/lab/Desktop/MRI/*/
do
	echo $folder
	id=$(basename "$folder")
	echo $id
	t1="$folder"*"FLAIR"*".ni"*
	echo $t1
	mkdir /Users/lab/Desktop/MRI/$id/ 
	/Users/lab/abin/@afni_refacer_run -input "$FLAIR" -mode_reface -anonymize_output -prefix /Users/lab/Desktop/MRI//$id/"$id"_FLAIR_reface.nii.gz 
done
echo 'done with script'

Thank you very much!

Johannes

Hi, Johannes-

OK, from the error, I suspect that is a shell scripting issue, that the value after “-input …” in the command should not be “$FLAIR”, but instead “$t1”, as the latter seems to have the full path information and the former just part of the file name.

So, could you please try the following:


for folder in /Users/lab/Desktop/MRI/*/
do
	echo $folder
	id=$(basename "$folder")
	echo $id
	t1="$folder"*"FLAIR"*".ni"*
	echo $t1
	mkdir /Users/lab/Desktop/MRI/$id/ 
	/Users/lab/abin/@afni_refacer_run -input "$t1" -mode_reface -anonymize_output -prefix /Users/lab/Desktop/MRI//$id/"$id"_FLAIR_reface.nii.gz 
done
echo 'done with script'

… and see how that goes?

–pt

Hi pt,

seems like this was the problem, the script works perfectly fine now. Thank you very much for your help!

Johannes