- let arrSlice = slice arrInv (Any :. (50 :: Int) :. All :. All)
- let arrColor = raw_data_to_color arrSlice
-
- let arrColor' = reshape mri_shape3d arrColor
- let rdata = red_dbl_data arrColor'
- let gdata = green_dbl_data arrColor'
- let bdata = blue_dbl_data arrColor'
-
--- mridata <- read_values_3d mri_shape in_file
-
- let gr = make_grid 1 rdata
- let routput = zoom gr (2,2,1)
-
- let gg = make_grid 1 gdata
- let goutput = zoom gg (2,2,1)
-
- let gb = make_grid 1 bdata
- let boutput = zoom gb (2,2,1)
-
- let routput' = R.map double_to_word8 (reshape mri_shape2d routput)
- let goutput' = R.map double_to_word8 (reshape mri_shape2d goutput)
- let boutput' = R.map double_to_word8 (reshape mri_shape2d boutput)
-
--- write_values_1d output out_file
- writeComponentsToBMP out_file routput' goutput' boutput'
- where
- double_to_word8 :: Double -> Word8
- double_to_word8 x =
- if x > 255 then
- 255 :: Word8
- else
- if x < 0 then
- 0 :: Word8
- else
- fromIntegral $ truncate x
+ let arrSlice = z_slice 50 arrInv
+ let arrSlice' = R.reshape mri_slice3d arrSlice
+ let dbl_data = R.map fromIntegral arrSlice'
+ let g = make_grid 1 dbl_data
+ let output = zoom g zoom_factor
+ let mri_slice2d = drop_z $ zoom_shape zoom_factor mri_slice3d
+ let colors = values_to_colors $ R.reshape mri_slice2d output
+ let routput = R.map (\(red, _, _) -> red) colors
+ let goutput = R.map (\(_, green, _) -> green) colors
+ let boutput = R.map (\(_, _, blue) -> blue) colors
+ R.writeComponentsToBMP out_file routput goutput boutput