I want to convert images from .img
to .nii.gz
using the function fslchfiletype
.
These images are stored in Controls
and Patients
folders, each one of this folders have several folders belonging to each one of the individuals, like C01, C02,
, etc. Specifically, each one of the individuals has the .img
files inside a folder called rs_roi
, which is inside another folder called ROIS2
. This is what I have:
DIR="/media/Roy"; cd "$DIR/Analysis"
for group in Controls Patients; do
for case in $group; do
mkdir $DIR/Analysis/$group/$case/Cortical_masks
for file in $DIR/Analysis/$group/$case/ROIS2/rs_roi/.img; do
fslchfiletype NIFTI_GZ "$file"
done;
done;
done;
Notice how I also want to create a folder
called Cortiical_maks
inside each and one of the individuals.
This gives me the next error:
mkdir: cannot create directory ´media/Roy/Analysis/Controls/Controls/Cortical_masks´: No such file or directory.
Cannot open volume media/Roy/Analysis/Controls/Controls/ROIS2/rs_roi/ for reading!
mkdir: cannot create directory ´media/Roy/Analysis/Patients/Patients/Cortical_masks´: No such file or directory.
Cannot open volume media/Roy/Analysis/Patients/Patients/ROIS2/rs_roi/ for reading!
It´s iterating two times the Controls Patients
folder: Control/Control
. Maybe the problem is here for case in $group; do
? Thx