4 import qualified Data.Array.Repa as R
5 import System.Environment (getArgs)
7 import Grid (make_grid, zoom, zoom_chunk)
12 in_file = "./data/mri.bin"
22 let scale = read s :: Int
23 let zoom_factor = (1, scale, scale)
24 let out_file = "output.bmp"
25 arr <- read_word16s in_file
26 let arr' = swap_bytes arr
27 let arrInv = flip_x $ flip_y arr'
28 let arrSlice = z_slice3 50 arrInv
29 let dbl_data = R.map fromIntegral arrSlice
30 let g = make_grid 1 dbl_data
31 let output = zoom_chunk g zoom_factor
32 write_values_chunk_to_bitmap output out_file
39 let scale = read s :: Int
40 let zoom_factor = (scale, scale, scale)
41 let out_file = "output.bin"
42 arr <- read_word16s in_file
43 let arr' = swap_bytes arr
44 -- let arrInv = flip_x $ flip_y arr'
45 let arrMRI = R.reshape mri_shape arr'
46 let dbl_data = R.force $ R.map fromIntegral arrMRI
47 let g = make_grid 1 dbl_data
48 let output = zoom g zoom_factor
49 let word16_output = bracket_array output
50 write_word16s out_file word16_output
56 let scale = read s :: Int
57 let zoom_factor = (1, scale, scale)
58 let out_file = "output.bmp"
59 arr <- read_word16s in_file
60 let arr' = swap_bytes arr
61 let arrInv = flip_x $ flip_y arr'
62 let arrSlice = z_slice 50 arrInv
63 let arrSlice' = R.reshape mri_slice3d arrSlice
64 let dbl_data = R.map fromIntegral arrSlice'
65 let g = make_grid 1 dbl_data
66 let output = zoom g zoom_factor
67 write_values_slice_to_bitmap (z_slice 0 output) out_file