Mercurial > octave-libtiff
annotate scripts/io/Tiff.m @ 31217:c09f6a3597e6 default tip gsoc-libtiff
__tiff__.cc: handled unused parameter warning when Tiff is not enabled
* libtinerp/corefcn/__tiff__.cc: added appropriate hadnling for unused
parameters for cases when Octave is compiled without Tiff support to
suppress compiler warnings in that case.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Wed, 07 Sep 2022 18:39:10 +0200 |
parents | ddbed40b811b |
children |
rev | line source |
---|---|
31177
c7c79973007f
Tiff: added octave_tiff_handle class to wrap the Tiff file pointer
magedrifaat <magedrifaat@gmail.com>
parents:
31173
diff
changeset
|
1 classdef Tiff |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
2 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
3 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
4 ## @deftypefn {} {@var{t} =} Tiff (@var{filename}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
5 ## @deftypefnx {} {@var{t} =} Tiff (@var{filename}, @var{mode}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
6 ## Open a TIFF image file |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
7 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
8 ## Open the TIFF image file @var{filename} in file mode @var{mode}. If |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
9 ## @var{mode} is not provided, the file is opened for reading. Both |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
10 ## @var{filename} and @var{mode} must be strings. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
11 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
12 ## The @var{mode} parameter can be one of the following options: |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
13 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
14 ## @table @asis |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
15 ## @item @qcode{"r"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
16 ## Open file for reading. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
17 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
18 ## @item @qcode{"w"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
19 ## Open file for writing and discard existing data. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
20 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
21 ## @item @qcode{"a"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
22 ## Open or create file for appending. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
23 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
24 ## @item @qcode{"w8"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
25 ## Open BigTIFF file for writing and discard existing data. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
26 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
27 ## @item @qcode{"r+"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
28 ## Open exisiting file for both reading and writing. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
29 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
30 ## @end table |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
31 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
32 ## The return value @var{t} is an object of the Tiff class. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
33 ## @seealso{imread, imwrite} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
34 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
35 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
36 properties (Constant = true) |
31185
a1145ac2ce9b
Tiff: populated TagID from the C++ map to avoid having two copies
magedrifaat <magedrifaat@gmail.com>
parents:
31179
diff
changeset
|
37 TagID = __tiff_make_tagid__ (); |
31159
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
38 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
39 Compression = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
40 "None", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
41 "CCITTRLE", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
42 "CCITTFax3", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
43 "CCITTFax4", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
44 "LZW", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
45 "OJPEG", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
46 "JPEG", 7, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
47 "AdobeDeflate", 8, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
48 "Next", 32766, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
49 "CCITTRLEW", 32771, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
50 "PackBits", 32773, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
51 "Thunderscan", 32809, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
52 "IT8CTPad", 32895, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
53 "IT8LW", 32896, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
54 "IT8MP", 32897, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
55 "IT8BL", 32898, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
56 "PixarFilm", 32908, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
57 "PixarLog", 32909, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
58 "Deflate", 32946, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
59 "DCS", 32947, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
60 "JBIG", 34661, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
61 "SGILog", 34676, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
62 "SGILog24", 34677, |
31186
90eccc78d958
__tiff__.cc (get_field_data, set_field_data): added support for complex tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31185
diff
changeset
|
63 # Not implemented in LibTIFF |
31159
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
64 "JPEG2000", 34712, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
65 "JPEG2000_SVS_YCbCr", 33003, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
66 "JPEG2000_SVS_RGB", 33005 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
67 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
68 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
69 ExtraSamples = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
70 "Unspecified", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
71 "AssociatedAlpha", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
72 "UnassociatedAlpha", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
73 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
74 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
75 Group3Options = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
76 "Encoding2D", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
77 "Uncompressed", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
78 "FillBits", 4 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
79 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
80 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
81 InkSet = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
82 "CMYK", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
83 "MultiInk", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
84 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
85 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
86 JPEGColorMode = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
87 "Raw", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
88 "RGB", 1 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
89 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
90 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
91 Orientation = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
92 "TopLeft", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
93 "TopRight", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
94 "BottomRight", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
95 "BottomLeft", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
96 "LeftTop", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
97 "RightTop", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
98 "RightBottom", 7, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
99 "LeftBottom", 8 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
100 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
101 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
102 Photometric = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
103 "MinIsWhite", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
104 "MinIsBlack", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
105 "RGB", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
106 "Palette", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
107 "Mask", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
108 "Separated", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
109 "YCbCr", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
110 "CIELab", 8, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
111 "ICCLab", 9, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
112 "ITULab", 10, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
113 "LogL", 32844, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
114 "LogLUV", 32845, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
115 "CFA", 32803, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
116 "LinearRaw", 34892 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
117 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
118 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
119 PlanarConfiguration = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
120 "Chunky", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
121 "Separate", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
122 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
123 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
124 ResolutionUnit = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
125 "None", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
126 "Inch", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
127 "Centimeter", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
128 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
129 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
130 SampleFormat = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
131 "UInt", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
132 "Int", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
133 "IEEEFP", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
134 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
135 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
136 SGILogDataFmt = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
137 "Float", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
138 "Bits8", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
139 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
140 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
141 SubFileType = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
142 "Default", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
143 "ReducedImage", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
144 "Page", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
145 "Mask", 4 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
146 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
147 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
148 Thresholding = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
149 "BiLevel", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
150 "HalfTone", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
151 "ErrorDiffuse", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
152 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
153 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
154 YCbCrPositioning = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
155 "Centered", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
156 "Cosited", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
157 ); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
158 endproperties |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
159 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
160 properties (Access = private) |
31141
af4519cbfcae
Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents:
31140
diff
changeset
|
161 tiff_handle; |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
162 endproperties |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
163 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
164 methods |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
165 function t = Tiff (filename, mode="r") |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
166 if (nargin == 0 || nargin > 2) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
167 print_usage("Tiff"); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
168 endif |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
169 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
170 t.tiff_handle = __open_tiff__ (filename, mode); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
171 endfunction |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
172 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
173 function close (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
174 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
175 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
176 ## @deftypefn {} Tiff.close () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
177 ## Close the TIFF file opened by this object. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
178 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
179 |
31177
c7c79973007f
Tiff: added octave_tiff_handle class to wrap the Tiff file pointer
magedrifaat <magedrifaat@gmail.com>
parents:
31173
diff
changeset
|
180 __close_tiff__ (t.tiff_handle); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
181 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
182 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
183 function tag = getTag (t, tag_name) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
184 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
185 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
186 ## @deftypefn {} {@var{tag} =} Tiff.getTag (@var{tag_id}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
187 ## @deftypefnx {} {@var{tag} =} Tiff.getTag (@var{tag_name}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
188 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
189 ## Get the value of a tag in the image identified by either its ID |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
190 ## number @var{tag_id} or its name @var{tag_name}. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
191 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
192 ## To get the ID of a known tag use the @code{Tiff.TagID} structure. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
193 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
194 ## An example for getting the image width tag: |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
195 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
196 ## @example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
197 ## t = Tiff ("example.tif"); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
198 ## width = t.getTag (256); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
199 ## width = t.getTag (Tiff.TagID.ImageWidth); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
200 ## width = t.getTag ("ImageWidth"); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
201 ## @end example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
202 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
203 ## @seealso{setTag, getTagNames} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
204 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
205 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
206 tag = __tiff_get_tag__ (t.tiff_handle, tag_name); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
207 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
208 |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
209 function setTag (t, varargin) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
210 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
211 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
212 ## @deftypefn {} Tiff.setTag (@var{tag_id}, @var{tag_value}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
213 ## @deftypefnx {} Tiff.setTag (@var{tag_name}, @var{tag_value}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
214 ## @deftypefnx {} Tiff.setTag (@var{tag_struct}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
215 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
216 ## Set the value of tag identified by its ID number @var{tag_id} or |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
217 ## by its name @var{tag_name}, or set the value of a list of tags |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
218 ## arranged in a struct @var{tag_struct}. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
219 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
220 ## To get the ID of a tag use the @code{Tiff.TagID} structure. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
221 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
222 ## An example of setting the image width: |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
223 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
224 ## @example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
225 ## t = Tiff ("test.tif", "w"); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
226 ## t.setTag (256, 100); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
227 ## t.setTag (Tiff.TagID.ImageWidth, 100); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
228 ## t.setTag ("ImageWidth", 100); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
229 ## @end example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
230 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
231 ## An example of setting multiple tags: |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
232 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
233 ## @example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
234 ## t = Tiff ("test.tif", "w"); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
235 ## tags = struct ("ImageWidth", 100, "ImageLength", 50); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
236 ## t.setTag (tags); |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
237 ## @end example |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
238 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
239 ## @seealso{getTag, getTagNames} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
240 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
241 |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
242 __tiff_set_tag__ (t.tiff_handle, varargin{:}); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
243 endfunction |
31126
7851c5b9c950
Tiff: implemented writeEncodedStrip function for writing a strip to an image
magedrifaat <magedrifaat@gmail.com>
parents:
31124
diff
changeset
|
244 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
245 function argout = read (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
246 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
247 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
248 ## @deftypefn {} {@var{img} =} Tiff.read () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
249 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
250 ## Reads the image data of the current image directory. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
251 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
252 ## @seealso{getTag, setTag, write} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
253 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
254 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
255 argout = __tiff_read__ (t.tiff_handle); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
256 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
257 |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
258 function stripData = readEncodedStrip (t, stripNumber) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
259 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
260 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
261 ## @deftypefn {} {@var{strip} =} Tiff.readEncodedStrip (@var{stripNumber}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
262 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
263 ## Read the data of the strip with index @var{stripNumber} from the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
264 ## current image directory. @var{stripNumber} index is 1-based. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
265 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
266 ## Stips are numbered from top to bottom. Images with separate planes |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
267 ## will have all the strips of the first channel first then all the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
268 ## strips of the second channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
269 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
270 ## The strip data is returned in @var{strip}. The boundary strips in |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
271 ## image might have different dimensions than the rest of the strips |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
272 ## depending on the ImageLength and the RowsPerStrip tags. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
273 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
274 ## @seealso{read, readEncodedTile} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
275 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
276 |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
277 stripData = __tiff_read_encoded_strip__ (t.tiff_handle, stripNumber); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
278 endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
279 |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
280 function tileData = readEncodedTile (t, tileNumber) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
281 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
282 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
283 ## @deftypefn {} {@var{tile} =} Tiff.readEncodedTile (@var{tileNumber}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
284 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
285 ## Read the data of the tile with index @var{tileNumber} from the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
286 ## current image directory. @var{tileNumber} index is 1-based. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
287 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
288 ## Tiles are numbered from left to right and from top to bottom. Images |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
289 ## with separate planes will have all the tiles of the first channel |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
290 ## first then all the tiles of the second channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
291 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
292 ## The tile data is returned in @var{tile}. The boundary tiles in |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
293 ## image might have different dimensions than the rest of the tiles |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
294 ## depending on tags: ImageLength, ImageWidth, TileLength and TileWidth. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
295 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
296 ## @seealso{read, readEncodedStrip} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
297 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
298 |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
299 tileData = __tiff_read_encoded_tile__ (t.tiff_handle, tileNumber); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
300 endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
301 |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
302 function [RGB, alpha] = readRGBAImage (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
303 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
304 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
305 ## @deftypefn {} {[@var{rgb}, @var{alpha}] =} Tiff.readRGBAImage () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
306 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
307 ## Read the image data of the current image directory in RGBA mode. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
308 ## The image 8-bit RGB data is returned in @var{rgb} and the transprency |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
309 ## data is returned in @var{alpha}. If the image has no transparency |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
310 ## data then the alpha array will be filled with the value 255. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
311 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
312 ## If the image data is any other format than 8-bit RGB then coversion |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
313 ## to 8-bit RGB is done internally. If you wish to read the actual image |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
314 ## data use the @code{read} method instead. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
315 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
316 ## This method uses the @qcode{"Orientation"} tag in the image to |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
317 ## correctly flip/rotate the image to match its orientation. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
318 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
319 ## @seealso{read, readRGBAStrip, readRGBATile} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
320 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
321 |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
322 [RGB, alpha] = __tiff_read_rgba_image__ (t.tiff_handle); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
323 endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
324 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
325 function [RGB, alpha] = readRGBAStrip (t, row) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
326 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
327 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
328 ## @deftypefn {} {[@var{rgb}, @var{alpha}] =} Tiff.readRGBAStrip (@var{row}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
329 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
330 ## Read a strip of the image data that contains the given @var{row} in RGBA |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
331 ## mode. The strip 8-bit RGB data is returned in @var{rgb} and the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
332 ## transprency data is returned in @var{alpha}. If the image has no |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
333 ## transparency data then the alpha array will be filled with the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
334 ## value 255. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
335 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
336 ## Boundary strips may have different number of rows than the rest of |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
337 ## the strips in the image depending on the @qcode{"ImageLength"} and |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
338 ## @qcode{"RowsPerStrip"} tags. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
339 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
340 ## If the strip data is any other format than 8-bit RGB then coversion |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
341 ## to 8-bit RGB is done internally. If you wish to read the actual strip |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
342 ## data use the @code{readEncodedStrip} method instead. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
343 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
344 ## This method uses the @qcode{"Orientation"} tag in the image to |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
345 ## correctly flip/rotate the strip to match its orientation. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
346 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
347 ## @seealso{readEncodedStrip, readRGBAImage, readRGBATile} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
348 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
349 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
350 [RGB, alpha] = __tiff_read_rgba_strip__ (t.tiff_handle, row); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
351 endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
352 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
353 function [RGB, alpha] = readRGBATile (t, row, col) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
354 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
355 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
356 ## @deftypefn {} {[@var{rgb}, @var{alpha}] =} Tiff.readRGBATile (@var{row}, @var{col}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
357 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
358 ## Read a tile of the image data that contains the given @var{row} and |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
359 ## @var{col} in RGBA mode. The tile 8-bit RGB data is returned in @var{rgb} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
360 ## and the transprency data is returned in @var{alpha}. If the image has |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
361 ## no transparency data then the alpha array will be filled with the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
362 ## value 255. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
363 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
364 ## Boundary tiles may have different number dimensions than the rest of |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
365 ## the tiles in the image depending on @qcode{"ImageLength"}, |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
366 ## @qcode{"ImageWidth"}, @qcode{"TileLength"} and @qcode{"TileWidth"} tags. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
367 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
368 ## If the tile data is any other format than 8-bit RGB then coversion to |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
369 ## 8-bit RGB is done internally. If you wish to read the actual tile |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
370 ## data use the @code{readEncodedTile} method instead. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
371 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
372 ## This method uses the @qcode{"Orientation"} tag in the image to |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
373 ## correctly flip/rotate the tile to match its orientation. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
374 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
375 ## @seealso{readEncodedTile, readRGBAImage, readRGBAStrip} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
376 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
377 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
378 [RGB, alpha] = __tiff_read_rgba_tile__ (t.tiff_handle, row, col); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
379 endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
380 |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
381 function write (t, imageData) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
382 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
383 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
384 ## @deftypefn {} Tiff.write (@var{imageData}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
385 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
386 ## Write the image pixel data @var{imageData} to the Tiff file. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
387 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
388 ## The class as well as the dimensions of the array @var{imageData} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
389 ## must match the image tag values of @qcode{"ImageLength"}, |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
390 ## @qcode{"ImageWidth"}, @qcode{"SamplesPerPixel"}, @qcode{"BitsPerSample"} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
391 ## and @qcode{"Photometric"} tags. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
392 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
393 ## For example, for a 10x10 8-bit RGB image, the @var{imageData} array |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
394 ## must be of class @qcode{"uint8"} and must have dimensions 10x10x3. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
395 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
396 ## @seealso{writeEncodedStrip, writeEncodedTile, read} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
397 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
398 |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
399 __tiff_write__ (t.tiff_handle, imageData); |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
400 endfunction |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
401 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
402 function writeEncodedStrip (t, stripNumber, imageData) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
403 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
404 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
405 ## @deftypefn {} Tiff.writeEncodedStrip (@var{stripNumber}, @var{stripData}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
406 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
407 ## Write the pixel data @var{stripData} to the strip of index |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
408 ## @var{stripnumber}. The strips are numbered from top to bottom. If the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
409 ## image is configured for separate planes, then all the strips of the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
410 ## first channel are numbered first then all the strips of the second |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
411 ## channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
412 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
413 ## The class of the array @var{stripData} must match the value of the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
414 ## @qcode{"BitsPerSample"} tag. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
415 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
416 ## If the array @var{stripData} has less elements than needed, it will |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
417 ## be silently padded with zeroes. If it has more elements than needed |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
418 ## the additional data will be truncated and a warning will be issued. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
419 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
420 ## @seealso{write, writeEncodedTile, read} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
421 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
422 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
423 __tiff_write_encoded_strip__ (t.tiff_handle, stripNumber, imageData); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
424 endfunction |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
425 |
31146
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
426 function writeEncodedTile (t, tileNumber, imageData) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
427 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
428 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
429 ## @deftypefn {} Tiff.writeEncodedTile (@var{tileNumber}, @var{tileData}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
430 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
431 ## Write the pixel data @var{tileData} to the tile of index @var{tileNumber}. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
432 ## The tiles are numbered from left to right and from top to bottom. If |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
433 ## the image is configured for separate planes, then all the tiles of |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
434 ## the first channel are numbered first then all the tiles of the second |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
435 ## channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
436 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
437 ## The class of the array @var{tileData} must match the value of the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
438 ## @qcode{"BitsPerSample"} tag. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
439 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
440 ## If the array @var{tileData} has less elements than needed, it will |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
441 ## be silently padded with zeroes. If it has more elements than needed |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
442 ## the additional data will be truncated and a warning will be issued. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
443 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
444 ## @seealso{writeEncodedStrip, write, read} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
445 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
446 |
31146
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
447 __tiff_write_encoded_tile__ (t.tiff_handle, tileNumber, imageData); |
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
448 endfunction |
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
449 |
31148
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
450 function tf = isTiled (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
451 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
452 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
453 ## @deftypefn {} {@var{tf} =} Tiff.isTiled () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
454 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
455 ## Returns whether or not the image in the current directory is tiled. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
456 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
457 ## @seealso{numberOfTiles, numberOfStrips} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
458 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
459 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
460 tf = __tiff_is_tiled__ (t.tiff_handle); |
31148
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
461 endfunction |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
462 |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
463 function numStrips = numberOfStrips (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
464 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
465 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
466 ## @deftypefn {} {@var{numStrips} =} Tiff.numberOfStrips () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
467 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
468 ## Returns the number of strips in the image of the current directory. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
469 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
470 ## @seealso{numberOfTiles, isTiled} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
471 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
472 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
473 numStrips = __tiff_number_of_strips__ (t.tiff_handle); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
474 endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
475 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
476 function numTiles = numberOfTiles (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
477 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
478 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
479 ## @deftypefn {} {@var{numTiles} =} Tiff.numberOfTiles () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
480 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
481 ## Returns the number of tiles in the image of the current directory. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
482 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
483 ## @seealso{numberOfStrips, isTiled} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
484 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
485 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
486 numTiles = __tiff_number_of_tiles__ (t.tiff_handle); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
487 endfunction |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
488 |
31197
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
489 function numDirs = numberOfDirectories (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
490 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
491 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
492 ## @deftypefn {} {@var{numDirs} =} Tiff.numberOfDirectories () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
493 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
494 ## Returns the number of directories in the image. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
495 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
496 ## @seealso{numberOfTiles, numberOfStrips} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
497 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
498 |
31197
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
499 numDirs = __tiff_number_of_directories__ (t.tiff_handle); |
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
500 endfunction |
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
501 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
502 function stripNumber = computeStrip (t, varargin) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
503 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
504 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
505 ## @deftypefn {} {@var{stripNumber} =} Tiff.computeStrip (@var{row}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
506 ## @deftypefnx {} {@var{stripNumber} =} Tiff.computeStrip (@var{row}, @var{plane}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
507 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
508 ## Return the strip index @var{stripNumber} of the strip containing the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
509 ## given @var{row}. If the image has separate planes, then an aditional |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
510 ## parameter @var{plane} is required to get the strip containing the @var{row} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
511 ## in the specific plane. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
512 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
513 ## Stips are numbered from top to bottom. Images with separate planes |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
514 ## will have all the strips of the first channel first then all the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
515 ## strips of the second channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
516 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
517 ## @seealso{computeTile, numberOfStrips} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
518 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
519 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
520 stripNumber = __tiff_compute_strip__ (t.tiff_handle, varargin{:}); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
521 endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
522 |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
523 function tileNumber = computeTile (t, varargin) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
524 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
525 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
526 ## @deftypefn {} {@var{tileNumber} =} Tiff.computeTile ([@var{row}, @var{col}]) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
527 ## @deftypefnx {} {@var{tileNumber} =} Tiff.computeTile ([@var{row}, @var{col}], @var{plane}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
528 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
529 ## Return the tile index @var{tileNumber} of the tile containing the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
530 ## given @var{row} and @var{col}. If the image has separate planes, then |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
531 ## an aditional parameter @var{plane} is required to get the tile index |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
532 ## containing the @var{row} and @var{col} in the specific plane. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
533 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
534 ## Tiles are numbered from left to right and from top to bottom. Images |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
535 ## with separate planes will have all the tiles of the first channel |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
536 ## first then all the tiles of the second channel and so on. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
537 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
538 ## @seealso{computeStrip, numberOfTiles} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
539 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
540 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
541 tileNumber = __tiff_compute_tile__ (t.tiff_handle, varargin{:}); |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
542 endfunction |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
543 |
31199
30b28458bb06
Tiff: added method getDefaultStripLength
magedrifaat <magedrifaat@gmail.com>
parents:
31197
diff
changeset
|
544 function stripLength = getDefaultStripLength (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
545 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
546 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
547 ## @deftypefn {} {@var{stripLength} =} Tiff.getDefaultStripLength () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
548 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
549 ## Returns the number of rows @var{stripLength} of a reasonably sized |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
550 ## strip using the image dimensions and configuration tags. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
551 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
552 ## This value can be used to set the @qcode{"RowsPerStrip"} tag of a new |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
553 ## image but the @qcode{"ImageLength"}, @qcode{"ImageWidth"}, |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
554 ## @qcode{"SamplesPerPixel"}, @qcode{"BitsPerSample"}, and optionally |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
555 ## @qcode{"Compression"} tags must be set first for the number of rows |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
556 ## to be calculated from the correct image dimensions and configuration. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
557 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
558 ## @seealso{computeStrip, computeTile} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
559 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
560 |
31199
30b28458bb06
Tiff: added method getDefaultStripLength
magedrifaat <magedrifaat@gmail.com>
parents:
31197
diff
changeset
|
561 stripLength = __tiff_default_strip_length__ (t.tiff_handle); |
30b28458bb06
Tiff: added method getDefaultStripLength
magedrifaat <magedrifaat@gmail.com>
parents:
31197
diff
changeset
|
562 endfunction |
30b28458bb06
Tiff: added method getDefaultStripLength
magedrifaat <magedrifaat@gmail.com>
parents:
31197
diff
changeset
|
563 |
31202
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
564 function tf = isBigEndian (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
565 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
566 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
567 ## @deftypefn {} {@var{tf} =} Tiff.isBigEndian () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
568 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
569 ## Returns whether the current image is of big-endian or little-endian |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
570 ## byte order. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
571 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
572 ## @seealso{isTiled} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
573 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
574 |
31202
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
575 tf = __tiff_is_big_endian__ (t.tiff_handle); |
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
576 endfunction |
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
577 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
578 function dirNum = currentDirectory (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
579 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
580 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
581 ## @deftypefn {} {@var{dirNum} =} Tiff.currentDirectory () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
582 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
583 ## Get the 1-based index of the current directory in the file. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
584 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
585 ## @seealso{lastDirectory, nextDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
586 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
587 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
588 dirNum = __tiff_current_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
589 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
590 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
591 function isLast = lastDirectory (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
592 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
593 ## @deftypefn {} {@var{isLast} =} Tiff.lastDirectory () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
594 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
595 ## Returns whether the current directory is the last directory in the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
596 ## image file. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
597 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
598 ## @seealso{currentDirectory, nextDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
599 ## @end deftypefn |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
600 isLast = __tiff_last_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
601 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
602 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
603 function nextDirectory (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
604 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
605 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
606 ## @deftypefn {} Tiff.nextDirectory () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
607 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
608 ## Switch to the next directory in the image file. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
609 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
610 ## @seealso{currentDirectory, lastDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
611 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
612 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
613 __tiff_next_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
614 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
615 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
616 function setDirectory (t, dirNum) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
617 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
618 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
619 ## @deftypefn {} Tiff.setDirectory (@var{dirNum}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
620 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
621 ## Switches to the directory with index @var{dirNum}, where the indexing |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
622 ## is 1-based (starts counting at 1). |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
623 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
624 ## @seealso{nextDirectory, currentDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
625 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
626 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
627 __tiff_set_directory__ (t.tiff_handle, dirNum); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
628 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
629 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
630 function writeDirectory (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
631 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
632 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
633 ## @deftypefn {} Tiff.writeDirectory () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
634 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
635 ## Write the data of the current directory to file and starts a new |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
636 ## directory for writing. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
637 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
638 ## Note that this is not needed for writing single-directory images |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
639 ## as it will be called internally when calling the @code{close} method. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
640 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
641 ## @seealso{setDirectory, rewriteDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
642 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
643 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
644 __tiff_write_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
645 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
646 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
647 function rewriteDirectory (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
648 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
649 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
650 ## @deftypefn {} Tiff.rewriteDirectory () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
651 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
652 ## Rewrite the modifications of the current directory to file and start |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
653 ## a new directory for writing. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
654 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
655 ## @seealso{writeDirectory, setDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
656 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
657 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
658 __tiff_rewrite_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
659 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
660 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
661 function setSubDirectory (t, offset) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
662 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
663 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
664 ## @deftypefn {} Tiff.setSubDirectory (@var{offset}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
665 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
666 ## Sets the active directory to a sub-directory of the current directory |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
667 ## identified by its @var{offset}. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
668 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
669 ## Sub-directory offsets can be obtained from the @qcode{"SubIFD"} tag of |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
670 ## a directory. Switching to a sub-directory can only be done when the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
671 ## parent directory is the current directory. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
672 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
673 ## @seealso{setDirectory, currentDirecory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
674 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
675 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
676 __tiff_set_sub_directory__ (t.tiff_handle, offset); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
677 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
678 |
31202
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
679 function offset = getDirectoryOffset (t) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
680 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
681 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
682 ## @deftypefn {} Tiff.getDirectoryOffset () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
683 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
684 ## Gets the offset in bytes of the current directory relative to the |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
685 ## start of the Tiff file. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
686 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
687 ## @seealso{setSubDirectory, setDirectory} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
688 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
689 |
31202
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
690 offset = __tiff_get_directory_offset__ (t.tiff_handle); |
be6ccdcd5775
Tiff: added isBigEndian and getDirectoryOffset methods to the class
magedrifaat <magedrifaat@gmail.com>
parents:
31199
diff
changeset
|
691 endfunction |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
692 endmethods |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
693 |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
694 methods (Static = true) |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
695 function versionString = getVersion() |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
696 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
697 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
698 ## @deftypefn {} {@var{versionString} =} Tiff.getVersion () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
699 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
700 ## Get a string with the version information of the LibTIFF library |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
701 ## used internally by this interface. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
702 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
703 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
704 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
705 versionString = __tiff_version__ (); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
706 endfunction |
31161
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
707 |
31173
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
708 function tagNames = getTagNames () |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
709 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
710 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
711 ## @deftypefn {} {@var{tagNames} =} Tiff.getTagNames () |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
712 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
713 ## Get a cell array of all the tag names supported. |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
714 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
715 ## @seealso{Tiff.TagID, getTag, setTag} |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
716 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
717 |
31173
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
718 tagNames = fieldnames (Tiff.TagID); |
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
719 endfunction |
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
720 |
31161
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
721 function setLibTIFFErrorsEnabled(state) |
31214
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
722 |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
723 ## -*- texinfo -*- |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
724 ## @deftypefn {} Tiff.setLibTIFFErrorsEnabled (@var{state}) |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
725 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
726 ## Enable or disable relaying the internal errors and warnings |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
727 ## issued by LibTIFF (enabled by default). |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
728 ## |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
729 ## @end deftypefn |
ddbed40b811b
Tiff: added documentation for all class methods
magedrifaat <magedrifaat@gmail.com>
parents:
31206
diff
changeset
|
730 |
31161
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
731 __tiff_set_errors_enabled__ (state); |
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
732 endfunction |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
733 endmethods |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
734 endclassdef |
31124
e8d1cc309bc9
Tiff: added initial implementation of setTag function for scalar tags
magedrifaat <magedrifaat@gmail.com>
parents:
31116
diff
changeset
|
735 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
736 %!function file_wrapper (fn) |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
737 %! filename = [tempname() ".tif"]; |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
738 %! unwind_protect |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
739 %! fn (filename); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
740 %! unwind_protect_cleanup |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
741 %! unlink (filename); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
742 %! end_unwind_protect |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
743 %!endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
744 |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
745 %!function verify_data (filename, data, ex_size) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
746 %! img = Tiff (filename, "r"); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
747 %! data2 = img.read (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
748 %! assert (size (data2), ex_size); |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
749 %! assert (data2, resize (data, size (data2))); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
750 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
751 %!endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
752 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
753 ## test setTag and getTag for scalar tags |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
754 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
755 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
756 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
757 %! setTag (img, "ImageWidth", 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
758 %! val = getTag (img, "ImageWidth"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
759 %! assert (val, 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
760 %! assert (class (val), "double"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
761 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
762 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
763 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
764 ## test failure setTag and getTag unknown tag |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
765 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
766 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
767 %! img = Tiff (filename, "w"); |
31189
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
768 %! fail ("getTag (img, \"ImageWidt\")"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
769 %! fail ("getTag (img, 0xf423f)"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
770 %! fail ("setTag (img, \"ImageWidt\", 2)"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
771 %! fail ("setTag (img, 0xf423f, 2)"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
772 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
773 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
774 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
775 ## test setTag structure input |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
776 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
777 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
778 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
779 %! setTag (img, struct ("ImageLength", 2, "ImageWidth", 2)); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
780 %! assert (getTag (img, "ImageLength"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
781 %! assert (getTag (img, "ImageWidth"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
782 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
783 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
784 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
785 ## test failure setTag structure unknown tag |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
786 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
787 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
788 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
789 %! setTag (img, "ImageLength", 1); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
790 %! setTag (img, "ImageWidth", 1); |
31189
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
791 %! fail ("setTag (img, struct (\"ImageLength\", 2, \"a\", 1, \"ImageWidth\", 2))"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
792 %! assert (getTag (img, "ImageLength"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
793 %! assert (getTag (img, "ImageWidth"), 1); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
794 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
795 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
796 |
31169
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
797 ## test setTag array field |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
798 %!testif HAVE_TIFF |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
799 %! function test_fn (filename) |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
800 %! img = Tiff (filename, "w"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
801 %! setTag (img, "YCbCrCoefficients", [1.5, 2.5, 3.5]); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
802 %! data = getTag (img, "YCbCrCoefficients"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
803 %! assert (data, [1.5, 2.5, 3.5]); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
804 %! endfunction |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
805 %! file_wrapper (@test_fn); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
806 |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
807 ## test setTag special field |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
808 %!testif HAVE_TIFF |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
809 %! function test_fn (filename) |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
810 %! img = Tiff (filename, "w"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
811 %! setTag (img, "BitsPerSample", 8); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
812 %! cmap = reshape (1:768, [256, 3]) / 1024.0; |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
813 %! setTag (img, "ColorMap", cmap); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
814 %! assert (getTag (img, "ColorMap"), cmap, 1e-5); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
815 %! endfunction |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
816 %! file_wrapper (@test_fn); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
817 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
818 ## test failure invalid open mode/ invalid filename |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
819 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
820 %! fail ("Tiff (\"test.tif\", \"rh\")", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
821 %! "Invalid mode for openning Tiff file: rh"); |
31189
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
822 %! fail ("Tiff ([tempname() \".tif\"], \"r\")"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
823 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
824 ## test r+ mode modifies exisitng images |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
825 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
826 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
827 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
828 %! setTag (img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
829 %! "ImageLength", 1, "ImageWidth", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
830 %! "BitsPerSample", 8 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
831 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
832 %! write (img, uint8 ([210])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
833 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
834 %! img = Tiff (filename, "r+"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
835 %! setTag (img, "Make", "test_tag"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
836 %! img.rewriteDirectory (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
837 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
838 %! img = Tiff (filename); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
839 %! assert (img.read(), uint8 ([210])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
840 %! assert (getTag (img, "Make"), "test_tag"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
841 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
842 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
843 %! file_wrapper (@test_fn) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
844 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
845 ## test one-pixel grayscale image |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
846 %!testif HAVE_TIFF |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
847 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
848 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
849 %! setTag (img, struct ("ImageLength", 1, "ImageWidth", 1, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
850 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
851 %! data = uint8 (randi (intmax ("uint8"), 1, 1)); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
852 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
853 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
854 %! verify_data (filename, data, [1, 1]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
855 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
856 %! file_wrapper (@test_fn); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
857 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
858 ## test failure to write to image without dimensions |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
859 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
860 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
861 %! img = Tiff (filename, "w"); |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
862 %! data = uint8 (randi (intmax ("uint8"), 1, 1)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
863 %! fail ("writeEncodedStrip (img, 1, data)", "Failed to read image width"); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
864 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
865 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
866 %! file_wrapper (@test_fn); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
867 |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
868 ## test one row grayscale image |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
869 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
870 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
871 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
872 %! setTag (img, struct ("ImageLength", 1, "ImageWidth", 10, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
873 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
874 %! data = uint8 (reshape (1:10, [1, 10])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
875 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
876 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
877 %! verify_data (filename, data, [1, 10]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
878 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
879 %! file_wrapper (@test_fn); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
880 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
881 ## test wrong size of row |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
882 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
883 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
884 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
885 %! setTag (img, struct ("ImageLength", 1, "ImageWidth", 10, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
886 %! "BitsPerSample", 8)); |
31145
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
887 %! data = uint8 (reshape (1:13, [1, 13])); |
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
888 %! fail ("writeEncodedStrip (img, 1, data)", "warning", |
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
889 %! "The image width is 10 but the input has 13 columns."); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
890 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
891 %! verify_data (filename, data, [1, 10]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
892 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
893 %! file_wrapper (@test_fn); |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
894 |
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
895 ## test one strip grayscale image |
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
896 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
897 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
898 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
899 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
900 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
901 %! data = uint8 (reshape (1:100, [10, 10])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
902 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
903 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
904 %! verify_data (filename, data, [10, 10]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
905 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
906 %! file_wrapper (@test_fn); |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
907 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
908 ## test wrong height of strip |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
909 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
910 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
911 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
912 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
913 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
914 %! data = uint8 (reshape (1:110, [11, 10])); |
31145
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
915 %! fail ("writeEncodedStrip (img, 1, data)", "warning", |
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
916 %! "The strip is composed of 10 rows but the input has 11 rows."); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
917 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
918 %! verify_data (filename, data, [10, 10]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
919 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
920 %! file_wrapper (@test_fn); |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
921 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
922 ## test one strip RGB image chunky planes (RGBRGBRGB) |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
923 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
924 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
925 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
926 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
927 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
928 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
929 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
930 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
931 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
932 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
933 %! verify_data (filename, data, [10, 10, 3]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
934 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
935 %! file_wrapper (@test_fn); |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
936 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
937 ## test wrong number of channels |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
938 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
939 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
940 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
941 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
942 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
943 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
944 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
945 %! data = uint8 (reshape (1:400, [10, 10, 4])); |
31145
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
946 %! fail ("writeEncodedStrip (img, 1, data)", "warning", |
2e11f9cb30b8
Tiff writeEncodedStrip: added warning for input data larger than the size of the strip.
magedrifaat <magedrifaat@gmail.com>
parents:
31143
diff
changeset
|
947 %! "The strip is composed of 3 channels but the input has 4 channels."); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
948 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
949 %! verify_data (filename, data, [10, 10, 3]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
950 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
951 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
952 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
953 ## test one strip RGB image separate planes (RRRGGGBBB) |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
954 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
955 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
956 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
957 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
958 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
959 %! "PlanarConfiguration", 2, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
960 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
961 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
962 %! for i = 1:3 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
963 %! writeEncodedStrip (img, i, data(:,:,i)); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
964 %! endfor |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
965 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
966 %! verify_data (filename, data, [10, 10, 3]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
967 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
968 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
969 |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
970 ## test 1-bit BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
971 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
972 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
973 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
974 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
975 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
976 %! writeEncodedStrip (img, 1, data); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
977 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
978 %! verify_data (filename, data, [10, 10]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
979 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
980 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
981 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
982 ## test 16-bit grayscale image |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
983 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
984 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
985 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
986 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
987 %! "BitsPerSample", 16)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
988 %! data = uint16 (reshape (1:400, [20, 20])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
989 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
990 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
991 %! verify_data (filename, data, [20, 20]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
992 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
993 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
994 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
995 ## test 32-bit grayscale image |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
996 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
997 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
998 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
999 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1000 %! "BitsPerSample", 32)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1001 %! data = uint32 (reshape (1:400, [20, 20])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1002 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1003 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1004 %! verify_data (filename, data, [20, 20]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1005 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1006 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1007 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1008 ## test 16-bit RGB image |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1009 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1010 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1011 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1012 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1013 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1014 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1015 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1016 %! data = uint16 (reshape (1:1200, [20, 20, 3])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1017 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1018 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1019 %! verify_data (filename, data, [20, 20, 3]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1020 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1021 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1022 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1023 ## test 32-bit RGB image |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1024 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1025 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1026 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1027 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1028 %! "BitsPerSample", 32, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1029 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1030 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1031 %! data = uint32 (reshape (1:1200, [20, 20, 3])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1032 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1033 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1034 %! verify_data (filename, data, [20, 20, 3]); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1035 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1036 %! file_wrapper (@test_fn); |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1037 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1038 ## test failure unsupported bit-depth |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1039 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1040 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1041 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1042 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1043 %! "BitsPerSample", 24)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1044 %! data = uint16 (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1045 %! fail ("writeEncodedStrip (img, 1, data)", "Unsupported bit depth"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1046 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1047 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1048 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1049 |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1050 ## test failure unsupported BiLevel number of channels |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1051 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1052 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1053 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1054 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1055 %! "SamplesPerPixel", 3)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1056 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1057 %! fail ("writeEncodedStrip (img, 1, data)", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1058 %! "Bi-Level images must have one channel only"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1059 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1060 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1061 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1062 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1063 ## test multi-strip BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1064 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1065 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1066 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1067 %! setTag (img, struct ("ImageLength", 10, "ImageWidth", 10, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1068 %! "RowsPerStrip", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1069 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1070 %! for strip = 1:5 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1071 %! writeEncodedStrip (img, strip, data(strip * 2 - 1: strip * 2, :)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1072 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1073 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1074 %! verify_data (filename, data, [10, 10]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1075 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1076 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1077 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1078 ## test multi-strip grayscale image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1079 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1080 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1081 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1082 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1083 %! "BitsPerSample", 16, "RowsPerStrip", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1084 %! data = uint16 (reshape (1:400, [20, 20])); |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1085 %! for strip = 1:7 |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1086 %! writeEncodedStrip (img, strip, data(strip * 3 - 2: min(strip * 3, 20), :)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1087 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1088 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1089 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1090 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1091 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1092 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1093 ## test multi-strip RGB image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1094 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1095 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1096 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1097 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1098 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1099 %! "RowsPerStrip", 2, "PlanarConfiguration", 1, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1100 %! "PhotometricInterpretation", 2)); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1101 %! data = uint16 (reshape (1:1200, [20, 20, 3])); |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1102 %! for strip = 1:10 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1103 %! writeEncodedStrip (img, strip, data(strip * 2 - 1: strip * 2, :, :)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1104 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1105 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1106 %! verify_data (filename, data, [20, 20, 3]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1107 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1108 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1109 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1110 ## test multi-strip RGB separate planes image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1111 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1112 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1113 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1114 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1115 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1116 %! "RowsPerStrip", 3, "PlanarConfiguration", 2, |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1117 %! "PhotometricInterpretation", 2)); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1118 %! data = uint16 (reshape (1:1200, [20, 20, 3])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1119 %! strip = 1; |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1120 %! for sample = 1:3 |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1121 %! for row = 1:3:20 |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
1122 %! writeEncodedStrip (img, strip, data(row: min(row + 2, 20), :, sample)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1123 %! strip = strip + 1; |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1124 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1125 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1126 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1127 %! verify_data (filename, data, [20, 20, 3]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1128 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1129 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1130 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1131 ## test single-precision image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1132 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1133 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1134 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1135 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1136 %! "BitsPerSample", 32, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1137 %! data = single (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1138 %! writeEncodedStrip (img, 1, data); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1139 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1140 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1141 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1142 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1143 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1144 ## test double-precision image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1145 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1146 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1147 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1148 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1149 %! "BitsPerSample", 64, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1150 %! data = double (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1151 %! writeEncodedStrip (img, 1, data); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1152 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1153 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1154 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1155 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1156 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1157 ## test failure unsupported floating-point bit depth |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1158 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1159 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1160 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1161 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1162 %! "BitsPerSample", 16, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1163 %! data = double (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1164 %! fail ("writeEncodedStrip (img, 1, data)", |
31178
14edd6b09efe
Tiff: added support for reading and writing signed images
magedrifaat <magedrifaat@gmail.com>
parents:
31177
diff
changeset
|
1165 %! "Unsupported bit depth for floating-point images"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1166 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1167 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1168 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1169 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1170 ## test failure data-type and bit-depth mismatch |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
1171 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1172 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1173 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1174 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1175 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1176 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1177 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1178 %! data = uint8 (reshape (1:1200, [20, 20, 3])); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1179 %! fail ("writeEncodedStrip (img, 1, data)", "Only uint16 data is allowed for uint images with bit depth of 16"); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1180 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1181 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1182 %! file_wrapper (@test_fn); |
31138
68762676dab1
Tiff writeEncodedStrip: prevent writing to a read-only file
magedrifaat <magedrifaat@gmail.com>
parents:
31137
diff
changeset
|
1183 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1184 ## test failure writing to img read-only file |
31138
68762676dab1
Tiff writeEncodedStrip: prevent writing to a read-only file
magedrifaat <magedrifaat@gmail.com>
parents:
31137
diff
changeset
|
1185 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1186 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1187 %! img = Tiff (filename, "w"); |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
1188 %! setTag (img, struct ("ImageLength", 1, "ImageWidth", 1, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1189 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1190 %! data = uint8 (1); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1191 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1192 %! img.close(); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1193 %! img = Tiff (filename, "r"); |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1194 %! fail ("writeEncodedStrip(img, 1, [1])", |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1195 %! "Can't write data to a file opened in read-only mode"); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1196 %! img.close(); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
1197 %! endfunction |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1198 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1199 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1200 ## test failure unsupported sample format |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1201 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1202 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1203 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1204 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1205 %! "BitsPerSample", 16, "SampleFormat", 5)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1206 %! data = double (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1207 %! fail ("writeEncodedStrip (img, 1, data)", "Unsupported sample format"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1208 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1209 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1210 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1211 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1212 ## test failure wrong strip number |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1213 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1214 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1215 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1216 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1217 %! "BitsPerSample", 16, "RowsPerStrip", 5)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1218 %! strip_data = uint16 (reshape (1:100, [5, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1219 %! fail ("writeEncodedStrip (img, 5, strip_data)", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1220 %! "Strip number out of range"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1221 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1222 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1223 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1224 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1225 ## test failure writing strips to tiled image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1226 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1227 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1228 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1229 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1230 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1231 %! "TileWidth", 16)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1232 %! data = uint8 (reshape (1:400, [20, 20])); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1233 %! fail ("writeEncodedStrip (img, 1, data)", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1234 %! "Can't write strips to a tiled image"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1235 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
1236 %! endfunction |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1237 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1238 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1239 ## test tiled BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1240 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1241 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1242 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1243 %! setTag (img, struct ("ImageLength", 32, "ImageWidth", 32, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1244 %! "TileLength", 16, "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1245 %! data = logical (repmat ([1,0,0,1,0,1,1,0], [32, 4])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1246 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1247 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1248 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1249 %! writeEncodedTile (img, tile, data(row:row+15, col:col+15)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1250 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1251 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1252 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1253 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1254 %! verify_data (filename, data, [32, 32]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1255 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1256 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1257 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1258 ## test tiled grayscale image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1259 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1260 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1261 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1262 %! setTag (img, struct ("ImageLength", 32, "ImageWidth", 32, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1263 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1264 %! "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1265 %! data = uint16 (reshape (1:1024, [32, 32])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1266 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1267 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1268 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1269 %! writeEncodedTile (img, tile, data(row:row+15, col:col+15)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1270 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1271 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1272 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1273 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1274 %! verify_data (filename, data, [32, 32]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1275 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1276 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1277 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1278 ## test tiled grayscale image with padding |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1279 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1280 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1281 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1282 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1283 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1284 %! "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1285 %! data = uint16 (reshape (1:400, [20, 20])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1286 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1287 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1288 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1289 %! writeEncodedTile (img, tile, data(row:min(row+15, 20), |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1290 %! col:min(col+15, 20))); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1291 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1292 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1293 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1294 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1295 %! verify_data (filename, data, [20, 20]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1296 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1297 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1298 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1299 ## test tiled RGB image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1300 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1301 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1302 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1303 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1304 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1305 %! "PlanarConfiguration", 1, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1306 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1307 %! data = uint16 (reshape (1:1200, [20, 20, 3])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1308 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1309 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1310 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1311 %! writeEncodedTile (img, tile, data(row:min(row+15,20), |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1312 %! col:min(col+15,20), :)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1313 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1314 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1315 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1316 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1317 %! verify_data (filename, data, [20, 20, 3]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1318 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1319 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1320 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1321 ## test tiled RGB image separate planes |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1322 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1323 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1324 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1325 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1326 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1327 %! "PlanarConfiguration", 2, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1328 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1329 %! data = uint16 (reshape (1:1200, [20, 20, 3])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1330 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1331 %! for channel=1:3 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1332 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1333 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1334 %! writeEncodedTile (img, tile, data(row:min(row+15,20), |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1335 %! col:min(col+15,20), channel)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1336 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1337 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1338 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1339 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1340 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1341 %! verify_data (filename, data, [20, 20, 3]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1342 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1343 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1344 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1345 ## test failure writing tiles to stripped image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1346 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1347 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1348 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1349 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1350 %! "BitsPerSample", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1351 %! data = uint8 (reshape (1:400, [20, 20])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1352 %! fail ("writeEncodedTile (img, 1, data)", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1353 %! "Can't write tiles to a stripped image"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1354 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1355 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1356 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1357 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1358 ## test tiled image wrong tile dimensions |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1359 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1360 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1361 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1362 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1363 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1364 %! "PlanarConfiguration", 1, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1365 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1366 %! data = uint16 (reshape (1:1600, [20, 20, 4])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1367 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1368 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1369 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1370 %! writeEncodedTile (img, tile, data(row:min(row+15,20), |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1371 %! col:min(col+15,20), 1:3)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1372 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1373 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1374 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1375 %! fail ("writeEncodedTile (img, 1, data(1:18,1:16,1:3))", "warning", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1376 %! "The tile is composed of 16 rows but input has 18 rows"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1377 %! fail ("writeEncodedTile (img, 1, data(1:16,1:20,1:3))", "warning", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1378 %! "The tile is composed of 16 columns but input has 20 columns"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1379 %! fail ("writeEncodedTile (img, 1, data(1:16,1:16,:))", "warning", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1380 %! "The tile is composed of 3 channels but input has 4 channels"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1381 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1382 %! verify_data (filename, data, [20, 20, 3]); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1383 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1384 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1385 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1386 ## test failure wrong tile number |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1387 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1388 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1389 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1390 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1391 %! "BitsPerSample", 16, "TileWidth", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1392 %! "TileLength", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1393 %! tile_data = uint16 (reshape (1:256, [16, 16])); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1394 %! fail ("writeEncodedTile (img, 5, tile_data)", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1395 %! "Tile number out of range"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1396 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1397 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
1398 %! file_wrapper (@test_fn); |
31148
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1399 |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1400 ## test isTiled returns the correct value |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1401 %!testif HAVE_TIFF |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1402 %! function test_fn (filename) |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1403 %! img = Tiff (filename, "w"); |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1404 %! assert (isTiled (img), logical (0)); |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1405 %! setTag (img, "TileLength", 16); |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1406 %! setTag (img, "TileWidth", 16); |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1407 %! assert (isTiled (img), logical (1)); |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
1408 %! endfunction |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1409 %! file_wrapper (@test_fn); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1410 |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1411 ## test numberOfStrips returns the correct value |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1412 %!testif HAVE_TIFF |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1413 %! function test_fn (filename) |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1414 %! img = Tiff (filename, "w"); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1415 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10)); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1416 %! assert (numberOfStrips (img), 1); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1417 %! setTag (img, "RowsPerStrip", 2); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1418 %! assert (numberOfStrips (img), 5); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1419 %! setTag (img, "RowsPerStrip", 4); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1420 %! assert (numberOfStrips (img), 3); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1421 %! setTag (img, "TileLength", 16); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1422 %! setTag (img, "TileWidth", 16); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1423 %! fail ("numberOfStrips (img)", "The image is tiled not stripped"); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
1424 %! endfunction |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1425 %! file_wrapper (@test_fn); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1426 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1427 ## test numberOfTiles returns the correct value |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1428 %!testif HAVE_TIFF |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1429 %! function test_fn (filename) |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1430 %! img = Tiff (filename, "w"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1431 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20, |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1432 %! "TileLength", 16, "TileWidth", 16)); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1433 %! assert (numberOfTiles (img), 4); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1434 %! setTag (img, "TileLength", 32); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1435 %! assert (numberOfTiles (img), 2); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1436 %! setTag (img, "TileWidth", 32); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1437 %! assert (numberOfTiles (img), 1); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1438 %! img = Tiff (filename, "w"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1439 %! fail ("numberOfTiles (img)", "The image is stripped not tiled"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1440 %! endfunction |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1441 %! file_wrapper (@test_fn); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
1442 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1443 ## test computeStrip returns the correct value |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1444 %!testif HAVE_TIFF |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1445 %! function test_fn (filename) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1446 %! img = Tiff (filename, "w"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1447 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1448 %! "RowsPerStrip", 2, "BitsPerSample", 8, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1449 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1)); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1450 %! assert (computeStrip (img, 1), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1451 %! assert (computeStrip (img, 2), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1452 %! assert (computeStrip (img, 0), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1453 %! assert (computeStrip (img, 10), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1454 %! assert (computeStrip (img, 11), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1455 %! setTag (img, "PlanarConfiguration", 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1456 %! ## This is need for the tag to take effect, should be |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1457 %! ## replaced by rewriteDirectory |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1458 %! writeEncodedStrip (img, 1, uint8 (reshape (1:20, [2, 10]))); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1459 %! assert (computeStrip (img, 1, 2), 6); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1460 %! assert (computeStrip (img, 100, 1), 5); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1461 %! img = Tiff (filename, "w"); |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1462 %! setTag (img, "TileWidth", 16); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1463 %! setTag (img, "TileLength", 16); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1464 %! fail ("computeStrip (img, 1, 1)", "The image is tiled not stripped"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1465 %! endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1466 %! file_wrapper (@test_fn); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1467 |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1468 ## test computeTile returns the correct value |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1469 %!testif HAVE_TIFF |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1470 %! function test_fn (filename) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1471 %! img = Tiff (filename, "w"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1472 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1473 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1474 %! "TileLength", 16, "TileWidth", 16, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1475 %! "PlanarConfiguration", 1)); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1476 %! assert (computeTile (img, [1, 1]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1477 %! assert (computeTile (img, [2, 2]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1478 %! assert (computeTile (img, [0, 0]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1479 %! assert (computeTile (img, [8, 17]), 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1480 %! assert (computeTile (img, [19, 10]), 3); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1481 %! assert (computeTile (img, [17, 17]), 4); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1482 %! assert (computeTile (img, [100, 100]), 4); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1483 %! setTag (img, "PlanarConfiguration", 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1484 %! ## This is need for the tag to take effect, should be |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1485 %! ## replaced by rewriteDirectory |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1486 %! writeEncodedTile (img, 1, uint8 (reshape (1:256, [16, 16]))); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1487 %! assert (computeTile (img, [1, 1], 2), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1488 %! assert (computeTile (img, [100, 100], 1), 4); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1489 %! img = Tiff (filename, "w"); |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1490 %! fail ("computeTile (img, 1, 1)", "The image is stripped not tiled"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1491 %! endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1492 %! file_wrapper (@test_fn); |
31154
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1493 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1494 ## test write method one pixel bilevel image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1495 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1496 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1497 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1498 %! setTag(img, struct ("ImageLength", 1, "ImageWidth", 1)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1499 %! write (img, logical ([1])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1500 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1501 %! verify_data (filename, logical ([1]), [1, 1]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1502 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1503 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1504 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1505 ## test write method one strip bilevel image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1506 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1507 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1508 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1509 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1510 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1511 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1512 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1513 %! verify_data (filename, data, [10, 10]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1514 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1515 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1516 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1517 ## test write method multi-strip bilevel image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1518 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1519 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1520 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1521 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1522 %! "RowsPerStrip", 3)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1523 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1524 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1525 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1526 %! verify_data (filename, data, [10, 10]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1527 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1528 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1529 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1530 ## test write method one pixel grayscale image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1531 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1532 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1533 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1534 %! setTag(img, struct ("ImageLength", 1, "ImageWidth", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1535 %! "BitsPerSample", 8)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1536 %! write (img, uint8 ([255])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1537 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1538 %! verify_data (filename, uint8 ([255]), [1, 1]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1539 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1540 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1541 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1542 ## test write method one strip grayscale image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1543 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1544 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1545 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1546 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1547 %! "BitsPerSample", 8)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1548 %! data = uint8 (reshape (1:100, [10, 10])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1549 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1550 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1551 %! verify_data (filename, data, [10, 10]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1552 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1553 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1554 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1555 ## test write method multi-strip grayscale image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1556 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1557 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1558 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1559 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1560 %! "BitsPerSample", 8, "RowsPerStrip", 3)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1561 %! data = uint8 (reshape (1:100, [10, 10])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1562 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1563 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1564 %! verify_data (filename, data, [10, 10]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1565 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1566 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1567 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1568 ## test write method multi-strip RGB image chunky |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1569 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1570 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1571 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1572 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1573 %! "BitsPerSample", 8, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1574 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1575 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1576 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1577 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1578 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1579 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1580 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1581 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1582 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1583 ## test write method multi-strip RGB image separate |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1584 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1585 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1586 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1587 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1588 %! "BitsPerSample", 8, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1589 %! "SamplesPerPixel", 3, "PlanarConfiguration", 2, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1590 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1591 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1592 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1593 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1594 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1595 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1596 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1597 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1598 ## test write method 16-bit multi-strip image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1599 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1600 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1601 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1602 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1603 %! "BitsPerSample", 16, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1604 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1605 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1606 %! data = uint16 (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1607 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1608 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1609 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1610 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1611 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1612 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1613 ## test write method 32-bit multi-strip image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1614 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1615 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1616 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1617 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1618 %! "BitsPerSample", 32, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1619 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1620 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1621 %! data = uint32 (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1622 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1623 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1624 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1625 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1626 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1627 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1628 ## test write method single-precision image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1629 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1630 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1631 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1632 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1633 %! "BitsPerSample", 32, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1634 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1635 %! "PhotometricInterpretation", 2, "SampleFormat", 3)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1636 %! data = single (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1637 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1638 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1639 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1640 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1641 %! file_wrapper (@test_fn); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1642 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1643 ## test write method single-precision image |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1644 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1645 %! function test_fn (filename) |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1646 %! img = Tiff (filename, "w"); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1647 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1648 %! "BitsPerSample", 64, "RowsPerStrip", 3, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1649 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1, |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1650 %! "PhotometricInterpretation", 2, "SampleFormat", 3)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1651 %! data = double (reshape (1:300, [10, 10, 3])); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1652 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1653 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1654 %! verify_data (filename, data, [10, 10, 3]); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1655 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1656 %! file_wrapper (@test_fn); |
31156
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1657 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1658 ## test write signed integer image |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1659 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1660 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1661 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1662 %! setTag (img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1663 %! "ImageLength", 10, "ImageWidth", 10, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1664 %! "BitsPerSample", 16, "SampleFormat", Tiff.SampleFormat.Int, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1665 %! "PhotometricInterpretation", Tiff.Photometric.RGB, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1666 %! "PlanarConfiguration", Tiff.PlanarConfiguration.Chunky)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1667 %! data = int16 (reshape (-150:149, [10, 10, 3])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1668 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1669 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1670 %! verify_data (filename, data, [10, 10, 3]); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1671 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1672 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1673 |
31156
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1674 ## test write method tiled BiLevel image |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1675 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1676 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1677 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1678 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1679 %! "TileWidth", 16, "TileLength", 16)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1680 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [40, 4])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1681 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1682 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1683 %! verify_data (filename, data, [40, 40]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1684 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1685 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1686 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1687 ## test write method tiled grayscale image |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1688 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1689 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1690 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1691 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1692 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1693 %! "BitsPerSample", 16)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1694 %! data = uint16 (reshape (1:1600, [40, 40])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1695 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1696 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1697 %! verify_data (filename, data, [40, 40]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1698 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1699 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1700 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1701 ## test write method tiled RGB image chunky |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1702 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1703 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1704 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1705 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1706 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1707 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1708 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1709 %! "PlanarConfiguration", 1)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1710 %! data = uint16 (reshape (1:4800, [40, 40, 3])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1711 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1712 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1713 %! verify_data (filename, data, [40, 40, 3]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1714 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1715 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1716 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1717 ## test write method tiled RGB image separate |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1718 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1719 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1720 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1721 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1722 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1723 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1724 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1725 %! "PlanarConfiguration", 2)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1726 %! data = uint16 (reshape (1:4800, [40, 40, 3])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1727 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1728 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1729 %! verify_data (filename, data, [40, 40, 3]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1730 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1731 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1732 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1733 ## test write method 32-bit tiled image |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1734 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1735 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1736 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1737 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1738 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1739 %! "BitsPerSample", 32, "SamplesPerPixel", 3, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1740 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1741 %! "PlanarConfiguration", 1)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1742 %! data = uint32 (reshape (1:4800, [40, 40, 3])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1743 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1744 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1745 %! verify_data (filename, data, [40, 40, 3]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1746 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1747 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1748 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1749 ## test write method single-precision tiled image |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1750 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1751 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1752 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1753 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1754 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1755 %! "BitsPerSample", 32, "SamplesPerPixel", 3, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1756 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1757 %! "PlanarConfiguration", 1, "SampleFormat", 3)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1758 %! data = single (reshape (1:4800, [40, 40, 3])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1759 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1760 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1761 %! verify_data (filename, data, [40, 40, 3]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1762 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1763 %! file_wrapper (@test_fn); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1764 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1765 ## test write method double-precision tiled image |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1766 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1767 %! function test_fn (filename) |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1768 %! img = Tiff (filename, "w"); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1769 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1770 %! "TileWidth", 16, "TileLength", 16, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1771 %! "BitsPerSample", 64, "SamplesPerPixel", 3, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1772 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1773 %! "PlanarConfiguration", 1, "SampleFormat", 3)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1774 %! data = double (reshape (1:4800, [40, 40, 3])); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1775 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1776 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1777 %! verify_data (filename, data, [40, 40, 3]); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1778 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1779 %! file_wrapper (@test_fn); |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1780 |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1781 ## test readEncodedStrip BiLevel image |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1782 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1783 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1784 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1785 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1786 %! "RowsPerStrip", 6)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1787 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [10, 1])); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1788 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1789 %! s1 = readEncodedStrip (img, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1790 %! s2 = readEncodedStrip (img, 2); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1791 %! assert ([s1;s2], data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1792 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1793 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1794 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1795 |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1796 ## test readEncodedStrip RGB Chunky |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1797 %!testif HAVE_TIFF |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1798 %! function test_fn (filename) |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1799 %! img = Tiff (filename, "w"); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1800 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1801 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1802 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1803 %! "PlanarConfiguration", 1)); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1804 %! data = uint16 (reshape (1:300, [10, 10, 3])); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1805 %! write (img, data); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1806 %! s1 = readEncodedStrip (img, 1); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1807 %! s2 = readEncodedStrip (img, 2); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1808 %! assert ([s1;s2], data); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1809 %! img.close(); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1810 %! endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1811 %! file_wrapper (@test_fn); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1812 |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1813 ## test readEncodedStrip RGB Separated |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1814 %!testif HAVE_TIFF |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1815 %! function test_fn (filename) |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1816 %! img = Tiff (filename, "w"); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1817 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1818 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1819 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1820 %! "PlanarConfiguration", 2)); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1821 %! data = uint16 (reshape (1:300, [10, 10, 3])); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1822 %! write (img, data); |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1823 %! s = cell (6, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1824 %! for i=1:6 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1825 %! s{i} = readEncodedStrip (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1826 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1827 %! data2 = cat (3, [s{1}; s{2}], [s{3}; s{4}], [s{5}; s{6}]); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1828 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1829 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1830 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1831 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1832 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1833 ## test readEncodedTile BiLevel image |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1834 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1835 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1836 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1837 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1838 %! "TileWidth", 16, "TileLength", 16)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1839 %! data = logical (repmat ([1,0,0,0,1,0,1,1,1,0], [40, 4])); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1840 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1841 %! t = cell (9, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1842 %! for i=1:9 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1843 %! t{i} = readEncodedTile (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1844 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1845 %! data2 = cat(1, cat (2, t{1}, t{2}, t{3}), cat (2, t{4}, t{5}, t{6}), |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1846 %! cat (2, t{7}, t{8}, t{9})); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1847 %! assert (data2, data); |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1848 %! img.close(); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1849 %! endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1850 %! file_wrapper (@test_fn); |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1851 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1852 ## test readEncodedTile RGB Chunky |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1853 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1854 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1855 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1856 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1857 %! "TileWidth", 16, "TileLength", 16, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1858 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1859 %! "PhotometricInterpretation", 2, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1860 %! "PlanarConfiguration", 1)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1861 %! data = uint16 (reshape (1:4800, [40, 40, 3])); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1862 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1863 %! t = cell (9, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1864 %! for i=1:9 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1865 %! t{i} = readEncodedTile (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1866 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1867 %! data2 = cat(1, cat (2, t{1}, t{2}, t{3}), cat (2, t{4}, t{5}, t{6}), |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1868 %! cat (2, t{7}, t{8}, t{9})); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1869 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1870 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1871 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1872 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1873 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1874 ## test readEncodedTile RGB Separated |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1875 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1876 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1877 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1878 %! setTag(img, struct ("ImageLength", 40, "ImageWidth", 40, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1879 %! "TileWidth", 16, "TileLength", 16, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1880 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1881 %! "PhotometricInterpretation", 2, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1882 %! "PlanarConfiguration", 2)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1883 %! data = uint16 (reshape (1:4800, [40, 40, 3])); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1884 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1885 %! data2 = uint16 (zeros (40, 40, 3)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1886 %! tile = 1; |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1887 %! for sample=1:3 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1888 %! for row=1:16:40 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1889 %! for col=1:16:40 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1890 %! data2(row: min(40, row + 15), col: min(40, col + 15), sample)... |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1891 %! = readEncodedTile(img, tile); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1892 %! tile += 1; |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1893 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1894 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1895 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1896 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1897 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1898 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1899 %! file_wrapper (@test_fn); |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1900 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1901 ## test readRGBAImage |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1902 %!testif HAVE_TIFF |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1903 %! function test_fn (filename) |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1904 %! img = Tiff (filename, "w"); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1905 %! setTag(img, struct ( |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1906 %! "ImageLength", 10, "ImageWidth", 10, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1907 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1908 %! "PhotometricInterpretation", 2, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1909 %! "PlanarConfiguration", 1 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1910 %! )); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1911 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1912 %! write (img, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1913 %! [rgb, alpha] = readRGBAImage (img); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1914 %! assert (rgb, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1915 %! assert (alpha, uint8 (repmat ([255], [10, 10]))); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1916 %! endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1917 %! file_wrapper (@test_fn); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1918 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1919 ## test readRGBAImage with orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1920 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1921 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1922 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1923 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1924 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1925 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1926 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1927 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1928 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1929 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1930 %! data = uint8 (reshape (1:300, [10, 10, 3])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1931 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1932 %! [rgb, alpha] = readRGBAImage (img); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1933 %! assert (rgb, data(end:-1:1, end:-1:1, :)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1934 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1935 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1936 |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1937 ## test readRGBAImage with alpha |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1938 %!testif HAVE_TIFF |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1939 %! function test_fn (filename) |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1940 %! img = Tiff (filename, "w"); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1941 %! setTag(img, struct ( |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1942 %! "ImageLength", 10, "ImageWidth", 10, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1943 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1944 %! "PhotometricInterpretation", 2, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1945 %! "PlanarConfiguration", 1, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1946 %! "ExtraSamples", 1 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1947 %! )); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1948 %! data = uint8 (randi ([0,255], [10, 10, 4])); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1949 %! write (img, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1950 %! [rgb, alpha] = readRGBAImage (img); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1951 %! assert (rgb, data(:,:,1:3)); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1952 %! assert (alpha, data(:,:,4)); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1953 %! endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1954 %! file_wrapper (@test_fn); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1955 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1956 ## test readRGBAStrip |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1957 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1958 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1959 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1960 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1961 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1962 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1963 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1964 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1965 %! "RowsPerStrip", 3 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1966 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1967 %! data = uint8 (randi ([0,255], [10, 10, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1968 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1969 %! [rgb, alpha] = readRGBAStrip (img, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1970 %! assert (rgb, data(1:3,:,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1971 %! assert (alpha, uint8 (repmat ([255], [3, 10]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1972 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1973 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1974 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1975 ## test readRGBAStrip with orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1976 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1977 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1978 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1979 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1980 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1981 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1982 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1983 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1984 %! "RowsPerStrip", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1985 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1986 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1987 %! data = uint8 (randi ([0,255], [10, 10, 3])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1988 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1989 %! [rgb, alpha] = readRGBAStrip (img, 1); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1990 %! assert (rgb, data(3:-1:1,end:-1:1,:)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1991 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1992 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1993 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1994 ## test readRGBAStrip boundary strip |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1995 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1996 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1997 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1998 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1999 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2000 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2001 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2002 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2003 %! "RowsPerStrip", 3 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2004 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2005 %! data = uint8 (randi ([0,255], [10, 10, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2006 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2007 %! [rgb, alpha] = readRGBAStrip (img, 10); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2008 %! assert (rgb, data(10,:,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2009 %! assert (alpha, uint8 (repmat ([255], [1, 10]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2010 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2011 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2012 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2013 ## test readRGBAStrip with alpha |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2014 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2015 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2016 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2017 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2018 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2019 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2020 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2021 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2022 %! "RowsPerStrip", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2023 %! "ExtraSamples", 1 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2024 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2025 %! data = uint8 (randi ([0,255], [10, 10, 4])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2026 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2027 %! [rgb, alpha] = readRGBAStrip (img, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2028 %! assert (rgb, data(1:3,:, 1:3)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2029 %! assert (alpha, data (1:3, :, 4)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2030 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2031 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2032 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2033 ## test readRGBATile |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2034 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2035 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2036 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2037 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2038 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2039 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2040 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2041 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2042 %! "TileLength", 16, "TileWidth", 32 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2043 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2044 %! data = uint8 (randi ([0,255], [40, 40, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2045 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2046 %! [rgb, alpha] = readRGBATile (img, 1, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2047 %! assert (rgb, data(1:16,1:32,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2048 %! assert (alpha, uint8 (repmat ([255], [16, 32]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2049 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2050 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2051 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2052 ## test readRGBATile ith orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2053 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2054 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2055 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2056 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2057 %! "ImageLength", 40, "ImageWidth", 40, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2058 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2059 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2060 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2061 %! "TileLength", 16, "TileWidth", 32, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2062 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2063 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2064 %! data = uint8 (randi ([0,255], [40, 40, 3])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2065 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2066 %! [rgb, alpha] = readRGBATile (img, 1, 1); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2067 %! assert (rgb, data(16:-1:1,32:-1:1,:)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2068 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2069 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2070 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2071 ## test readRGBATile boundary tile |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2072 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2073 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2074 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2075 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2076 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2077 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2078 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2079 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2080 %! "TileLength", 16, "TileWidth", 32 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2081 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2082 %! data = uint8 (randi ([0,255], [40, 40, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2083 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2084 %! [rgb, alpha] = readRGBATile (img, 40, 40); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2085 %! assert (rgb, data(33:end,33:end,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2086 %! assert (alpha, uint8 (repmat ([255], [8, 8]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2087 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2088 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2089 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2090 ## test readRGBATile ith alpha |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2091 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2092 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2093 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2094 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2095 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2096 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2097 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2098 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2099 %! "TileLength", 16, "TileWidth", 32, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2100 %! "ExtraSamples", 1 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2101 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2102 %! data = uint8 (randi ([0,255], [40, 40, 4])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2103 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2104 %! [rgb, alpha] = readRGBATile (img, 1, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2105 %! assert (rgb, data(1:16,1:32,1:3)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2106 %! assert (alpha, data(1:16,1:32,4)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2107 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
2108 %! file_wrapper (@test_fn); |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2109 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2110 ## test directory manipulation |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2111 %!testif HAVE_TIFF |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2112 %! function test_fn (filename) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2113 %! img = Tiff (filename, "w"); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2114 %! tags = struct ( |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2115 %! "ImageLength", 10, "ImageWidth", 10, "BitsPerSample", 8 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2116 %! ); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2117 %! setTag (img, tags); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2118 %! data = uint8 (reshape (1:100, [10, 10])); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2119 %! write(img, data); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2120 %! img.writeDirectory (); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2121 %! setTag (img, tags); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2122 %! write(img, data); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2123 %! img.close(); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2124 %! img = Tiff (filename); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2125 %! assert (img.currentDirectory, 1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2126 %! assert (img.lastDirectory, logical (0)); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2127 %! img.nextDirectory (); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2128 %! assert (img.currentDirectory, 2); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2129 %! assert (img.lastDirectory, logical (1)); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2130 %! img.setDirectory (1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2131 %! assert (img.currentDirectory, 1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2132 %! endfunction |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2133 %! file_wrapper (@test_fn) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2134 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2135 ## test creating and reading subdirectories |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2136 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2137 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2138 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2139 %! setTag(img, struct( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2140 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2141 %! "BitsPerSample", 8, "SubIFD", 1 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2142 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2143 %! data = uint8 (reshape (1:100, [10, 10])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2144 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2145 %! img.writeDirectory (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2146 %! setTag(img, struct( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2147 %! "ImageLength", 15, "ImageWidth", 15, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2148 %! "BitsPerSample", 8 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2149 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2150 %! data_subdir = uint8 (reshape (1:225, [15, 15])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2151 %! write (img, data_subdir); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2152 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2153 %! img = Tiff (filename); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2154 %! assert (img.read(), data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2155 %! offsets = getTag (img, "SubIFD"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2156 %! img.setSubDirectory (offsets (1)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2157 %! assert (img.read(), data_subdir); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2158 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
2159 %! endfunction |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
2160 %! file_wrapper (@test_fn) |