# HG changeset patch # User magedrifaat # Date 1661549455 -7200 # Node ID 8ada1e68d9613f2de55def3242640b10d0303a35 # Parent a91f2f79e58ccc798c67460c566c052f42291a21 __tiff__.cc (F__tiff_imread__): added support for PixelRegion option. diff -r a91f2f79e58c -r 8ada1e68d961 libinterp/corefcn/__tiff__.cc --- a/libinterp/corefcn/__tiff__.cc Fri Aug 26 19:03:43 2022 +0200 +++ b/libinterp/corefcn/__tiff__.cc Fri Aug 26 23:30:55 2022 +0200 @@ -3695,6 +3695,20 @@ error ("Unsupported sample format"); } + // Use octave_value methods to slice the data without knowledge of + // the underlying data type to avoid code duplication + // FIXME: this approach is slow when the needed region is much smaller + // than the image size because the entire image will be read first + octave_value_list idx (3); + // Need to use range because normal idx_vector constuctor handles steps + // in a wrong way (FIXME?) + idx(0) = idx_vector (range (row_region (0), row_region (1), + row_region(2))); + idx(1) = idx_vector (range (col_region (0), col_region (1), + col_region(2))); + idx(2) = idx_vector (':'); + retval(0) = retval(0).index_op (idx); + if (nargout > 1) { // Also return the color map if available