I am trying to take two .nii images and pull random voxel coordinates with non-zero intensity from the first image and then compare that intensity value with the same voxel in a different image. These images should be the same and thus nothing will happen if the values match up. I am struggling on how to find the intensity of a specific voxel in an image with specified coordinates.
max_vox_coord_ref=$(fslstats $image_file1 -x)
max_vox_coord_arr=($max_vox_coord)
max_vox_inten_ref=$(fslstats $image_file1 -R) #### this isn't saving as an array
declare -i dimx dimy dimz
dimx=${max_vox_coord_arr[0]}
dimy=${max_vox_coord_arr[1]}
dimz=${max_vox_coord_arr[2]}
#dimy=${max_vox_coord_arr[1]}
#dimz=${max_vox_coord_arr[2]}
image1_int=$(fslmeants -i "$image_file1" -c $dimx $dimy $dimz)
image2_int=$(fslmeants -i "$image_file2" -c $dimx $dimy $dimz)
if [ $image1_int -ne $image2_int ]; then
echo "VIBES AINT THERE"
fslview $image_file3 $image_file3 $image_file1 -l Red -t 0.7
else
echo "They equal"
fslview $image_file3 $image_file1 -l Red -t 0.7
fi
I then try calling on the second value from this answer to get the max intensity to match up with the max intensity voxel. I fail from here in finding a way to use the found voxel from image1 and get the intensity from the same coordinates in image2.