]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Main.hs
Get rid of the chunk code, and recompute the grid within the zoom traverse.
[spline3.git] / src / Main.hs
1 module Main
2 where
3
4 import qualified Data.Array.Repa as R
5 import System.Environment (getArgs)
6
7 import Grid (zoom)
8 import MRI
9
10
11 in_file :: FilePath
12 in_file = "./data/mri.bin"
13
14
15 main :: IO ()
16 main = main3d
17
18
19 main3d :: IO ()
20 main3d = do
21 (s:_) <- getArgs
22 let scale = read s :: Int
23 let zoom_factor = (scale, scale, scale)
24 let out_file = "output.bin"
25 arr <- read_word16s in_file
26 let arr' = swap_bytes arr
27 let arrMRI = R.reshape mri_shape arr'
28 let dbl_data = R.force $ R.map fromIntegral arrMRI
29 let output = zoom dbl_data zoom_factor
30 let word16_output = bracket_array output
31 write_word16s out_file word16_output
32
33
34 main2d :: IO ()
35 main2d = do
36 (s:_) <- getArgs
37 let scale = read s :: Int
38 let zoom_factor = (1, scale, scale)
39 let out_file = "output.bmp"
40 arr <- read_word16s in_file
41 let arr' = swap_bytes arr
42 let arrInv = flip_x $ flip_y arr'
43 let arrSlice = z_slice 50 arrInv
44 let arrSlice' = R.reshape mri_slice3d arrSlice
45 let dbl_data = R.map fromIntegral arrSlice'
46 let output = zoom dbl_data zoom_factor
47 write_values_slice_to_bitmap (z_slice 0 output) out_file