Mercurial > octave-libtiff
comparison libinterp/corefcn/__tiff__.cc @ 31191:8ada1e68d961
__tiff__.cc (F__tiff_imread__): added support for PixelRegion option.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Fri, 26 Aug 2022 23:30:55 +0200 |
parents | a91f2f79e58c |
children | 6a2bb6f4e41e |
comparison
equal
deleted
inserted
replaced
31190:a91f2f79e58c | 31191:8ada1e68d961 |
---|---|
3693 default: | 3693 default: |
3694 // FIXME: should this fallback to magick instead? | 3694 // FIXME: should this fallback to magick instead? |
3695 error ("Unsupported sample format"); | 3695 error ("Unsupported sample format"); |
3696 } | 3696 } |
3697 | 3697 |
3698 // Use octave_value methods to slice the data without knowledge of | |
3699 // the underlying data type to avoid code duplication | |
3700 // FIXME: this approach is slow when the needed region is much smaller | |
3701 // than the image size because the entire image will be read first | |
3702 octave_value_list idx (3); | |
3703 // Need to use range because normal idx_vector constuctor handles steps | |
3704 // in a wrong way (FIXME?) | |
3705 idx(0) = idx_vector (range<double> (row_region (0), row_region (1), | |
3706 row_region(2))); | |
3707 idx(1) = idx_vector (range<double> (col_region (0), col_region (1), | |
3708 col_region(2))); | |
3709 idx(2) = idx_vector (':'); | |
3710 retval(0) = retval(0).index_op (idx); | |
3711 | |
3698 if (nargout > 1) | 3712 if (nargout > 1) |
3699 { | 3713 { |
3700 // Also return the color map if available | 3714 // Also return the color map if available |
3701 uint16_t photometric; | 3715 uint16_t photometric; |
3702 if (TIFFGetField (tif, TIFFTAG_PHOTOMETRIC, &photometric) | 3716 if (TIFFGetField (tif, TIFFTAG_PHOTOMETRIC, &photometric) |