]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/CommandLine.hs
src/CommandLine.hs: drop explicit "typeable" derivation.
[spline3.git] / src / CommandLine.hs
index 6479145b2693f6a36e48f53c33db4eb9b836d687..687a1c41586f8e71236b00f7c3fe076a7ab2621e 100644 (file)
@@ -4,19 +4,18 @@ module CommandLine (
   Args(..),
   apply_args,
   program_name,
-  show_help)
+  show_help )
 where
 
 -- Get the version from Cabal.
-import Paths_spline3 (version)
-import Data.Version (showVersion)
+import Paths_spline3 ( version )
+import Data.Version ( showVersion )
 
-import Data.String.Utils (startswith)
+import Data.String.Utils ( startswith )
 import System.Console.CmdArgs (
   CmdArgs,
   Data,
   Mode,
-  Typeable,
   (&=),
   argPos,
   cmdArgsApply,
@@ -29,15 +28,14 @@ import System.Console.CmdArgs (
   program,
   typ,
   summary,
-  versionArg
-  )
+  versionArg )
 
-import System.Console.CmdArgs.Explicit (process)
-import System.Environment (getArgs, withArgs)
-import System.Exit (ExitCode(..), exitWith)
-import System.IO (hPutStrLn, stderr)
+import System.Console.CmdArgs.Explicit ( process )
+import System.Environment ( getArgs, withArgs )
+import System.Exit ( ExitCode(..), exitWith )
+import System.IO ( hPutStrLn, stderr )
 
-import ExitCodes
+import ExitCodes ( exit_arg_parse_failed )
 
 
 
@@ -45,11 +43,13 @@ data Args =
   Args { depth  :: Int,
          height :: Int,
          input  :: FilePath,
+         lower_threshold :: Int,
+         output :: FilePath,
          scale  :: Int,
          slice  :: Maybe Int,
-         output :: FilePath,
+         upper_threshold :: Int,
          width  :: Int }
-  deriving   (Show, Data, Typeable)
+  deriving   (Show, Data)
 
 description :: String
 description =
@@ -65,35 +65,75 @@ spline3_summary :: String
 spline3_summary =
   program_name ++ "-" ++ (showVersion version)
 
+depth_default :: Int
+depth_default = 109
+
 depth_help :: String
-depth_help = "The size of the z dimension (default: 109)"
+depth_help =
+  "The size of the z dimension (default: " ++ (show depth_default) ++ ")"
+
+height_default :: Int
+height_default = 256
 
 height_help :: String
-height_help = "The size of the y dimension (default: 256)"
+height_help =
+  "The size of the y dimension (default: " ++ (show height_default) ++ ")"
+
+lower_threshold_default :: Int
+lower_threshold_default = 1400
+
+lower_threshold_help :: String
+lower_threshold_help =
+  "The lower limit for voxel values, only used in 2D (default: " ++
+  (show lower_threshold_default) ++ ")"
+
+scale_default :: Int
+scale_default = 2
 
 scale_help :: String
 scale_help =
   "The magnification scale. A scale of 2 would result " ++
-  "in an image twice as large as the original. (default: 2)"
+  "in an image twice as large as the original. (default: " ++
+  (show scale_default) ++ ")"
 
 slice_help :: String
 slice_help =
   "The index of the two-dimensional slice to use if no depth is specified"
 
+upper_threshold_default :: Int
+upper_threshold_default = 2500
+
+upper_threshold_help :: String
+upper_threshold_help =
+  "The upper limit for voxel values, only used in 2D (default: " ++
+  (show upper_threshold_default) ++ ")"
+
+width_default :: Int
+width_default = 256
+
 width_help :: String
-width_help = "The size of the x dimension (default: 256)"
+width_help =
+  "The size of the x dimension (default: " ++ (show width_default) ++ ")"
 
 arg_spec :: Mode (CmdArgs Args)
 arg_spec =
   cmdArgsMode $
     Args {
-      depth  = 109     &= groupname "Dimensions" &= help depth_help,
-      height = 256     &= groupname "Dimensions" &= help height_help,
-      input  = def     &= typ "INPUT"            &= argPos 0,
-      output = def     &= typ "OUTPUT"           &= argPos 1,
-      scale  = 2                                 &= help scale_help,
-      slice  = Nothing &= groupname "2D options" &= help slice_help,
-      width  = 256     &= groupname "Dimensions" &= help width_help
+      depth  = depth_default  &= groupname "Dimensions" &= help depth_help,
+      height = height_default &= groupname "Dimensions" &= help height_help,
+      input  = def            &= typ "INPUT"            &= argPos 0,
+
+      lower_threshold = lower_threshold_default  &= groupname "2D options"
+                                                 &= help lower_threshold_help,
+
+      output = def            &= typ "OUTPUT"           &= argPos 1,
+      scale  = scale_default  &= help scale_help,
+      slice  = Nothing        &= groupname "2D options" &= help slice_help,
+
+      upper_threshold = upper_threshold_default  &= groupname "2D options"
+                                                 &= help upper_threshold_help,
+
+      width  = width_default  &= groupname "Dimensions" &= help width_help
     }
     &= program program_name
     &= summary spline3_summary
@@ -103,8 +143,8 @@ arg_spec =
 
 -- Infix notation won't work, the arguments are backwards!
 is_missing_arg_error :: String -> Bool
-is_missing_arg_error =
-  startswith "Requires at least" s
+is_missing_arg_error =
+  startswith "Requires at least"
 
 
 show_help :: IO Args