I created nifti images from the two magnitude and phase dicom sets with this code....
foreach subj (`ls -d /mnt/e/AES1* | sed 's/\// /g' | awk '{print $3}'`)
foreach cond (Ex Rest)
echo "subj = " ${subj} ", cond = " ${cond}
#make a directory to put first field map
mkdir /mnt/e/${subj}/${subj}.${cond}/field_map_1
#move dicom images with title TE7.38.0000*dcm into the directory
mv /mnt/e/${subj}/${subj}.${cond}/*field_mapping/TE7.38*dcm /mnt/e/${subj}/${subj}.${cond}/field_map_1
#Create a NIFTI file out of the dicom files in the field map directory
dcm2niix_afni /mnt/e/${subj}/${subj}.${cond}/field_map_1
mkdir /mnt/e/${subj}/${subj}.${cond}/field_map_2
mv /mnt/e/${subj}/${subj}.${cond}/*field_mapping/TE4.92*dcm /mnt/e/${subj}/${subj}.${cond}/field_map_2
dcm2niix_afni /mnt/e/${subj}/${subj}.${cond}/field_map_2
mkdir /mnt/e/${subj}/${subj}.${cond}/phase_map
mv /mnt/e/${subj}/${subj}.${cond}/*field_mapping/TE7.38*dcm /mnt/e/${subj}/${subj}.${cond}/phase_map
dcm2niix_afni /mnt/e/${subj}/${subj}.${cond}/phase_map
end
end
foreach subj (`ls -d /mnt/e/AES1* | sed 's/\// /g' | awk '{print $3}'`)
foreach cond (Ex Rest)
echo "subj = " ${subj} ", cond = " ${cond}
#move into field_map_average directory
cd /mnt/e/${subj}/${subj}.${cond}/field_map_average
#skull strip at a fractional intensity threshold of .3 (lower = less brain left)
bet avg_mag.nii skull_strip_avg_mag -f 0.3
Then I average the two magnitude field map images and skull stripped the average image with bet...
#make a directory for field_map_average
mkdir /mnt/e/${subj}/${subj}.${cond}/field_map_average
#move both field map NIFTI files into field_map_average
mv /mnt/e/${subj}/${subj}.${cond}/field_map_1/field_map_1*.nii /mnt/e/${subj}/${subj}.${cond}/field_map_average/
mv /mnt/e/${subj}/${subj}.${cond}/field_map_2/field_map_2*.nii /mnt/e/${subj}/${subj}.${cond}/field_map_average/
#move into field_map_average directory
cd /mnt/e/${subj}/${subj}.${cond}/field_map_average
#merge the two field_maps by averaging and create output avg_mag.nii
3dmerge -gmean -prefix avg_mag.nii *.nii
#skull strip at a fractional intensity threshold of .3 (lower = less brain left)
bet avg_mag.nii skull_strip_avg_mag -f 0.3
Then I eroded the averaged magnitude image...
#erode outer layer of voxels to prevent partial volume issue on outside due to leftover skull from bet
fslmaths skull_strip_avg_mag.nii -ero skull_strip_avg_mag_eroded.nii.gz
fslmaths skull_strip_avg_mag_eroded.nii.gz -ero skull_strip_avg_mag_eroded.nii.gz
#check output of erosion and if still issue go in to change manually with afni GUI draw
Which leads me to the code I showed you previously where I make a new directory, put the magnitude and phase image in, and then try to run fsl_prepare_fieldmap....
#make a directory to put first field map
mkdir /mnt/e/${subj}/${subj}.${cond}/field_map
#move dicom images with title TE7.38.0000*dcm into the directory
mv /mnt/e/${subj}/${subj}.${cond}/phase_map/phase_map*.nii /mnt/e/${subj}/${subj}.${cond}/field_map
mv /mnt/e/${subj}/${subj}.${cond}/field_map_average/skull_strip_avg_mag_eroded.nii.gz /mnt/e/${subj}/${subj}.${cond}/field_map
#cd /mnt/e/${subj}/${subj}.${cond}/
# Prepares a fieldmap suitable for FEAT from SIEMENS data - saves output in rad/s format
# Example: fsl_prepare_fieldmap <scanner> <phase_image> <magnitude_image> <out_image> <deltaTE (in ms)> [--nocheck]
fsl_prepare_fieldmap SIEMENS /mnt/e/${subj}/${subj}.${cond}/field_map/phase_map*.nii /mnt/e/${subj}/${subj}.${cond}/field_map/*eroded.niigz /mnt/e/${subj}/${subj}.${cond}/field_map/fmap_rads.nii 2.46 --nocheck
Again the error message I received is...
Loading Volumes
Phase loaded
Magnitude loaded
Mask loaded
ERROR: input phase image exceeds allowable phase range.
Allowable range is 6.283 radians. Image range is: 12.5541 radians.
Aborting.
Cannot open volume /tmp/fsl_cvXneJ_tmp_ph_radians_unwrapped for reading!
Image Exception : #22 :: ERROR: Could not open image /tmp/fsl_cvXneJ_tmp_ph_rps
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Cannot open volume fmap_rads for reading!
Image Exception : #22 :: ERROR: Could not open image /tmp/fsl_cvXneJ_tmp_fmapmasked
Cannot open volume fmap_rads for reading!
Image Exception : #22 :: ERROR: Could not open image fmap_rads
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
Aborted (core dumped)
Cannot open volume /tmp/fsl_cvXneJ_tmp_fmapfilt for reading!
Cannot open volume fmap_rads for reading!
Done. Created fmap_rads for use with FEAT
########################################################################
To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
|