r32: Allowed negative numbers for window levels
[ctsim.git] / cgi-bin / ctsim.cgi.in
index ac31936d15c0bc42d68b9b54d0698e33fd9abfeb..3ec39ca7e18965a5666025e936a64839246018dc 100755 (executable)
@@ -56,16 +56,16 @@ my $Disp_Min = "auto";
 my $Disp_Max = "auto";
 $Disp_Min = FilterToNumber($in{'Disp_Min'}) if ($in{'Disp_Min'} ne "auto" && $in{'Disp_Min'} ne "");
 $Disp_Max = FilterToNumber($in{'Disp_Max'}) if ($in{'Disp_Max'} ne "auto" && $in{'Disp_Max'} ne "");
-if ($Disp_Min ne 'auto' && ! ($Disp_Min =~ /^[\d\.]+$/)) {
-    $error .= "Display Minimum must be 'auto' or numeric (received '$Disp_Min') <br>";
+if ($Disp_Min ne 'auto' && ! ($Disp_Min =~ /^[\d\.\-]+$/)) {
+    $error .= "Display Minimum must be 'auto' or numeric (received $Disp_Min) <br>";
 }
-if ($Disp_Max ne 'auto' && ! ($Disp_Max =~ /^[\d\.]+$/)) {
-    $error .= "Display Maximum must be 'auto' or numeric (received '$Disp_Max') <br>";
+if ($Disp_Max ne 'auto' && ! ($Disp_Max =~ /^[\d\.\-]+$/)) {
+    $error .= "Display Maximum must be 'auto' or numeric (received $Disp_Max) <br>";
 }
 
 my $MPI_Str = FilterMetaChars($in{'MPI'});
 my $MPI = 0;
-$MPI = 1 if ($MPI_Str eq "yes");
+$MPI = 1 if ($MPI_Str eq "yes" && $::mpi_enable ne "");
 
 $error .= "IR Nx and Ny must be between 5 and 1024<br>" if ($IR_Nx < 5 || $IR_Nx > 1024 || $IR_Ny < 5 || $IR_Ny > 1024);
 $error .= "IR Filter Parameter must be between 0 and 1<br>" if ($IR_Filter_Param < 0 || $IR_Filter_Param > 1);
@@ -282,6 +282,6 @@ sub FilterMetaChars
 sub FilterToNumber
 {
    my $var = pop(@_);
-   $var =~ /^(\d*\.*\d*)$/;  
+   $var =~ /^(\-*\d*\.*\d*)$/;  
    $1;
 }