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,
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 )
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)
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
-- Infix notation won't work, the arguments are backwards!
is_missing_arg_error :: String -> Bool
-is_missing_arg_error s =
- startswith "Requires at least" s
+is_missing_arg_error =
+ startswith "Requires at least"
show_help :: IO Args