4 import qualified Data.Array.Repa as R
5 import System.Environment (getArgs)
16 write_values_slice_to_bitmap,
22 in_file = "./data/mri.bin"
31 let scale = read s :: Int
32 let zoom_factor = (scale, scale, scale)
33 let out_file = "output.bin"
34 arr <- read_word16s in_file
35 let arr' = swap_bytes arr
36 let arrMRI = R.reshape mri_shape arr'
37 dbl_data <- R.computeUnboxedP $ R.map fromIntegral arrMRI
38 output <- zoom dbl_data zoom_factor
39 word16_output <- R.computeUnboxedP $ round_array output
40 write_word16s out_file word16_output
47 let scale = read s :: Int
48 let zoom_factor = (1, scale, scale)
49 let out_file = "output.bmp"
50 arr <- read_word16s in_file
51 arrSlice <- R.computeUnboxedP $ z_slice 50 $ flip_x $ flip_y $ swap_bytes arr
52 let arrSlice' = R.reshape mri_slice3d arrSlice
54 -- If zoom isn't being inlined we need to extract the slice before hand,
55 -- and convert it to the require formed.
56 dbl_data <- R.computeUnboxedP $ R.map fromIntegral arrSlice'
57 output <- zoom dbl_data zoom_factor
58 arrSlice0 <- R.computeUnboxedP $ z_slice 0 output
60 write_values_slice_to_bitmap arrSlice0 out_file