Index: /trunk/ippScripts/scripts/detrend_norm_apply.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 9184)
+++ /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 9185)
@@ -6,4 +6,8 @@
 use IPC::Cmd qw( can_run run );
 use Data::Dumper;
+
+use PS::IPP::Config;
+my $ipprc = PS::IPP::Config->new(); # IPP configuration
+use File::Spec;
 
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
@@ -51,6 +55,10 @@
 die "Can't find required tools.\n" if $missing_tools;
 
+my ($vol, $dir, $file) = File::Spec->splitpath( $input );
+$input = File::Spec->rel2abs( $input, $ipprc->workdir() );
+
 # Output name
 my $outputRoot = $camera . '.' . $detType . '.norm.' . $detId . '.' . $iter; # Root output name
+$outputRoot = File::Spec->rel2abs( File::Spec->catpath( $vol, $dir, $outputRoot ), $ipprc->workdir() );
 my $output = $outputRoot . '.' . $classId . '.fits'; # Main output file
 my $b1name = $outputRoot . '.' . $classId . '.b1.fits';	# Output file with binning 1
@@ -58,5 +66,5 @@
 my $statsName = $outputRoot . '.' . $classId . '.stats'; # Statistics file
 
-# Run ppArith
+# Run normalisation
 {
     my $command = "$ppImage -file $input $outputRoot -norm $value -stat $statsName -recipe PPIMAGE " . RECIPE(); # Command to run
@@ -84,6 +92,8 @@
 }
 
-
 # Update the database
+$output = File::Spec->abs2rel( $output, $ipprc->workdir() );
+$b1name = File::Spec->abs2rel( $b1name, $ipprc->workdir() );
+$b2name = File::Spec->abs2rel( $b2name, $ipprc->workdir() );
 unless ($no_update) {
     my $command = "$dettool -addnormalizedimfile -det_id $detId -iteration $iter -class_id $classId ".
@@ -102,3 +112,5 @@
     die "Unable to perform dettool -addnormalizedimfile: $error_code\n"
 	if not $success;
+
+    unlink $statsName;
 }
