comparison libinterp/corefcn/__tiff__.cc @ 31197:1604c8812b67

Tiff: added numberOfDirectories method.
author magedrifaat <magedrifaat@gmail.com>
date Thu, 01 Sep 2022 01:56:20 +0200
parents 1da6d747bf78
children 93eb0d6e7f62
comparison
equal deleted inserted replaced
31196:1da6d747bf78 31197:1604c8812b67
124 else 124 else
125 { 125 {
126 TIFFSetErrorHandler (NULL); 126 TIFFSetErrorHandler (NULL);
127 TIFFSetWarningHandler (NULL); 127 TIFFSetWarningHandler (NULL);
128 } 128 }
129 }
130
131 bool
132 is_numeric_scalar (octave_value ov)
133 {
134 return ov.isnumeric () && ov.isreal () && ov.is_scalar_type ();
135 } 129 }
136 130
137 bool 131 bool
138 is_colormap (octave_value ov) 132 is_colormap (octave_value ov)
139 { 133 {
3186 #else 3180 #else
3187 err_disabled_feature ("numberOfTiles", "Tiff"); 3181 err_disabled_feature ("numberOfTiles", "Tiff");
3188 #endif 3182 #endif
3189 } 3183 }
3190 3184
3185 DEFUN (__tiff_number_of_directories__, args, ,
3186 "Get the number of tiles in the image")
3187 {
3188 #if defined (HAVE_TIFF)
3189 int nargin = args.length ();
3190
3191 if (nargin == 0)
3192 error ("No handle provided\n");
3193
3194 octave_tiff_handle *tiff_handle
3195 = octave_tiff_handle::get_tiff_handle (args(0));
3196 check_closed (tiff_handle);
3197
3198 set_internal_handlers ();
3199
3200 TIFF *tif = tiff_handle->get_file ();
3201
3202 double dir_count = static_cast<double> (TIFFNumberOfDirectories (tif));
3203 return ovl (dir_count);
3204 #else
3205 err_disabled_feature ("numberOfDirectories", "Tiff");
3206 #endif
3207 }
3208
3191 DEFUN (__tiff_compute_strip__, args, , 3209 DEFUN (__tiff_compute_strip__, args, ,
3192 "Get the strip index containing the given row") 3210 "Get the strip index containing the given row")
3193 { 3211 {
3194 #if defined (HAVE_TIFF) 3212 #if defined (HAVE_TIFF)
3195 int nargin = args.length (); 3213 int nargin = args.length ();