From: Michael Orlitzky Date: Tue, 23 Aug 2011 03:07:00 +0000 (-0400) Subject: Begin playing with Repa. X-Git-Tag: 0.0.1~233 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=850eb18add24bc0b455b1691f3c979f80f8daec9;p=spline3.git Begin playing with Repa. --- diff --git a/src/Main.hs b/src/Main.hs index c4204c8..4b375cf 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,27 +1,35 @@ module Main where ---import Cube ---import Face ---import Grid ---import Misc (flatten) ---import Point ---import RealFunction ---import Tetrahedron ---import ThreeDimensional +import Data.Array.Repa ( + Array, + DIM1, + DIM3, + Shape, + Z(..), + (:.)(..), + index, + reshape, + toList + ) +import Data.Array.Repa.IO.Vector (readVectorFromTextFile) +--import Grid(make_grid, zoom) ---find_point_value :: RealFunction Point ---find_point_value p = poly p --- where --- g0 = make_grid 1 trilinear --- the_cubes = flatten (cubes g0) --- good_cubes = filter ((flip contains_point) p) the_cubes --- target_cube = head good_cubes --- good_tets = filter ((flip contains_point) p) (tetrahedrons target_cube) --- target_tetrahedron = head good_tets --- poly = polynomial target_tetrahedron + +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 = putStrLn "Hello, World." +main = do + mridata <- read_mri_data + let mridata2 = reshape mri_shape mridata + let tmp = Data.Array.Repa.toList mridata2 + print tmp +-- let g = make_grid 1 (Data.Array.Repa.toList mridata2) +-- let output = zoom g 2 +-- print "Hello, world."