where
import Data.Array.Repa (
- Array,
- DIM1,
DIM3,
- Shape,
Z(..),
(:.)(..),
- index,
- reshape,
toList
)
-import Data.Array.Repa.IO.Vector (readVectorFromTextFile)
-
+import Values
--import Grid(make_grid, zoom)
-
-read_mri_data :: IO (Array DIM1 Int)
-read_mri_data = readVectorFromTextFile "./data/mridata.txt"
-
mri_shape :: DIM3
mri_shape = (Z :. 256 :. 256 :. 109)
main :: IO ()
main = do
- mridata <- read_mri_data
- let mridata2 = reshape mri_shape mridata
- let tmp = Data.Array.Repa.toList mridata2
+ mridata <- read_values_3d mri_shape "./data/mridata.txt"
+ let tmp = Data.Array.Repa.toList mridata
print tmp
-- let g = make_grid 1 (Data.Array.Repa.toList mridata2)
-- let output = zoom g 2
--- /dev/null
+module Values
+where
+
+import Data.Array.Repa (
+ Array,
+ DIM1,
+ DIM3,
+ reshape,
+ )
+
+import Data.Array.Repa.IO.Vector (readVectorFromTextFile)
+import System.FilePath ()
+
+
+type Values1D = Array DIM1 Double
+type Values3D = Array DIM3 Double
+
+read_values_1d :: FilePath -> IO Values1D
+read_values_1d path = readVectorFromTextFile path
+
+read_values_3d :: DIM3 -> FilePath -> IO Values3D
+read_values_3d sh path = do
+ one_d <- read_values_1d path
+ return $ reshape sh one_d