X-Git-Url: http://gitweb.michael.orlitzky.com/?p=spline3.git;a=blobdiff_plain;f=src%2FMain.hs;h=89ac4463d096b9138dad365a52e8a33b39028896;hp=6848ff86264c3fc461e554cc2067cd6f312db2d4;hb=63b121a0397d4d2d8898a2a9f266859b047ba491;hpb=999576c62823479bd840e11e4802913d88c22cc5 diff --git a/src/Main.hs b/src/Main.hs index 6848ff8..89ac446 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -3,17 +3,16 @@ module Main where -import Data.Maybe (fromJust) -import Control.Monad (when) +import Control.Monad ( when ) import qualified Data.Array.Repa as R -import Data.Maybe (isJust) -import GHC.Conc (getNumProcessors, setNumCapabilities) -import System.IO (hPutStrLn, stderr) -import System.Exit (exitSuccess, exitWith, ExitCode(..)) +import Data.Maybe ( fromJust ) +import GHC.Conc ( getNumProcessors, setNumCapabilities ) +import System.IO ( hPutStrLn, stderr ) +import System.Exit ( exitSuccess, exitWith, ExitCode(..) ) -import CommandLine (Args(..), apply_args) +import CommandLine ( Args(..), apply_args ) import ExitCodes -import Grid (zoom) +import Grid ( zoom ) import Volumetric ( bracket_array, flip_x, @@ -23,8 +22,7 @@ import Volumetric ( swap_bytes, write_values_to_bmp, write_word16s, - z_slice - ) + z_slice ) validate_args :: Args -> IO () @@ -66,20 +64,17 @@ main = do num_procs <- getNumProcessors setNumCapabilities num_procs - -- Determine whether we're doing 2d or 3d. If we're given a slice, - -- assume 2d. let shape = (R.Z R.:. depth R.:. height R.:. width) :: R.DIM3 - if (isJust slice) then - main2d args shape - else - main3d args shape + -- Determine whether we're doing 2d or 3d. If we're given a slice, + -- assume 2d. + let main_function = case slice of + Nothing -> main3d + Just _ -> main2d + main_function args shape exitSuccess - where - - main3d :: Args -> R.DIM3 -> IO () main3d Args{..} shape = do