Index: trunk/ippScripts/scripts/magic_process.pl
===================================================================
--- trunk/ippScripts/scripts/magic_process.pl	(revision 23908)
+++ trunk/ippScripts/scripts/magic_process.pl	(revision 23966)
@@ -37,5 +37,5 @@
 
 # Parse the command-line arguments
-my ($magic_id, $node, $camera, $dbname, $outroot, $save_temps, $verbose, $no_update, $no_op, $logfile);
+my ($magic_id, $node, $camera, $dbname, $outroot, $template_uri, $save_temps, $verbose, $no_update, $no_op, $logfile);
 
 GetOptions(
@@ -45,4 +45,5 @@
            'dbname=s'        => \$dbname,     # Database name
            'outroot=s'       => \$outroot,    # Output root name
+           'template_uri=s'  => \$template_uri,# uri of diff template
            'save-temps'      => \$save_temps, # Save temporary files?
            'verbose'         => \$verbose,    # Print stuff?
@@ -58,5 +59,6 @@
     defined $node and
     defined $camera and
-    defined $outroot;
+    defined $outroot and
+    defined $template_uri;
 
 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
@@ -136,5 +138,9 @@
         }
 
-        $command .= " --detect --image $image --mask $mask --weight $weight";
+        my $template = $ipprc->file_resolve($template_uri);
+        &my_die("failed to resolve template_uri: $template_uri", $magic_id, $node, $PS_EXIT_DATA_ERROR)
+            if !($template);
+
+        $command .= " --detect --image $image --mask $mask --weight $weight -k $template";
 
         # set threshold to 4 sigma
