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
vf_in=$vf_dir/vf_inside_${ref_phase_nb}_$phase_nb.mhd
result_in=$output_dir/result_inside_${ref_phase_nb}_$phase_nb.mhd
log_in=$log_dir/log_inside_${ref_phase_nb}_$phase_nb.log
+ if [ $use_coeffs = 1 ]; then
+ init_coeff_in=$coeff_in # empty at first iteration
+ coeff_in=$vf_dir/coeff_inside_${ref_phase_nb}_$phase_nb.mhd
+ fi
# outside params
reference_out=$mask_dir/${banded}outside_$ref_phase_nb.mhd
vf_out=$vf_dir/vf_outside_$ref_phase_nb\_$phase_nb.mhd
result_out=$output_dir/result_outside_$ref_phase_nb\_$phase_nb.mhd
log_out=$log_dir/log_outside_${ref_phase_nb}_$phase_nb.log
+ if [ $use_coeffs = 1 ]; then
+ init_coeff_out=$coeff_out # empty at first iteration
+ coeff_out=$vf_dir/coeff_outside_${ref_phase_nb}_$phase_nb.mhd
+ fi
# registration
if [ "$method" == "blutdir" ]; then
- registration_blutdir $reference_in $target_in $mask_ref_in $mask_targ_in $vf_in $result_in $params $log_in
- registration_blutdir $reference_out $target_out $mask_ref_out $mask_targ_out $vf_out $result_out $params $log_out
+ registration_blutdir $reference_in $target_in $mask_ref_in $mask_targ_in $vf_in $result_in $params $log_in $coeff_in $init_coeff_in
+ registration_blutdir $reference_out $target_out $mask_ref_out $mask_targ_out $vf_out $result_out $params $log_out $coeff_out $init_coeff_out
elif [ "$method" == "elastix" ]; then
registration_elastix $reference_in $target_in $mask_ref_in $mask_targ_in $vf_in $result_in $params $log_in
registration_elastix $reference_out $target_out $mask_ref_out $mask_targ_out $vf_out $result_out $params $log_out
################# BLUTDIR #####################
registration_blutdir()
{
- reference=$1
- target=$2
- mask_ref=$3
- mask_targ=$4
- vf=$5
- result=$6
- nb_iter=$7
- nb_samples=$8
- sampling_algo=$9
- hist_bins=${10}
- nb_levels=${11}
- spacing=${12}
- metric=${13}
- optimizer=${14}
- interpolator=${15}
- log=${16}
+ local reference=$1
+ local target=$2
+ local mask_ref=$3
+ local mask_targ=$4
+ local vf=$5
+ local result=$6
+ local nb_iter=$7
+ local nb_samples=$8
+ local sampling_algo=$9
+ local hist_bins=${10}
+ local nb_levels=${11}
+ local spacing=${12}
+ local metric=${13}
+ local optimizer=${14}
+ local interpolator=${15}
+ local log=${16}
+ local coeff=${17}
+ local init_coeff=${18}
echo "Computing BLUTDIR $reference -> $target ..."
blutdir_params="--levels $nb_levels --metric $metric --optimizer $optimizer --samples $nb_samples --spacing $spacing,$spacing,$spacing --bins $hist_bins --maxIt $nb_iter --interp $interpolator --verbose"
- cmd="clitkBLUTDIR -r $reference -t $target -m $mask_ref --targetMask $mask_targ --vf $vf -o $result $blutdir_params"
+
+ if [ -n "$coeff" ]; then
+ coeff="--coeff $coeff"
+ fi
+
+ if [ -n "$init_coeff" ]; then
+ init_coeff="--initCoeff $init_coeff"
+ fi
+
+ cmd="clitkBLUTDIR -r $reference -t $target -m $mask_ref --targetMask $mask_targ --vf $vf $coeff $init_coeff -o $result $blutdir_params"
$cmd > $log
abort_on_error registration_blutdir $? clean_up_registration