]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/MRI.hs
Clean up the imports/exports between MRI and Main.
[spline3.git] / src / MRI.hs
index 157b89972aa8dfe817951805cdede467714e4918..cb89af91d145c8c25c130a73b9814c9a6bfde869 100644 (file)
@@ -1,4 +1,15 @@
-module MRI
+module MRI (
+  flip_x,
+  flip_y,
+  mri_shape,
+  mri_slice3d,
+  read_word16s,
+  round_array,
+  swap_bytes,
+  write_values_slice_to_bitmap,
+  write_word16s,
+  z_slice
+  )
 where
 
 import Data.Word
@@ -37,9 +48,6 @@ type RawData3D = RawData DIM3
 type RGB = (Word8, Word8, Word8)
 type ColorData sh = Array sh RGB
 
-rgb_to_dbl :: RGB -> (Double, Double, Double)
-rgb_to_dbl (x,y,z) = (fromIntegral x, fromIntegral y, fromIntegral z)
-
 
 read_word16s :: FilePath -> IO RawData3D
 read_word16s path = do
@@ -115,53 +123,12 @@ values_to_colors arr =
         b' = truncate (b * 255)
 
 
-red_dbl_data :: (Shape sh) => (ColorData sh) -> Array sh Double
-red_dbl_data =
-  R.map (get_r . rgb_to_dbl)
-  where
-    get_r :: (Double, Double, Double) -> Double
-    get_r (r, _, _) = r
-
-green_dbl_data :: (Shape sh) => (ColorData sh) -> Array sh Double
-green_dbl_data =
-  R.map (get_g . rgb_to_dbl)
-  where
-    get_g :: (Double, Double, Double) -> Double
-    get_g (_, g, _) = g
-
-
-blue_dbl_data :: (Shape sh) => (ColorData sh) -> Array sh Double
-blue_dbl_data =
-  R.map (get_b . rgb_to_dbl)
-  where
-    get_b :: (Double, Double, Double) -> Double
-    get_b (_, _, b) = b
-
-
 
 z_slice :: Elt a => Int -> Array DIM3 a -> Array DIM2 a
 z_slice n arr =
   slice arr (Any :. n :. All :. All)
 
 
-transpose_zx :: Elt a => Array DIM3 a -> Array DIM3 a
-transpose_zx arr =
-  traverse arr
-           (\(Z :. zdim :. ydim :. xdim) -> (Z :. xdim :. ydim :. zdim))
-           (\_ -> (\(Z :. z :. y :. x) -> arr ! (Z :. x :. y :. z)))
-
-
-z_slice3 :: Elt a => Int -> Array DIM3 a -> Array DIM3 a
-z_slice3 n arr
-  | n == 0 = transpose_zx $ current R.++ next
-  | n == zdim-1 = transpose_zx $ previous R.++ current
-  | otherwise = transpose_zx $ previous R.++ current R.++ next
-  where
-    (Z :. zdim :. _ :. _) = extent arr
-    previous = transpose_zx $ reshape mri_slice3d (z_slice (n-1) arr)
-    current = transpose_zx $ reshape mri_slice3d (z_slice n arr)
-    next = transpose_zx $ reshape mri_slice3d (z_slice (n+1) arr)
-
 
 write_values_slice_to_bitmap :: Values2D -> FilePath -> IO ()
 write_values_slice_to_bitmap v3d path =