#!/bin/sh

# file: $USFS/util/pcd_to_ppm/v1.0/pcd_to_ppm.sh
#
# this is a shellscript that converts pcd files to ppm format.
#

# important definitions
#
IMAGE_EXE="$USFS/bin/$ISIP_BINARY/hpcdtoppm";
IMAGE_FORMAT="-4";
PPM_EXT=".ppm";

# if no arguments, display the usage of the program
#
if (test $# = "0") then
    more "$USFS/util/pcd_to_ppm/v6.2/pcd_to_ppm.help"

# else, loop over all arguments
#
else
    for arg do

	# convert the filename from the pcd to ppm extension
	#
	name_dir=`dirname $arg`;
	name_file=`basename $arg`;
	name_file=`echo $name_file | cut -f1 -d'.'`;
	output_file="$name_dir""/""$name_file""$PPM_EXT";
	
	# run the conversion
	#
	echo "converting $arg to $output_file""..."
	$IMAGE_EXE $IMAGE_FORMAT $arg $output_file

    done
fi

# end of file
#
