+registration_no_motion_mask()
+{
+ echo
+ echo "----------- Registration Without Motion Masks ------------"
+ start=`date`
+ echo "start: $start"
+ echo
+
+ mkdir -p $vf_dir
+ mkdir -p $output_dir
+
+ # banded images may be created as separate files,
+ # with the specified preffix, which is interesting for debugging.
+ # if blank, it means that the original images (those without bands)
+ # will be used (see create_midP_masks-2.0.sh for details).
+ banded=""
+
+ # params read from conf file
+ use_coeffs=1
+ params="$nb_iter $nb_samples $sampling_algo $nb_hist_bins $nb_levels $bspline_spacing $metric $optimizer $interpolator"
+
+ # register all phases to the reference
+ for i in $( seq 0 $((${#phase_files[@]} - 1))); do
+ phase_file=${phase_files[$i]}
+ phase_nb=${phase_nbs[$i]}
+
+ if [ "$phase_nb" != "$ref_phase_nb" ]; then
+ # params
+ reference=$mask_dir/patient_$ref_phase_nb.mhd
+ target=$mask_dir/patient_$phase_nb.mhd
+ mask_ref=$mask_dir/patient_mask_$ref_phase_nb.mhd
+ mask_targ=$mask_dir/patient_mask_$phase_nb.mhd
+ vf=$vf_dir/vf_${ref_phase_nb}_$phase_nb.mhd
+ result=$output_dir/result_${ref_phase_nb}_$phase_nb.mhd
+ log=$log_dir/log_${ref_phase_nb}_$phase_nb.log
+ if [ $use_coeffs = 1 ]; then
+ init_coeff=$coeff_in # empty at first iteration
+ coeff=$vf_dir/coeff_${ref_phase_nb}_$phase_nb.mhd
+ fi
+
+ # registration
+ if [ "$method" == "blutdir" ]; then
+ registration_blutdir $reference $target $mask_ref $mask_targ $vf $result $params $log $coeff
+ elif [ "$method" == "elastix" ]; then
+ registration_elastix $reference $target $mask_ref $mask_targ $vf $result $params $log
+ fi
+
+ # save for later...
+ vf_ref=$vf
+ fi
+ done
+
+ clitkZeroVF -i $vf_ref -o $vf_dir/vf_${ref_phase_nb}_${ref_phase_nb}.mhd
+
+ # create 4D vf
+ create_mhd_4D_pattern.sh $vf_dir/vf_${ref_phase_nb}_
+
+ # create 4D coeffs
+ create_mhd_4D_pattern.sh $vf_dir/coeff_${ref_phase_nb}_ _0
+
+ # create 4D result image
+ create_mhd_4D_pattern.sh $output_dir/result_${ref_phase_nb}_
+
+ echo
+ echo "-------- Registration done ! --------"
+ end=`date`
+ echo "start: $start"
+ echo "end: $end"
+ echo
+}
+