Ich weiß nicht, welche Verzeichnisse und Dateien von der ersten Stufe bis zur zweiten Stufe kopieren sollen, damit die Funktion funktioniert. /> Ich habe versucht, alle Dateien und Verzeichnisse aus der ersten Stufe in der zweiten Stufe zu kopieren und in der zweiten Stufe in einen Ordner zu bringen, aber dann weiß ich nicht, wie ich diese Funktion in der zweiten Stufe nennt.
Code: Select all
#################################################FIRST IMAGE#################################################
# Pull first image from its docker hub
FROM itsdockerhub/firstimage AS base
#################################################FIRST IMAGE#################################################
#################################################SECOND IMAGE#################################################
# Import second image from its dockerhub
FROM itsdockerhub/secondimage
# Copy the iterative loop script (which is the entrypoint script I want to run)
COPY iterative_loop.sh .
# Create a new directory in the second image to save all files and directories from the first image
RUN mkdir ./allfilesandfoldersfromfirstimage
# Copy all the files and folders from first image
COPY --from=base . ./allfilesandfoldersfromfirstimage
#################################################FIRST IMAGE#################################################
# Call the iterative loop script
ENTRYPOINT ["./iterative_loop.sh"]
< /code>
iteratives SH -Skript mit der abstrakten Vorstellung von dem, was ich versuche zu tun: < /p>
#!/bin/bash
# Create directory to save the first changes to the MRIs
mkdir ./MRIs_first_modifications
#################################################WORK WITH FUNCTIONS FROM FIRST IMAGE#################################################
# Loop over the input MRI files and do the first changes using the function from the first image
for FILE in /input/*; do
namepart=$(basename "$FILE")
filename="${namepart%%.*}"
extension="${namepart#*.}"
modified_name="${filename}_skull_stripped.${extension}"
# Move into the folder with all files and folders from first image
cd ./allfilesandfoldersfromfirstimage
# Call the function from first image
functionfromfirstimage -i $FILE -o ./MRIs_first_modifications/$modified_name
# Return to the working directory of the second image
cd ..
done
cp ./MRIs_first_modifications/* /output
#################################################WORK WITH FUNCTIONS FROM FIRST IMAGE#################################################
#################################################WORK WITH FUNCTIONS FROM SECOND IMAGE#################################################
# Loop over the modified MRI files and do the next change with a function from the second image
for FILE in ./MRIs_first_modifications/*; do
namepart="$(basename "$FILE")"
filename="${namepart%%.*}"
extension="${namepart#*.}"
modified_name="${filename}_mask.${extension}"
functionfromsecondimage $FILE /output/$modified_name
done
#################################################WORK WITH FUNCTIONS FROM SECOND IMAGE#################################################
Code: Select all
#################################################SYNTHSTRIP#################################################
# Import synthstrip image from freesufer
FROM freesurfer/synthstrip AS skull_strip_with_synthstrip
#################################################SYNTHSTRIP#################################################
#################################################FSL#################################################
# Import fsl image from vistalab
FROM vistalab/fsl-v5.0
# Copy the iterative loop script
COPY iterative_loop.sh .
# Make sure that the iterative loop script is executable
RUN chmod ugo+rwx iterative_loop.sh
RUN mkdir ./oldsynthstrip
# Copy all the initial files from synthstrip
COPY --from=skull_strip_with_synthstrip . ./oldsynthstrip
#################################################FSL#################################################
# Call the iterative loop script
ENTRYPOINT ["./iterative_loop.sh"]
< /code>
und das reale iterative_loop sh -Skript, das ich versucht habe < /p>
#!/bin/bash
#################################################SYNTHSTRIP#################################################
#################################################SYNTHSTRIP#################################################
# Create directory to save the skull-stripped MRIs
mkdir ./skull_stripped
# Loop over the input MRI files and skull-strip them with synthstrip
for FILE in /input/*; do
namepart=$(basename "$FILE")
if [[ $namepart == *".nii.gz"* ]] ; then
filename="${namepart%%.*}"
extension="${namepart#*.}"
modified_name="${filename}_skull_stripped.${extension}" ; else
filename="${namepart%.*}"
extension="${namepart##*.}"
modified_name="${filename}_skull_stripped.${extension}"
fi
echo
echo
echo
echo
echo -e "\033[1m....SKULL STRIPPING $namepart .... PLEASE BE PATIENT .... EACH MRI CAN TAKE A FEW MINUTES TO PROCESS ....\033[0m"
echo
echo
echo
echo
cd ./oldsynthstrip
mri_synthstrip -i $FILE -o ./skull_stripped/$modified_name
cd ..
done
cp ./skull_stripped/* /output
#################################################SYNTHSTRIP#################################################
#################################################SYNTHSTRIP#################################################
#################################################FSL#################################################
#################################################FSL#################################################
# Loop over the skull-stripped MRI files and create the masks with fsl
for FILE in ./skull_stripped/*; do
namepart="$(basename "$FILE")"
if [[ $namepart == *".nii.gz"* ]] ; then
filename="${namepart%%.*}"
extension="${namepart#*.}"
modified_name="${filename}_mask.${extension}" ; else
filename="${namepart%.*}"
extension="${namepart##*.}"
modified_name="${filename}_mask.${extension}"
fi
echo
echo
echo
echo
echo -e "\033[1m....CREATING MASK FOR $namepart .... EACH MRI SHOULD TAKE ONLY A FEW SECONDS TO PROCESS ....\033[0m"
echo
echo
echo
echo
fslmaths $FILE -abs -bin /output/$modified_name
done
#################################################FSL#################################################
#################################################FSL#################################################
./iterative_loop.sh: Zeile 33: ./oldsynthstrip/mri_ynthstrip: Keine solche Datei oder Verzeichnis
I geändert
cd ./oldsynthstrip
mri_synthstrip -i $FILE -o ./skull_stripped/$modified_name
cd ..
< /code>
zu < /p>
./oldsynthstrip/mri_synthstrip -i $FILE -o ./skull_stripped/$modified_name
< /code>
, was den gleichen Fehler ergibt. Arbeit?>