2015-01-09 01:44:41 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_TIFF)
|
|
|
|
|
2014-12-08 19:52:52 +00:00
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
#include <mapnik/image_reader.hpp>
|
|
|
|
#include <mapnik/image_util.hpp>
|
|
|
|
#include <mapnik/util/file_io.hpp>
|
2015-01-09 01:44:41 +00:00
|
|
|
|
2014-12-08 19:52:52 +00:00
|
|
|
#include <mapnik/tiff_io.hpp>
|
|
|
|
#include "../../src/tiff_reader.cpp"
|
|
|
|
|
|
|
|
#define TIFF_ASSERT(filename) \
|
|
|
|
mapnik::tiff_reader<boost::iostreams::file_source> tiff_reader(filename); \
|
|
|
|
REQUIRE( tiff_reader.width() == 256 ); \
|
|
|
|
REQUIRE( tiff_reader.height() == 256 ); \
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.planar_config() == PLANARCONFIG_CONTIG ); \
|
2014-12-09 03:58:44 +00:00
|
|
|
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"tiff")); \
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( reader->width() == 256 ); \
|
|
|
|
REQUIRE( reader->height() == 256 ); \
|
2014-12-09 03:58:44 +00:00
|
|
|
mapnik::util::file file(filename); \
|
|
|
|
mapnik::tiff_reader<boost::iostreams::array_source> tiff_reader2(file.data().get(),file.size()); \
|
|
|
|
REQUIRE( tiff_reader2.width() == 256 ); \
|
|
|
|
REQUIRE( tiff_reader2.height() == 256 ); \
|
|
|
|
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(file.data().get(),file.size())); \
|
|
|
|
REQUIRE( reader2->width() == 256 ); \
|
|
|
|
REQUIRE( reader2->height() == 256 ); \
|
2014-12-08 22:04:05 +00:00
|
|
|
|
2015-01-14 18:42:30 +00:00
|
|
|
#define TIFF_ASSERT_ALPHA( data ) \
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.has_alpha() == true ); \
|
|
|
|
REQUIRE( reader->has_alpha() == true ); \
|
2014-12-09 03:58:44 +00:00
|
|
|
REQUIRE( tiff_reader2.has_alpha() == true ); \
|
|
|
|
REQUIRE( reader2->has_alpha() == true ); \
|
2015-01-24 00:08:59 +00:00
|
|
|
REQUIRE( data.get_premultiplied() == true ); \
|
2014-12-08 22:04:05 +00:00
|
|
|
|
2015-01-25 02:48:15 +00:00
|
|
|
#define TIFF_ASSERT_NO_ALPHA_RGB( data ) \
|
|
|
|
REQUIRE( tiff_reader.has_alpha() == false ); \
|
|
|
|
REQUIRE( reader->has_alpha() == false ); \
|
|
|
|
REQUIRE( tiff_reader2.has_alpha() == false ); \
|
|
|
|
REQUIRE( reader2->has_alpha() == false ); \
|
|
|
|
REQUIRE( data.get_premultiplied() == true ); \
|
|
|
|
|
|
|
|
#define TIFF_ASSERT_NO_ALPHA_GRAY( data ) \
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.has_alpha() == false ); \
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( reader->has_alpha() == false ); \
|
2014-12-09 03:58:44 +00:00
|
|
|
REQUIRE( tiff_reader2.has_alpha() == false ); \
|
|
|
|
REQUIRE( reader2->has_alpha() == false ); \
|
2015-01-14 18:42:30 +00:00
|
|
|
REQUIRE( data.get_premultiplied() == false ); \
|
2014-12-08 19:52:52 +00:00
|
|
|
|
2014-12-08 23:45:00 +00:00
|
|
|
#define TIFF_ASSERT_SIZE( data,reader ) \
|
|
|
|
REQUIRE( data.width() == reader->width() ); \
|
|
|
|
REQUIRE( data.height() == reader->height() ); \
|
|
|
|
|
|
|
|
#define TIFF_READ_ONE_PIXEL \
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any subimage = reader->read(1, 1, 1, 1); \
|
2014-12-08 23:45:00 +00:00
|
|
|
REQUIRE( subimage.width() == 1 ); \
|
|
|
|
REQUIRE( subimage.height() == 1 ); \
|
|
|
|
|
2014-12-08 19:52:52 +00:00
|
|
|
TEST_CASE("tiff io") {
|
|
|
|
|
2014-12-09 06:15:09 +00:00
|
|
|
SECTION("scan rgb8 striped") {
|
|
|
|
std::string filename("./tests/data/tiff/scan_512x512_rgb8_striped.tif");
|
|
|
|
mapnik::tiff_reader<boost::iostreams::file_source> tiff_reader(filename);
|
|
|
|
REQUIRE( tiff_reader.width() == 512 );
|
|
|
|
REQUIRE( tiff_reader.height() == 512 );
|
|
|
|
REQUIRE( tiff_reader.planar_config() == PLANARCONFIG_CONTIG );
|
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 16 );
|
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_PALETTE );
|
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
|
|
|
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"tiff"));
|
|
|
|
REQUIRE( reader->width() == 512 );
|
|
|
|
REQUIRE( reader->height() == 512 );
|
|
|
|
mapnik::util::file file(filename);
|
|
|
|
mapnik::tiff_reader<boost::iostreams::array_source> tiff_reader2(file.data().get(),file.size());
|
|
|
|
REQUIRE( tiff_reader2.width() == 512 );
|
|
|
|
REQUIRE( tiff_reader2.height() == 512 );
|
|
|
|
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(file.data().get(),file.size()));
|
|
|
|
REQUIRE( reader2->width() == 512 );
|
|
|
|
REQUIRE( reader2->height() == 512 );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-09 06:15:09 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_RGB( data );
|
2014-12-09 06:15:09 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("scan rgb8 tiled") {
|
|
|
|
std::string filename("./tests/data/tiff/scan_512x512_rgb8_tiled.tif");
|
|
|
|
mapnik::tiff_reader<boost::iostreams::file_source> tiff_reader(filename);
|
|
|
|
REQUIRE( tiff_reader.width() == 512 );
|
|
|
|
REQUIRE( tiff_reader.height() == 512 );
|
|
|
|
REQUIRE( tiff_reader.planar_config() == PLANARCONFIG_CONTIG );
|
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_PALETTE );
|
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
|
|
|
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"tiff"));
|
|
|
|
REQUIRE( reader->width() == 512 );
|
|
|
|
REQUIRE( reader->height() == 512 );
|
|
|
|
mapnik::util::file file(filename);
|
|
|
|
mapnik::tiff_reader<boost::iostreams::array_source> tiff_reader2(file.data().get(),file.size());
|
|
|
|
REQUIRE( tiff_reader2.width() == 512 );
|
|
|
|
REQUIRE( tiff_reader2.height() == 512 );
|
|
|
|
std::unique_ptr<mapnik::image_reader> reader2(mapnik::get_image_reader(file.data().get(),file.size()));
|
|
|
|
REQUIRE( reader2->width() == 512 );
|
|
|
|
REQUIRE( reader2->height() == 512 );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-09 06:15:09 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_RGB( data );
|
2014-12-09 06:15:09 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("rgba8 striped") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_rgba8_striped.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 1 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
2014-12-08 23:13:23 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_ADOBE_DEFLATE );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-14 18:42:30 +00:00
|
|
|
TIFF_ASSERT_ALPHA( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("rgba8 tiled") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_rgba8_tiled.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-14 18:42:30 +00:00
|
|
|
TIFF_ASSERT_ALPHA( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("rgb8 striped") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_rgb8_striped.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 10 );
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_RGB( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("rgb8 tiled") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_rgb8_tiled.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_RGB );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 02:31:02 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_rgba8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_RGB( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("gray8 striped") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray8_striped.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 32 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2014-12-08 22:04:05 +00:00
|
|
|
SECTION("gray8 tiled") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray8_tiled.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 8 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray8>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 22:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("gray16 striped") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray16_striped.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 16 );
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 16 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray16>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 22:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("gray16 tiled") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray16_tiled.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
2014-12-08 22:04:05 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 16 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray16>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("gray32f striped") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray32f_striped.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 8 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 32 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == false );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 0 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 0 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_NONE );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray32f>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("gray32f tiled") {
|
|
|
|
TIFF_ASSERT("./tests/data/tiff/ndvi_256x256_gray32f_tiled.tif")
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.rows_per_strip() == 0 );
|
2014-12-08 19:52:52 +00:00
|
|
|
REQUIRE( tiff_reader.bits_per_sample() == 32 );
|
|
|
|
REQUIRE( tiff_reader.is_tiled() == true );
|
2014-12-08 20:23:06 +00:00
|
|
|
REQUIRE( tiff_reader.tile_width() == 256 );
|
|
|
|
REQUIRE( tiff_reader.tile_height() == 256 );
|
2014-12-08 22:16:56 +00:00
|
|
|
REQUIRE( tiff_reader.photometric() == PHOTOMETRIC_MINISBLACK );
|
2014-12-09 05:17:02 +00:00
|
|
|
REQUIRE( tiff_reader.compression() == COMPRESSION_LZW );
|
2015-01-22 01:40:12 +00:00
|
|
|
mapnik::image_any data = reader->read(0, 0, reader->width(), reader->height());
|
2015-01-22 03:08:04 +00:00
|
|
|
REQUIRE( data.is<mapnik::image_gray32f>() == true );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_ASSERT_SIZE( data,reader );
|
2015-01-25 02:48:15 +00:00
|
|
|
TIFF_ASSERT_NO_ALPHA_GRAY( data );
|
2014-12-08 23:45:00 +00:00
|
|
|
TIFF_READ_ONE_PIXEL
|
2014-12-08 19:52:52 +00:00
|
|
|
}
|
|
|
|
|
2015-01-09 01:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|