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 let dbl_data = R.compute $ R.map fromIntegral arrMRI
38 let output = zoom dbl_data zoom_factor
39 let word16_output = R.compute $ round_array output
40 write_word16s out_file word16_output
46 let scale = read s :: Int
47 let zoom_factor = (1, scale, scale)
48 let out_file = "output.bmp"
49 arr <- read_word16s in_file
50 let arrSlice = R.computeUnboxed $ z_slice 50 $ flip_x $ flip_y $ swap_bytes arr
51 let arrSlice' = R.reshape mri_slice3d arrSlice
53 -- If zoom isn't being inlined we need to extract the slice before hand,
54 -- and convert it to the require formed.
55 let dbl_data = R.compute $ R.map fromIntegral arrSlice'
56 let output = zoom dbl_data zoom_factor
57 let arrSlice0 = R.computeUnboxed $ z_slice 0 output
59 write_values_slice_to_bitmap arrSlice0 out_file