                         return x
 
 -- Manipulating image pixels
-setPixel :: (CInt,CInt) -> CDouble -> Image -> IO ()
-setPixel (x,y) v image = withGenImage image $ \img ->
-                          {#call wrapSet32F2D#} img y x v
-
-getPixel :: (CInt,CInt) -> Image -> CDouble
-getPixel (x,y) image = unsafePerformIO $ withGenImage image $ \img ->
-                          {#call wrapGet32F2D#} img y x
+--setPixel :: (CInt,CInt) -> CDouble -> Image c d -> IO ()
+--setPixel (x,y) v image = withGenImage image $ \img ->
+--                          {#call wrapSet32F2D#} img y x v
+
 
 getAllPixels image =  [getPixel (i,j) image 
                       | i <- [0..width-1 ]

                fun result
                return result

imageTo32F img = withGenImage img $ \image -> 
                creatingImage 
                 ({#call ensure32F #} image)
imageTo8Bit img = withGenImage img $ \image -> 
                creatingImage 
                 ({#call ensure8U #} image)
-- Ok. this is just the example why I need image types
withUniPtr with x fun = with x $ \y -> 
                    fun (castPtr y)

withGenImage = withUniPtr withImage

-- Manipulating regions of interest:
setROI (x,y) (w,h) image = withImage image $ \i -> 

     (xstep,ystep) = (fromIntegral space + w,fromIntegral space + h)
     edge = space`div`2
     resultPic = unsafePerformIO $ do
                    r <- create (rw,rh) 1
                    sequence_ [blit r i (edge +  x*xstep, edge + y*ystep) | y <- [0..v-1] , x <- [0..u-1] | i <- imgs ]
                    return r

