
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## cat readWriteTest.R | R --vanilla &>readWriteTest.Rout.save
> 
> library("EBImage")
> 
> ## Fetch test images frome the on-line respository
> repositoryURL  = "http://www-huber.embl.de/EBImage/ExampleImages"
> 
> testImages = c(	
+   "lena.jpg",		# JPEG Greyscale
+   "lena-color.jpg",	# JPEG Color
+   "dices-grey.png",	# PNG GA
+   "dices.png",		# PNG RGBA
+   "photo_16b.png",	# PNG RGB 16bps
+   "dices-grey.tif",	# TIFF GA 8bps
+   "photo_8b.tif",	# TIFF RGB 8bps
+   "lena-original.tif",	# TIFF RGB 8bps
+   "dices.tif",		# TIFF RGBA 8bps
+   "nuc.tif",		# TIFF G 16bps
+   "photo_16b.tif"	# TIFF RGB 8bps multiple pages
+ )
> 
> names(testImages) = rep(repositoryURL, length(testImages))
> 
> for (i in seq_along(testImages))
+   if (!file.exists(testImages[i]))
+     system(paste("wget ", names(testImages)[i], "/", testImages[i], sep=""))
> 
> ## Append package test images
> 
> packageTestImages = list.files(system.file("images", package="EBImage"), full.names=TRUE)
> names(packageTestImages) =  list.files(system.file("images", package="EBImage"))
> names(testImages) = testImages
> testImages = c(testImages, packageTestImages)
> 
> ## Actual tests
> 
> tempdir = file.path(tempdir(),"copies")
> dir.create(tempdir)
> 
> for (i in seq_along(testImages)) {
+   original = readImage(testImages[i])
+   filename = names(testImages)[i]
+   tempfile = file.path(tempdir, filename)
+   writeImage(original, tempfile)
+   copy = readImage(tempfile)
+   cat(filename, rep(" ", 40-nchar(filename)), if(identical(original, copy)) "PASS" else "FAIL", "\n", sep="")	
+ }
lena.jpg                                FAIL
lena-color.jpg                          FAIL
dices-grey.png                          PASS
dices.png                               PASS
photo_16b.png                           FAIL
image 800 x 600 x 0, tiles 0 x 0, bps = 8, spp = 2 (output 2), config = 1, colormap = no
image 800 x 600 x 0, tiles 0 x 0, bps = 8, spp = 2 (output 2), config = 1, colormap = no
dices-grey.tif                          PASS
image 768 x 1152 x 0, tiles 0 x 0, bps = 8, spp = 3 (output 3), config = 1, colormap = no
image 768 x 1152 x 0, tiles 0 x 0, bps = 8, spp = 3 (output 3), config = 1, colormap = no
photo_8b.tif                            PASS
image 512 x 512 x 0, tiles 0 x 0, bps = 8, spp = 3 (output 3), config = 1, colormap = no
image 512 x 512 x 0, tiles 0 x 0, bps = 8, spp = 3 (output 3), config = 1, colormap = no
lena-original.tif                       PASS
image 800 x 600 x 0, tiles 0 x 0, bps = 8, spp = 4 (output 4), config = 1, colormap = no
image 800 x 600 x 0, tiles 0 x 0, bps = 8, spp = 4 (output 4), config = 1, colormap = no
dices.tif                               PASS
image 2048 x 2048 x 0, tiles 0 x 0, bps = 16, spp = 1 (output 1), config = 1, colormap = no
image 2048 x 2048 x 0, tiles 0 x 0, bps = 16, spp = 1 (output 1), config = 1, colormap = no
nuc.tif                                 PASS
image 768 x 1152 x 0, tiles 0 x 0, bps = 16, spp = 3 (output 3), config = 1, colormap = no
image 768 x 1152 x 0, tiles 0 x 0, bps = 16, spp = 3 (output 3), config = 1, colormap = no
photo_16b.tif                           PASS
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
cells.tif                               PASS
lena-color.png                          PASS
lena.png                                PASS
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
image 510 x 510 x 0, tiles 0 x 0, bps = 8, spp = 1 (output 1), config = 1, colormap = no
nuclei.tif                              PASS
shapes.png                              PASS
> 
> unlink(tempdir, recursive=TRUE)
> 
