45 int mult = (type == Isis::UnsignedByte) ? 1 : 2;
53 "Could not allocate enough memory",
_FILEINFO_);
68 QString compression) {
70 outputName = outputName.addExtension(
extension());
73 m_image = TIFFOpen(outputName.expanded().toLatin1().data(),
"w");
82 TIFFSetField(
m_image, TIFFTAG_ROWSPERSTRIP, 1);
83 if (compression ==
"packbits") {
84 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
86 else if (compression ==
"lzw") {
87 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
89 else if (compression ==
"deflate") {
90 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_ADOBE_DEFLATE);
92 else if (compression ==
"none") {
93 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
96 QString msg =
"Invalid TIFF compression algorithm: " + compression;
99 TIFFSetField(
m_image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
100 TIFFSetField(
m_image, TIFFTAG_PHOTOMETRIC,
101 bands() == 1 ? PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB);
104 int bps = (type == Isis::UnsignedByte) ? 8 : 16;
105 TIFFSetField(
m_image, TIFFTAG_BITSPERSAMPLE, bps);
107 TIFFSetField(
m_image, TIFFTAG_SAMPLESPERPIXEL,
bands());
123 int index = s *
bands() + b;
127 m_raster[index] = (
unsigned char) dn;
130 ((
short int *)
m_raster)[index] = (
short int) dn;
133 ((
short unsigned int *)
m_raster)[index] = (
short unsigned int) dn;
137 "Invalid pixel type for data [" +
toString(type) +
"]",
164 return format ==
"tiff";
static bool canWriteFormat(QString format)
Returns true if the format is "tiff".
int samples() const
Number of samples (columns) in the output image.
File name manipulation and expansion.
virtual void createBuffer()
Creates the buffer to store a chunk of streamed line data with one or more bands. ...
virtual void writeLine(int l) const
Writes a line of buffered data to the output image on disk.
virtual void setBuffer(int s, int b, int dn) const
Set the DN value at the given sample and band, resolved to a single index, of the line buffer...
TIFF * m_image
Object responsible for writing data to the output image.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
This error is for when a programmer made an API call that was illegal.
void setExtension(QString extension)
Sets the extension for the output image and generates the extension for the world file from it...
PixelType pixelType() const
Returns the pixel type.
int bands() const
Number of bands (channels) in the output image.
int lines() const
Number of lines (rows) in the output image.
QString extension() const
Gets the extension for the output image.
PixelType
Enumerations for Isis Pixel Types.
#define _FILEINFO_
Macro for the filename and line number.
unsigned char * m_raster
Array containing all color channels for a line.
A type of error that cannot be classified as any of the other error types.
virtual ~TiffExporter()
Destruct the exporter.
TiffExporter()
Construct the TIFF exporter.
virtual void write(FileName outputName, int quality=100, QString compression="none")
Export the Isis cube channels to the given standard image.
Exports cubes into a standard format in incremental pieces.
virtual void write(FileName outputName, int quality=100, QString compression="none")
Open the output file for writing, initialize its fields, then let the base ImageExporter handle the g...