Index: trunk/ippScripts/scripts/detrend_apply_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 8862)
+++ trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 8887)
@@ -9,14 +9,34 @@
 use Data::Dumper;
 
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
 # Parse the command-line
-die "Apply the detrend normalisations.\n\n" .
-    "Usage: $0 DET_ID ITER CLASS_ID MULTIPLICATION_VALUE INPUT OUTPUT\n\n"
-    if scalar @ARGV != 6;
-my $detId = shift @ARGV;	# Detrend ID
-my $iter = shift @ARGV;		# Iteration
-my $classId = shift @ARGV;	# Class ID
-my $value = shift @ARGV;	# Value to multiply
-my $input = shift @ARGV;	# Input file
-my $output = shift @ARGV;	# Output file
+my ($detId,                     # Detrend ID
+    $iter,  			# Iteration
+    $classId,			# Class ID
+    $value,			# Value to multiple (for normalisation)
+    $input,			# Input file
+    $output			# Output file
+    );
+GetOptions(
+    'det_id|d=s'        => \$detId,
+    'iteration|n=s'	=> \$iter,
+    'class_id|i=s'      => \$classId,
+    'value|v=s'		=> \$value,
+    'input_uri|u=s'     => \$input,
+    'output_uri|o=s'    => \$output,
+    ) or pod2usage( 2 );
+    
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(     -msg => "Required options: --det_id --iteration --class_id --value --input_uri --output_uri",
+    -exitval => 3,
+    ) unless defined $detId
+        and defined $iter
+	    and defined $classId
+	        and defined $value
+		    and defined $input
+		        and defined $output;
+			
 
 # Look for programs we need
Index: trunk/ippScripts/scripts/detrend_calc_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_calc_norm.pl	(revision 8862)
+++ trunk/ippScripts/scripts/detrend_calc_norm.pl	(revision 8887)
@@ -9,14 +9,27 @@
 use Data::Dumper;
 
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+
 use constant STATISTIC => 'bg';	# Background statistic to use from the database
 
+# Parse command-line arguments
+my ($detId,   # Detrend id
+    $iter      # Iteration
+    );
+GetOptions(
+	'det_id|d=s'	=> \$detId,
+	'iteration|i=s'	=> \$iter,
+	) or pod2usage( 2 );
 
-# Parse the command-line
-die "Calculate the detrend normalisations.\n\n" .
-    "Usage: $0 DET_ID ITER\n\n"
-    if scalar @ARGV != 2;
-my $detId = shift @ARGV;	# Detrend ID
-my $iter = shift @ARGV;		# Iteration
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options --det_id --iteration",
+	   -exitval => 3,
+	 ) unless defined $detId
+	      and defined $iter;
 
+
+use constant STATISTIC => 'bg'; # Background statistic to use from the database
 
 # Look for programs we need
