45 int mult = (type == Isis::UnsignedByte) ? 1 : 2;
53 "Could not allocate enough memory",
_FILEINFO_);
68 QString compression) {
70 m_image = TIFFOpen(outputName.expanded().toAscii().data(),
"w");
79 TIFFSetField(
m_image, TIFFTAG_ROWSPERSTRIP, 1);
80 if (compression ==
"packbits") {
81 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
83 else if (compression ==
"lzw") {
84 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
86 else if (compression ==
"deflate") {
87 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_ADOBE_DEFLATE);
89 else if (compression ==
"none") {
90 TIFFSetField(
m_image, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
93 QString msg =
"Invalid TIFF compression algorithm: " + compression;
96 TIFFSetField(
m_image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
97 TIFFSetField(
m_image, TIFFTAG_PHOTOMETRIC,
98 bands() == 1 ? PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB);
101 int bps = (type == Isis::UnsignedByte) ? 8 : 16;
102 TIFFSetField(
m_image, TIFFTAG_BITSPERSAMPLE, bps);
104 TIFFSetField(
m_image, TIFFTAG_SAMPLESPERPIXEL,
bands());
120 int index = s *
bands() + b;
124 m_raster[index] = (
unsigned char) dn;
127 ((
short int *)
m_raster)[index] = (
short int) dn;
130 ((
short unsigned int *)
m_raster)[index] = (
short unsigned int) dn;
134 "Invalid pixel type for data [" +
toString(type) +
"]",
161 return format ==
"tiff";