X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FVolumetric.hs;h=0d1dfaac641773cbc35e0f39147e6359f23613b1;hb=f720b869549f32762a03006b676afb484f7df64b;hp=5b24760a256b0cbc2477ff71f12009497a79deec;hpb=5de566481cadea0f1e258657ee2697ad643b77d5;p=spline3.git diff --git a/src/Volumetric.hs b/src/Volumetric.hs index 5b24760..0d1dfaa 100644 --- a/src/Volumetric.hs +++ b/src/Volumetric.hs @@ -40,7 +40,6 @@ import Data.Array.Repa.IO.Binary ( writeArrayToStorableFile ) import Data.Array.Repa.IO.BMP ( writeImageToBMP ) import Data.Array.Repa.Operators.Traversal ( unsafeTraverse ) -import Data.Array.Repa.Repr.Unboxed ( Unbox ) import Data.Array.Repa.Slice ( All( All ), Any( Any ) ) import Values ( Values, Values2D ) @@ -70,7 +69,7 @@ bracket :: Double -> Double -> Double -> Word16 bracket lower_threshold upper_threshold x | x < lower_threshold = 0 | x > upper_threshold = 255 - | otherwise = truncate (r * 255) + | otherwise = truncate (r * 255) where numerator = x - lower_threshold denominator = upper_threshold - lower_threshold @@ -138,9 +137,9 @@ values_to_colors arr = truncate_rgb (r, g, b) = (r', g', b') where - r' = truncate (r * 255) - g' = truncate (g * 255) - b' = truncate (b * 255) + r' = truncate (r * 255) :: Word8 + g' = truncate (g * 255) :: Word8 + b' = truncate (b * 255) :: Word8 write_values_to_bmp :: FilePath -> Values2D -> IO () @@ -149,6 +148,6 @@ write_values_to_bmp path values = do writeImageToBMP path colors -z_slice :: (Unbox a, Source r a) => Int -> Array r DIM3 a -> Array D DIM2 a +z_slice :: (Source r a) => Int -> Array r DIM3 a -> Array D DIM2 a z_slice n arr = slice arr (Any :. n :. All :. All)