#!/bin/bash


if [ $# -lt 7 ]; then
	echo "Script iteratively calls: of_crop input output x y z x_size y_size z_size"
	echo
	echo "Parameters: suffix_with_extension x y z x_size y_size z_size"
	echo "            It reads std input and processes the files with the last 6 parameters."
	echo "            Extension of input files is replaced with the supplied suffix."
	echo
	echo "Example of params: _cropped.tif 0 0 55 320 320 1"

	exit 1
fi

while read fle; do
	j=`echo $fle | sed "s/\....$/$1/"`;
	of_crop "$fle" "$j" $2 $3 $4 $5 $6 $7
done

