- let out_file = "output.bin"
- arr <- read_word16s in_file
- let arr' = swap_bytes arr
- let arrMRI = R.reshape mri_shape arr'
- let dbl_data = R.compute $ R.map fromIntegral arrMRI
- let output = zoom dbl_data zoom_factor
- let word16_output = R.compute $ round_array output
- write_word16s out_file word16_output
-
-
-main2d :: IO ()
-main2d = do
- (s:_) <- getArgs
- let scale = read s :: Int
+ arr <- read_word16s input shape
+ let arr_swapped = swap_bytes arr
+ let arr_shaped = R.reshape shape arr_swapped
+ dbl_data <- R.computeUnboxedP $ R.map fromIntegral arr_shaped
+ raw_output <- zoom dbl_data zoom_factor
+ let word16_output = round_array raw_output
+ -- Switch the bytes order back to what it was. This lets us use the
+ -- same program to view the input/output data.
+ swapped_output <- R.computeUnboxedP $ swap_bytes word16_output
+ write_word16s output swapped_output
+
+
+main2d :: Args -> R.DIM3 -> IO ()
+main2d Args{..} shape = do