-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2f5a2e
commit 8e5f78b
Showing
11 changed files
with
190 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
Package: rtiff | ||
Type: Package | ||
Title: A tiff reader for R. | ||
Version: 1.0 | ||
Date: 2005-12-20 | ||
Depends: pixmap | ||
Author: Eric Kort | ||
Maintainer: Eric Kort <eric.kort@vai.org> | ||
SystemRequirements: libtiff | ||
Description: This package will read TIFF format images and return them as a pixmap object. Because the resulting object can be very large for even modestly sized TIFF images, images can be reduced as they are read for improved performance. This package is a wrapper around libtiff (www.libtiff.org), on which it depends (i.e. the libtiff shared library must be on your PATH for the binary to work, and tiffio.h must be on your system to build the package from source). By using libtiff's highlevel TIFFReadRGBAImage function, this package inherently support a wide range of image formats and compression schemes. This package also provides an implementation of the Ridler Autothresholding algorithm for easy generation of binary masks. NOTE TO SOURCE COMPILERS: Due to what appears to be a bug in GCC optimization, this package uses a simple custom Makefile in the src directory to ensure that compiler optimization is skipped. The Makefile is not sophisticated, and assumes you are using gcc as your compiler. Please contact the author if this is problematic. | ||
License: GPL | ||
Packaged: Tue Dec 27 13:43:32 2005; erikor | ||
Package: rtiff | ||
Type: Package | ||
Title: A tiff reader for R. | ||
Version: 1.1 | ||
Date: 2006-12-05 | ||
Depends: pixmap | ||
Author: Eric Kort | ||
Maintainer: Eric Kort <eric.kort@vai.org> | ||
SystemRequirements: libtiff | ||
Description: This package will read (and, as of version 1.1, write) TIFF format images and return them as a pixmap object. Because the resulting object can be very large for even modestly sized TIFF images, images can be reduced as they are read for improved performance. This package is a wrapper around libtiff (www.libtiff.org), on which it depends (i.e. the libtiff shared library must be on your PATH for the binary to work, and tiffio.h must be on your system to build the package from source). By using libtiff's highlevel TIFFReadRGBAImage function, this package inherently support a wide range of image formats and compression schemes. This package also provides an implementation of the Ridler Autothresholding algorithm for easy generation of binary masks. | ||
License: GPL | ||
Packaged: Tue Dec 5 16:56:06 2006; eric.kort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
export( | ||
readTiff, | ||
writeTiff, | ||
autoThreshold, | ||
newPixmapRGB, | ||
plot.matrix) | ||
|
||
S3method(plot, matrix) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"writeTiff" <- | ||
function(pixmap, fn) { | ||
if(class(pixmap) == "pixmapRGB"){ | ||
.Call("writeTiff", pixmap@red, pixmap@green, pixmap@blue, fn, PACKAGE="rtiff") | ||
} else if(class(pixmap) == "matrix") { | ||
pixmap = newPixmapRGB(pixmap, pixmap, pixmap); | ||
.Call("writeTiff", pixmap@red, pixmap@green, pixmap@blue, fn, PACKAGE="rtiff") | ||
} else { | ||
stop(paste("writeTiff expects a pixmapRGB or matrix, got ", class(pixmap))) | ||
} | ||
gc(); | ||
return(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
\name{readTiff} | ||
\alias{readTiff} | ||
\title{ A function to load TIFF images into a pixmap. } | ||
\description{ | ||
Loads a TIFF image from a file and returns the image as a pixmap object, with optional scaling. | ||
} | ||
\usage{ | ||
readTiff(fn, page = 1, reduce = 0) | ||
} | ||
%- maybe also 'usage' for other objects documented here. | ||
\arguments{ | ||
\item{fn}{ Filename (the tiff image to load) } | ||
\item{page}{ In the case of multi-page tiffs, which page do you want? } | ||
\item{reduce}{ Optional scaling factor to improve performance with large images, | ||
should be a value between 0 and 1 (i.e. a decimal representation of | ||
a percentage). See details. } | ||
} | ||
\details{ | ||
|
||
|
||
This package is a wrapper around libtiff (www.libtiff.org), on which it depends. By using libtiff's | ||
highlevel TIFFReadRGBAImage function, this package inherently support a wide range of image formats | ||
and compression schemes (interestingly, thanks to libtiff, this package can load a number of TIFF formats | ||
that tools like Window's Paint or the open source Gimp application will not load). | ||
|
||
High resolution images (by which I mean images that contain a "large" number of pixels) will occupy | ||
quite a bit of memory and will also plot very slowly. If you do not need all the resolution for your | ||
purposes, you scan specify a scaling factor (reduce=x) to downsample the image. The factor is the | ||
amount you want the image scaled BY, not TO. In otherwords, reduce=.90 will reduce the image by 90%, | ||
yielding an image 10% the size of the orginal. The scaling is not sophisticated...a nearest neighbor | ||
approach is used. Since we are reducing and not enlarging, I hope this will be suitable for your | ||
applications. | ||
|
||
For simplicity, an RGB pixmap is generated regardless of the colorspace of the original image (including | ||
grayscale images, in which case the R, G, and B rasters are identical). The pixmap object requires | ||
pixel intensities to be between 0 and 1, so the intensities in the orginal image file are scaled | ||
accordingly. | ||
|
||
} | ||
\value{ | ||
A pixmap object containing the image rasters. | ||
} | ||
|
||
\author{ Eric Kort <eric.kort@vai.org> } | ||
|
||
|
||
\examples{ | ||
|
||
library(rtiff) | ||
tif <- readTiff(paste(.path.package("rtiff"), "/tiff/jello.tif", sep="")) | ||
plot(tif) | ||
|
||
|
||
} | ||
|
||
\keyword{ utilities } | ||
\keyword{ IO } | ||
\keyword{ file } | ||
\name{readTiff} | ||
\alias{readTiff} | ||
\title{ A function to load TIFF images into a pixmap. } | ||
\description{ | ||
Loads a TIFF image from a file and returns the image as a pixmap object, with optional scaling. | ||
} | ||
\usage{ | ||
readTiff(fn, page = 0, reduce = 0) | ||
} | ||
%- maybe also 'usage' for other objects documented here. | ||
\arguments{ | ||
\item{fn}{ Filename (the tiff image to load) } | ||
\item{page}{ In the case of multi-page tiffs, which page do you want? } | ||
\item{reduce}{ Optional scaling factor to improve performance with large images, | ||
should be a value between 0 and 1 (i.e. a decimal representation of | ||
a percentage). See details. } | ||
} | ||
\details{ | ||
|
||
|
||
This package is a wrapper around libtiff (www.libtiff.org), on which it depends. By using libtiff's | ||
highlevel TIFFReadRGBAImage function, this package inherently support a wide range of image formats | ||
and compression schemes (interestingly, thanks to libtiff, this package can load a number of TIFF formats | ||
that tools like Window's Paint or the open source Gimp application will not load). | ||
|
||
High resolution images (by which I mean images that contain a "large" number of pixels) will occupy | ||
quite a bit of memory and will also plot very slowly. If you do not need all the resolution for your | ||
purposes, you scan specify a scaling factor (reduce=x) to downsample the image. The factor is the | ||
amount you want the image scaled BY, not TO. In otherwords, reduce=.90 will reduce the image by 90%, | ||
yielding an image 10% the size of the orginal. The scaling is not sophisticated...a nearest neighbor | ||
approach is used. Since we are reducing and not enlarging, I hope this will be suitable for your | ||
applications. | ||
|
||
For simplicity, an RGB pixmap is generated regardless of the colorspace of the original image (including | ||
grayscale images, in which case the R, G, and B rasters are identical). The pixmap object requires | ||
pixel intensities to be between 0 and 1, so the intensities in the orginal image file are scaled | ||
accordingly. | ||
|
||
} | ||
\value{ | ||
A pixmap object containing the image rasters. | ||
} | ||
|
||
\author{ Eric Kort <eric.kort@vai.org> } | ||
|
||
|
||
\examples{ | ||
|
||
library(rtiff) | ||
tif <- readTiff(paste(.path.package("rtiff"), "/tiff/jello.tif", sep="")) | ||
plot(tif) | ||
|
||
|
||
} | ||
|
||
\keyword{ utilities } | ||
\keyword{ IO } | ||
\keyword{ file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
\name{writeTiff} | ||
\alias{writeTiff} | ||
\title{ A function to load TIFF images into a pixmap. } | ||
\description{ | ||
Loads a TIFF image from a file and returns the image as a pixmap object, with optional scaling. | ||
} | ||
\usage{ | ||
writeTiff(pixmap, fn) | ||
} | ||
%- maybe also 'usage' for other objects documented here. | ||
\arguments{ | ||
\item{pixmap}{ Either a pixmapRGB or matrix containing the image to save. In the case of a matrix, | ||
a new pixmapRGB will be created from it. The resulting TIFF file will be RGB, but | ||
will appear grey because each channel will be identical. } | ||
\item{fn}{ What to call the new tiff file. } | ||
} | ||
\details{ | ||
|
||
This function saves the given pixmap or matrix raster as an unencrypted TIFF image, utilizing libtiff's | ||
TIFFWriteEncodedStrip, with the entire raster in a single strip (for simplicity). | ||
} | ||
\value{ | ||
None. Used for its handy side effect of creating a tiff file. | ||
} | ||
\author{ Eric Kort <eric.kort@vai.org> } | ||
\examples{ | ||
library(rtiff) | ||
tif <- readTiff(paste(.path.package("rtiff"), "/tiff/jello.tif", sep="")) | ||
writeTiff(tif@red, "atesttif.tif") | ||
} | ||
\keyword{ utilities } | ||
\keyword{ IO } | ||
\keyword{ file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters