Mercurial > octave-libtiff
annotate scripts/io/Tiff.m @ 31197:1604c8812b67
Tiff: added numberOfDirectories method.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Thu, 01 Sep 2022 01:56:20 +0200 |
parents | f8baeb850b36 |
children | 30b28458bb06 |
rev | line source |
---|---|
31195
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
1 ## PKG_ADD: ## Discard result to avoid polluting workspace with ans at startup. |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
2 ## PKG_ADD: if __have_feature__ ("TIFF") |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
3 ## PKG_ADD: [~] = imformats("update", "tif", |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
4 ## PKG_ADD: struct ("read", @__tiff_imread__, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
5 ## PKG_ADD: "write", @__tiff_imwrite__, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
6 ## PKG_ADD: "info", @__tiff_imfinfo__, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
7 ## PKG_ADD: "ext", {{"tif", "tiff"}}, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
8 ## PKG_ADD: "isa", @__tiff_isa__, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
9 ## PKG_ADD: "alpha", true, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
10 ## PKG_ADD: "multipage", true, |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
11 ## PKG_ADD: "description", "Tagged Image File Format", |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
12 ## PKG_ADD: "coder", "TIFF")); |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
13 ## PKG_ADD: endif |
f8baeb850b36
Tiff: Moved PKG_ADD logic to Tiff.m.
magedrifaat <magedrifaat@gmail.com>
parents:
31189
diff
changeset
|
14 |
31177
c7c79973007f
Tiff: added octave_tiff_handle class to wrap the Tiff file pointer
magedrifaat <magedrifaat@gmail.com>
parents:
31173
diff
changeset
|
15 classdef Tiff |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
16 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
|
17 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
|
18 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
19 Compression = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
20 "None", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
21 "CCITTRLE", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
22 "CCITTFax3", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
23 "CCITTFax4", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
24 "LZW", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
25 "OJPEG", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
26 "JPEG", 7, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
27 "AdobeDeflate", 8, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
28 "Next", 32766, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
29 "CCITTRLEW", 32771, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
30 "PackBits", 32773, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
31 "Thunderscan", 32809, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
32 "IT8CTPad", 32895, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
33 "IT8LW", 32896, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
34 "IT8MP", 32897, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
35 "IT8BL", 32898, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
36 "PixarFilm", 32908, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
37 "PixarLog", 32909, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
38 "Deflate", 32946, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
39 "DCS", 32947, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
40 "JBIG", 34661, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
41 "SGILog", 34676, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
42 "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
|
43 # 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
|
44 "JPEG2000", 34712, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
45 "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
|
46 "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
|
47 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
48 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
49 ExtraSamples = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
50 "Unspecified", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
51 "AssociatedAlpha", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
52 "UnassociatedAlpha", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
53 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
54 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
55 Group3Options = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
56 "Encoding2D", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
57 "Uncompressed", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
58 "FillBits", 4 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
59 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
60 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
61 InkSet = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
62 "CMYK", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
63 "MultiInk", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
64 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
65 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
66 JPEGColorMode = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
67 "Raw", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
68 "RGB", 1 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
69 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
70 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
71 Orientation = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
72 "TopLeft", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
73 "TopRight", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
74 "BottomRight", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
75 "BottomLeft", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
76 "LeftTop", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
77 "RightTop", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
78 "RightBottom", 7, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
79 "LeftBottom", 8 |
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 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
82 Photometric = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
83 "MinIsWhite", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
84 "MinIsBlack", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
85 "RGB", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
86 "Palette", 3, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
87 "Mask", 4, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
88 "Separated", 5, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
89 "YCbCr", 6, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
90 "CIELab", 8, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
91 "ICCLab", 9, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
92 "ITULab", 10, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
93 "LogL", 32844, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
94 "LogLUV", 32845, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
95 "CFA", 32803, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
96 "LinearRaw", 34892 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
97 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
98 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
99 PlanarConfiguration = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
100 "Chunky", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
101 "Separate", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
102 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
103 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
104 ResolutionUnit = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
105 "None", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
106 "Inch", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
107 "Centimeter", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
108 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
109 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
110 SampleFormat = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
111 "UInt", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
112 "Int", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
113 "IEEEFP", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
114 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
115 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
116 SGILogDataFmt = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
117 "Float", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
118 "Bits8", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
119 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
120 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
121 SubFileType = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
122 "Default", 0, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
123 "ReducedImage", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
124 "Page", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
125 "Mask", 4 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
126 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
127 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
128 Thresholding = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
129 "BiLevel", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
130 "HalfTone", 2, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
131 "ErrorDiffuse", 3 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
132 ); |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
133 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
134 YCbCrPositioning = struct ( |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
135 "Centered", 1, |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
136 "Cosited", 2 |
e960e3a3b3f6
Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents:
31158
diff
changeset
|
137 ); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
138 endproperties |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
139 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
140 properties (Access = private) |
31141
af4519cbfcae
Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents:
31140
diff
changeset
|
141 tiff_handle; |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
142 endproperties |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
143 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
144 methods |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
145 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
|
146 if (nargin == 0 || nargin > 2) |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
147 % print_usage(); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
148 error("Usage: Tiff(filename[, mode])"); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
149 endif |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
150 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
151 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
|
152 endfunction |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
153 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
154 function close (t) |
31177
c7c79973007f
Tiff: added octave_tiff_handle class to wrap the Tiff file pointer
magedrifaat <magedrifaat@gmail.com>
parents:
31173
diff
changeset
|
155 __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
|
156 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
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 function tag = getTag (t, tag_name) |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
159 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
|
160 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
161 |
31140
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
162 function setTag (t, varargin) |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
163 __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
|
164 endfunction |
31126
7851c5b9c950
Tiff: implemented writeEncodedStrip function for writing a strip to an image
magedrifaat <magedrifaat@gmail.com>
parents:
31124
diff
changeset
|
165 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
166 function argout = read (t) |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
167 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
|
168 endfunction |
31092
a736190ce738
Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff
changeset
|
169 |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
170 function stripData = readEncodedStrip (t, stripNumber) |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
171 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
|
172 endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
173 |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
174 function tileData = readEncodedTile (t, tileNumber) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
175 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
|
176 endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
177 |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
178 function [RGB, alpha] = readRGBAImage (t) |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
179 [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
|
180 endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
181 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
182 function [RGB, alpha] = readRGBAStrip (t, row) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
183 [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
|
184 endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
185 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
186 function [RGB, alpha] = readRGBATile (t, row, col) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
187 [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
|
188 endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
189 |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
190 function write (t, imageData) |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
191 __tiff_write__ (t.tiff_handle, imageData); |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
192 endfunction |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
193 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
194 function writeEncodedStrip (t, stripNumber, imageData) |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
195 __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
|
196 endfunction |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
197 |
31146
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
198 function writeEncodedTile (t, tileNumber, imageData) |
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
199 __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
|
200 endfunction |
50402b8dfb4a
Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents:
31145
diff
changeset
|
201 |
31148
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
202 function tf = isTiled (t) |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
203 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
|
204 endfunction |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
205 |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
206 function numStrips = numberOfStrips (t) |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
207 numStrips = __tiff_number_of_strips__ (t.tiff_handle); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
208 endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
209 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
210 function numTiles = numberOfTiles (t) |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
211 numTiles = __tiff_number_of_tiles__ (t.tiff_handle); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
212 endfunction |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
213 |
31197
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
214 function numDirs = numberOfDirectories (t) |
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
215 numDirs = __tiff_number_of_directories__ (t.tiff_handle); |
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
216 endfunction |
1604c8812b67
Tiff: added numberOfDirectories method.
magedrifaat <magedrifaat@gmail.com>
parents:
31195
diff
changeset
|
217 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
218 function stripNumber = computeStrip (t, varargin) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
219 stripNumber = __tiff_compute_strip__ (t.tiff_handle, varargin{:}); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
220 endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
221 |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
222 function tileNumber = computeTile (t, varargin) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
223 tileNumber = __tiff_compute_tile__ (t.tiff_handle, varargin{:}); |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
224 endfunction |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
225 |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
226 function dirNum = currentDirectory (t) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
227 dirNum = __tiff_current_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
228 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
229 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
230 function isLast = lastDirectory (t) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
231 isLast = __tiff_last_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
232 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
233 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
234 function nextDirectory (t) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
235 __tiff_next_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
236 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
237 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
238 function setDirectory (t, dirNum) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
239 __tiff_set_directory__ (t.tiff_handle, dirNum); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
240 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
241 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
242 function writeDirectory (t) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
243 __tiff_write_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
244 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
245 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
246 function rewriteDirectory (t) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
247 __tiff_rewrite_directory__ (t.tiff_handle); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
248 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
249 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
250 function setSubDirectory (t, offset) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
251 __tiff_set_sub_directory__ (t.tiff_handle, offset); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
252 endfunction |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
253 |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
254 % TODO(maged): add documentation and make print_usage work |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
255 endmethods |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
256 |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
257 methods (Static = true) |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
258 function versionString = getVersion() |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
259 versionString = __tiff_version__ (); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
260 endfunction |
31161
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
261 |
31173
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
262 function tagNames = getTagNames () |
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
263 tagNames = fieldnames (Tiff.TagID); |
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
264 endfunction |
0abc9779f751
Tiff: modified readRGBAImage to use the orientation tag correctly
magedrifaat <magedrifaat@gmail.com>
parents:
31172
diff
changeset
|
265 |
31161
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
266 function setLibTIFFErrorsEnabled(state) |
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
267 __tiff_set_errors_enabled__ (state); |
b731c8f6db95
Tiff: added setLibTIFFErrorsEnabled method to enable/disable LibTIFF errors
magedrifaat <magedrifaat@gmail.com>
parents:
31159
diff
changeset
|
268 endfunction |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
269 endmethods |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
270 endclassdef |
31124
e8d1cc309bc9
Tiff: added initial implementation of setTag function for scalar tags
magedrifaat <magedrifaat@gmail.com>
parents:
31116
diff
changeset
|
271 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
272 %!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
|
273 %! filename = [tempname() ".tif"]; |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
274 %! unwind_protect |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
275 %! fn (filename); |
31132
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
276 %! unwind_protect_cleanup |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
277 %! unlink (filename); |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
278 %! end_unwind_protect |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
279 %!endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
280 |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
281 %!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
|
282 %! img = Tiff (filename, "r"); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
283 %! data2 = img.read (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
284 %! assert (size (data2), ex_size); |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
285 %! 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
|
286 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
287 %!endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
288 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
289 ## 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
|
290 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
291 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
292 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
293 %! setTag (img, "ImageWidth", 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
294 %! val = getTag (img, "ImageWidth"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
295 %! assert (val, 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
296 %! assert (class (val), "double"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
297 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
298 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
299 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
300 ## 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
|
301 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
302 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
303 %! img = Tiff (filename, "w"); |
31189
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
304 %! fail ("getTag (img, \"ImageWidt\")"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
305 %! fail ("getTag (img, 0xf423f)"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
306 %! fail ("setTag (img, \"ImageWidt\", 2)"); |
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
307 %! fail ("setTag (img, 0xf423f, 2)"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
308 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
309 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
310 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
311 ## test setTag structure input |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
312 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
313 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
314 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
315 %! 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
|
316 %! assert (getTag (img, "ImageLength"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
317 %! assert (getTag (img, "ImageWidth"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
318 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
319 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
320 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
321 ## test failure setTag structure unknown tag |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
322 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
323 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
324 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
325 %! setTag (img, "ImageLength", 1); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
326 %! setTag (img, "ImageWidth", 1); |
31189
6a9d985e7474
Tiff: fixed bug graphicsmagick error handler colliding with our handler
magedrifaat <magedrifaat@gmail.com>
parents:
31186
diff
changeset
|
327 %! 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
|
328 %! assert (getTag (img, "ImageLength"), 2); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
329 %! assert (getTag (img, "ImageWidth"), 1); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
330 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
331 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
332 |
31169
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
333 ## test setTag array field |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
334 %!testif HAVE_TIFF |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
335 %! function test_fn (filename) |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
336 %! img = Tiff (filename, "w"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
337 %! 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
|
338 %! data = getTag (img, "YCbCrCoefficients"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
339 %! 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
|
340 %! endfunction |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
341 %! file_wrapper (@test_fn); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
342 |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
343 ## test setTag special field |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
344 %!testif HAVE_TIFF |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
345 %! function test_fn (filename) |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
346 %! img = Tiff (filename, "w"); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
347 %! setTag (img, "BitsPerSample", 8); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
348 %! 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
|
349 %! setTag (img, "ColorMap", cmap); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
350 %! 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
|
351 %! endfunction |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
352 %! file_wrapper (@test_fn); |
ae41e14bf5c7
Tiff.m: added tests for array and special tags.
magedrifaat <magedrifaat@gmail.com>
parents:
31161
diff
changeset
|
353 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
354 ## 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
|
355 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
356 %! fail ("Tiff (\"test.tif\", \"rh\")", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
357 %! "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
|
358 %! fail ("Tiff ([tempname() \".tif\"], \"r\")"); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
359 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
360 ## 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
|
361 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
362 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
363 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
364 %! setTag (img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
365 %! "ImageLength", 1, "ImageWidth", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
366 %! "BitsPerSample", 8 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
367 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
368 %! write (img, uint8 ([210])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
369 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
370 %! img = Tiff (filename, "r+"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
371 %! setTag (img, "Make", "test_tag"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
372 %! img.rewriteDirectory (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
373 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
374 %! img = Tiff (filename); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
375 %! assert (img.read(), uint8 ([210])); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
376 %! 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
|
377 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
378 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
379 %! file_wrapper (@test_fn) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
380 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
381 ## 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
|
382 %!testif HAVE_TIFF |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
383 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
384 %! 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
|
385 %! 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
|
386 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
387 %! 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
|
388 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
389 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
390 %! 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
|
391 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
392 %! 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
|
393 |
c66f7c227e50
Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents:
31131
diff
changeset
|
394 ## 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
|
395 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
396 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
397 %! 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
|
398 %! 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
|
399 %! 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
|
400 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
401 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
402 %! 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
|
403 |
31134
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
404 ## 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
|
405 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
406 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
407 %! 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
|
408 %! 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
|
409 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
410 %! 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
|
411 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
412 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
413 %! 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
|
414 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
415 %! 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
|
416 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
417 ## 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
|
418 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
419 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
420 %! 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
|
421 %! 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
|
422 %! "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
|
423 %! 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
|
424 %! 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
|
425 %! "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
|
426 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
427 %! 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
|
428 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
429 %! 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
|
430 |
fc0366e009dd
Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31132
diff
changeset
|
431 ## 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
|
432 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
433 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
434 %! 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
|
435 %! 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
|
436 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
437 %! 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
|
438 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
439 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
440 %! 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
|
441 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
442 %! 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
|
443 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
444 ## 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
|
445 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
446 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
447 %! 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
|
448 %! 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
|
449 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
450 %! 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
|
451 %! 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
|
452 %! "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
|
453 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
454 %! 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
|
455 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
456 %! 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
|
457 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
458 ## 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
|
459 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
460 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
461 %! 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
|
462 %! 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
|
463 %! "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
|
464 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
465 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
466 %! 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
|
467 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
468 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
469 %! 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
|
470 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
471 %! 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
|
472 |
31137
233130c0b1f6
Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents:
31136
diff
changeset
|
473 ## 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
|
474 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
475 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
476 %! 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
|
477 %! 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
|
478 %! "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
|
479 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
480 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
481 %! 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
|
482 %! 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
|
483 %! "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
|
484 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
485 %! 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
|
486 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
487 %! 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
|
488 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
489 ## 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
|
490 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
491 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
492 %! 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
|
493 %! 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
|
494 %! "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
|
495 %! "PlanarConfiguration", 2, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
496 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
497 %! 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
|
498 %! 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
|
499 %! 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
|
500 %! endfor |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
501 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
502 %! 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
|
503 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
504 %! 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
|
505 |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
506 ## test 1-bit BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
507 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
508 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
509 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
510 %! 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
|
511 %! 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
|
512 %! writeEncodedStrip (img, 1, data); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
513 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
514 %! 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
|
515 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
516 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
517 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
518 ## 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
|
519 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
520 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
521 %! 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
|
522 %! 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
|
523 %! "BitsPerSample", 16)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
524 %! 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
|
525 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
526 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
527 %! 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
|
528 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
529 %! 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
|
530 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
531 ## 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
|
532 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
533 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
534 %! 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
|
535 %! 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
|
536 %! "BitsPerSample", 32)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
537 %! 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
|
538 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
539 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
540 %! 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
|
541 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
542 %! 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
|
543 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
544 ## 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
|
545 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
546 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
547 %! 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
|
548 %! 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
|
549 %! "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
|
550 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
551 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
552 %! 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
|
553 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
554 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
555 %! 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
|
556 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
557 %! 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
|
558 |
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
559 ## 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
|
560 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
561 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
562 %! 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
|
563 %! 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
|
564 %! "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
|
565 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
566 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
567 %! 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
|
568 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
569 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
570 %! 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
|
571 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
572 %! 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
|
573 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
574 ## test failure unsupported bit-depth |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
575 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
576 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
577 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
578 %! 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
|
579 %! "BitsPerSample", 24)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
580 %! 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
|
581 %! 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
|
582 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
583 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
584 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
585 |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
586 ## 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
|
587 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
588 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
589 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
590 %! 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
|
591 %! "SamplesPerPixel", 3)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
592 %! 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
|
593 %! fail ("writeEncodedStrip (img, 1, data)", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
594 %! "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
|
595 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
596 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
597 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
598 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
599 ## test multi-strip BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
600 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
601 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
602 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
603 %! 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
|
604 %! "RowsPerStrip", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
605 %! 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
|
606 %! for strip = 1:5 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
607 %! 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
|
608 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
609 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
610 %! 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
|
611 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
612 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
613 |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
614 ## test multi-strip grayscale image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
615 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
616 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
617 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
618 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20, |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
619 %! "BitsPerSample", 16, "RowsPerStrip", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
620 %! data = uint16 (reshape (1:400, [20, 20])); |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
621 %! for strip = 1:7 |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
622 %! 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
|
623 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
624 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
625 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
626 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
627 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
628 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
629 ## test multi-strip RGB image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
630 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
631 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
632 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
633 %! 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
|
634 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
635 %! "RowsPerStrip", 2, "PlanarConfiguration", 1, |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
636 %! "PhotometricInterpretation", 2)); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
637 %! 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
|
638 %! for strip = 1:10 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
639 %! 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
|
640 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
641 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
642 %! 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
|
643 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
644 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
645 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
646 ## 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
|
647 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
648 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
649 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
650 %! 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
|
651 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
652 %! "RowsPerStrip", 3, "PlanarConfiguration", 2, |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
653 %! "PhotometricInterpretation", 2)); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
654 %! 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
|
655 %! strip = 1; |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
656 %! for sample = 1:3 |
31153
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
657 %! for row = 1:3:20 |
c66d6c7f025e
Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents:
31151
diff
changeset
|
658 %! 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
|
659 %! strip = strip + 1; |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
660 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
661 %! endfor |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
662 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
663 %! 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
|
664 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
665 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
666 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
667 ## test single-precision image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
668 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
669 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
670 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
671 %! 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
|
672 %! "BitsPerSample", 32, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
673 %! 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
|
674 %! writeEncodedStrip (img, 1, data); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
675 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
676 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
677 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
678 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
679 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
680 ## test double-precision image |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
681 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
682 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
683 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
684 %! 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
|
685 %! "BitsPerSample", 64, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
686 %! 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
|
687 %! writeEncodedStrip (img, 1, data); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
688 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
689 %! verify_data (filename, data, [20, 20]); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
690 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
691 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
692 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
693 ## 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
|
694 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
695 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
696 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
697 %! 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
|
698 %! "BitsPerSample", 16, "SampleFormat", 3)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
699 %! 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
|
700 %! fail ("writeEncodedStrip (img, 1, data)", |
31178
14edd6b09efe
Tiff: added support for reading and writing signed images
magedrifaat <magedrifaat@gmail.com>
parents:
31177
diff
changeset
|
701 %! "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
|
702 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
703 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
704 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
705 |
31135
b7ffe64e0287
Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents:
31134
diff
changeset
|
706 ## 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
|
707 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
708 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
709 %! 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
|
710 %! 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
|
711 %! "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
|
712 %! "PlanarConfiguration", 1, |
5f70efad6e2c
Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents:
31139
diff
changeset
|
713 %! "PhotometricInterpretation", 2)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
714 %! 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
|
715 %! 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
|
716 %! img.close (); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
717 %! endfunction |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
718 %! file_wrapper (@test_fn); |
31138
68762676dab1
Tiff writeEncodedStrip: prevent writing to a read-only file
magedrifaat <magedrifaat@gmail.com>
parents:
31137
diff
changeset
|
719 |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
720 ## 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
|
721 %!testif HAVE_TIFF |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
722 %! function test_fn (filename) |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
723 %! 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
|
724 %! 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
|
725 %! "BitsPerSample", 8)); |
31139
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
726 %! data = uint8 (1); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
727 %! writeEncodedStrip (img, 1, data); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
728 %! img.close(); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
729 %! img = Tiff (filename, "r"); |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
730 %! fail ("writeEncodedStrip(img, 1, [1])", |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
731 %! "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
|
732 %! img.close(); |
3431a15b2c75
Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents:
31138
diff
changeset
|
733 %! endfunction |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
734 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
735 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
736 ## test failure unsupported sample format |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
737 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
738 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
739 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
740 %! 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
|
741 %! "BitsPerSample", 16, "SampleFormat", 5)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
742 %! 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
|
743 %! 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
|
744 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
745 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
746 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
747 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
748 ## test failure wrong strip number |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
749 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
750 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
751 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
752 %! 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
|
753 %! "BitsPerSample", 16, "RowsPerStrip", 5)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
754 %! 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
|
755 %! fail ("writeEncodedStrip (img, 5, strip_data)", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
756 %! "Strip number out of range"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
757 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
758 %! endfunction |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
759 %! file_wrapper (@test_fn); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
760 |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
761 ## 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
|
762 %!testif HAVE_TIFF |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
763 %! function test_fn (filename) |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
764 %! img = Tiff (filename, "w"); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
765 %! 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
|
766 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
767 %! "TileWidth", 16)); |
31143
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
768 %! 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
|
769 %! fail ("writeEncodedStrip (img, 1, data)", |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
770 %! "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
|
771 %! img.close (); |
a68f2dadafee
Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents:
31141
diff
changeset
|
772 %! endfunction |
31147
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
773 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
774 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
775 ## test tiled BiLevel image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
776 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
777 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
778 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
779 %! 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
|
780 %! "TileLength", 16, "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
781 %! 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
|
782 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
783 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
784 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
785 %! 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
|
786 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
787 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
788 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
789 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
790 %! 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
|
791 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
792 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
793 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
794 ## test tiled grayscale image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
795 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
796 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
797 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
798 %! 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
|
799 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
800 %! "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
801 %! 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
|
802 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
803 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
804 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
805 %! 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
|
806 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
807 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
808 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
809 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
810 %! 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
|
811 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
812 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
813 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
814 ## 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
|
815 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
816 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
817 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
818 %! 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
|
819 %! "BitsPerSample", 16, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
820 %! "TileWidth", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
821 %! 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
|
822 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
823 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
824 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
825 %! 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
|
826 %! col:min(col+15, 20))); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
827 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
828 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
829 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
830 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
831 %! 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
|
832 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
833 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
834 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
835 ## test tiled RGB image |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
836 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
837 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
838 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
839 %! 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
|
840 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
841 %! "PlanarConfiguration", 1, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
842 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
843 %! 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
|
844 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
845 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
846 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
847 %! 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
|
848 %! col:min(col+15,20), :)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
849 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
850 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
851 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
852 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
853 %! 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
|
854 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
855 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
856 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
857 ## 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
|
858 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
859 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
860 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
861 %! 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
|
862 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
863 %! "PlanarConfiguration", 2, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
864 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
865 %! 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
|
866 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
867 %! for channel=1:3 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
868 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
869 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
870 %! 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
|
871 %! 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
|
872 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
873 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
874 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
875 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
876 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
877 %! 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
|
878 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
879 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
880 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
881 ## 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
|
882 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
883 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
884 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
885 %! 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
|
886 %! "BitsPerSample", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
887 %! 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
|
888 %! fail ("writeEncodedTile (img, 1, data)", |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
889 %! "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
|
890 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
891 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
892 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
893 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
894 ## 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
|
895 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
896 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
897 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
898 %! 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
|
899 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
900 %! "PlanarConfiguration", 1, "TileLength", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
901 %! "TileWidth", 16, "PhotometricInterpretation", 2)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
902 %! 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
|
903 %! tile = 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
904 %! for row = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
905 %! for col = 1:16:32 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
906 %! 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
|
907 %! 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
|
908 %! tile = tile + 1; |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
909 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
910 %! endfor |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
911 %! 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
|
912 %! "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
|
913 %! 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
|
914 %! "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
|
915 %! 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
|
916 %! "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
|
917 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
918 %! 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
|
919 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
920 %! file_wrapper (@test_fn); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
921 |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
922 ## test failure wrong tile number |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
923 %!testif HAVE_TIFF |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
924 %! function test_fn (filename) |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
925 %! img = Tiff (filename, "w"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
926 %! 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
|
927 %! "BitsPerSample", 16, "TileWidth", 16, |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
928 %! "TileLength", 16)); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
929 %! 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
|
930 %! 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
|
931 %! "Tile number out of range"); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
932 %! img.close (); |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
933 %! endfunction |
7af78a63d3c3
Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents:
31146
diff
changeset
|
934 %! 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
|
935 |
4bc9a1938f9a
Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents:
31147
diff
changeset
|
936 ## 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
|
937 %!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
|
938 %! 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
|
939 %! 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
|
940 %! 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
|
941 %! 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
|
942 %! 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
|
943 %! 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
|
944 %! endfunction |
31149
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
945 %! file_wrapper (@test_fn); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
946 |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
947 ## test numberOfStrips returns the correct value |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
948 %!testif HAVE_TIFF |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
949 %! function test_fn (filename) |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
950 %! img = Tiff (filename, "w"); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
951 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10)); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
952 %! assert (numberOfStrips (img), 1); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
953 %! setTag (img, "RowsPerStrip", 2); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
954 %! assert (numberOfStrips (img), 5); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
955 %! setTag (img, "RowsPerStrip", 4); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
956 %! assert (numberOfStrips (img), 3); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
957 %! setTag (img, "TileLength", 16); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
958 %! setTag (img, "TileWidth", 16); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
959 %! fail ("numberOfStrips (img)", "The image is tiled not stripped"); |
d4dbc69f301e
Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents:
31148
diff
changeset
|
960 %! endfunction |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
961 %! file_wrapper (@test_fn); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
962 |
31151
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
963 ## test numberOfTiles returns the correct value |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
964 %!testif HAVE_TIFF |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
965 %! function test_fn (filename) |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
966 %! img = Tiff (filename, "w"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
967 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20, |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
968 %! "TileLength", 16, "TileWidth", 16)); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
969 %! assert (numberOfTiles (img), 4); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
970 %! setTag (img, "TileLength", 32); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
971 %! assert (numberOfTiles (img), 2); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
972 %! setTag (img, "TileWidth", 32); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
973 %! assert (numberOfTiles (img), 1); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
974 %! img = Tiff (filename, "w"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
975 %! fail ("numberOfTiles (img)", "The image is stripped not tiled"); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
976 %! endfunction |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
977 %! file_wrapper (@test_fn); |
6fb54834aa93
Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents:
31150
diff
changeset
|
978 |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
979 ## test computeStrip returns the correct value |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
980 %!testif HAVE_TIFF |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
981 %! function test_fn (filename) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
982 %! img = Tiff (filename, "w"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
983 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
984 %! "RowsPerStrip", 2, "BitsPerSample", 8, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
985 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1)); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
986 %! assert (computeStrip (img, 1), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
987 %! assert (computeStrip (img, 2), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
988 %! assert (computeStrip (img, 0), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
989 %! assert (computeStrip (img, 10), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
990 %! assert (computeStrip (img, 11), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
991 %! setTag (img, "PlanarConfiguration", 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
992 %! ## 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
|
993 %! ## replaced by rewriteDirectory |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
994 %! writeEncodedStrip (img, 1, uint8 (reshape (1:20, [2, 10]))); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
995 %! assert (computeStrip (img, 1, 2), 6); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
996 %! assert (computeStrip (img, 100, 1), 5); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
997 %! img = Tiff (filename, "w"); |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
998 %! setTag (img, "TileWidth", 16); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
999 %! setTag (img, "TileLength", 16); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1000 %! 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
|
1001 %! endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1002 %! file_wrapper (@test_fn); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1003 |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1004 ## test computeTile returns the correct value |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1005 %!testif HAVE_TIFF |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1006 %! function test_fn (filename) |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1007 %! img = Tiff (filename, "w"); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1008 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1009 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1010 %! "TileLength", 16, "TileWidth", 16, |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1011 %! "PlanarConfiguration", 1)); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1012 %! assert (computeTile (img, [1, 1]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1013 %! assert (computeTile (img, [2, 2]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1014 %! assert (computeTile (img, [0, 0]), 1); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1015 %! assert (computeTile (img, [8, 17]), 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1016 %! assert (computeTile (img, [19, 10]), 3); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1017 %! assert (computeTile (img, [17, 17]), 4); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1018 %! assert (computeTile (img, [100, 100]), 4); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1019 %! setTag (img, "PlanarConfiguration", 2); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1020 %! ## 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
|
1021 %! ## replaced by rewriteDirectory |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1022 %! writeEncodedTile (img, 1, uint8 (reshape (1:256, [16, 16]))); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1023 %! assert (computeTile (img, [1, 1], 2), 5); |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1024 %! assert (computeTile (img, [100, 100], 1), 4); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1025 %! img = Tiff (filename, "w"); |
31150
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1026 %! 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
|
1027 %! endfunction |
6bede2d6f273
Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31149
diff
changeset
|
1028 %! 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
|
1029 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1030 ## 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
|
1031 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1032 %! 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
|
1033 %! 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
|
1034 %! 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
|
1035 %! 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
|
1036 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1037 %! 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
|
1038 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1039 %! 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
|
1040 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1041 ## 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
|
1042 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1043 %! 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
|
1044 %! 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
|
1045 %! 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
|
1046 %! 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
|
1047 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1048 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1049 %! 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
|
1050 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1051 %! 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
|
1052 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1053 ## 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
|
1054 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1055 %! 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
|
1056 %! 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
|
1057 %! 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
|
1058 %! "RowsPerStrip", 3)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1059 %! 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
|
1060 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1061 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1062 %! 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
|
1063 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1064 %! 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
|
1065 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1066 ## 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
|
1067 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1068 %! 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
|
1069 %! 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
|
1070 %! 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
|
1071 %! "BitsPerSample", 8)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1072 %! 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
|
1073 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1074 %! 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
|
1075 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1076 %! 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
|
1077 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1078 ## 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
|
1079 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1080 %! 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
|
1081 %! 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
|
1082 %! 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
|
1083 %! "BitsPerSample", 8)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1084 %! 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
|
1085 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1086 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1087 %! 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
|
1088 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1089 %! 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
|
1090 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1091 ## 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
|
1092 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1093 %! 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
|
1094 %! 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
|
1095 %! 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
|
1096 %! "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
|
1097 %! 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
|
1098 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1099 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1100 %! 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
|
1101 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1102 %! 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
|
1103 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1104 ## 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
|
1105 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1106 %! 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
|
1107 %! 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
|
1108 %! 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
|
1109 %! "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
|
1110 %! "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
|
1111 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1112 %! 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
|
1113 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1114 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1115 %! 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
|
1116 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1117 %! 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
|
1118 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1119 ## 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
|
1120 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1121 %! 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
|
1122 %! 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
|
1123 %! 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
|
1124 %! "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
|
1125 %! "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
|
1126 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1127 %! 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
|
1128 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1129 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1130 %! 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
|
1131 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1132 %! 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
|
1133 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1134 ## 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
|
1135 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1136 %! 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
|
1137 %! 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
|
1138 %! 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
|
1139 %! "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
|
1140 %! "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
|
1141 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1142 %! 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
|
1143 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1144 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1145 %! 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
|
1146 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1147 %! 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
|
1148 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1149 ## 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
|
1150 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1151 %! 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
|
1152 %! 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
|
1153 %! 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
|
1154 %! "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
|
1155 %! "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
|
1156 %! "PhotometricInterpretation", 2)); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1157 %! 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
|
1158 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1159 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1160 %! 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
|
1161 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1162 %! 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
|
1163 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1164 ## 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
|
1165 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1166 %! 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
|
1167 %! 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
|
1168 %! 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
|
1169 %! "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
|
1170 %! "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
|
1171 %! "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
|
1172 %! 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
|
1173 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1174 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1175 %! 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
|
1176 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1177 %! 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
|
1178 |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1179 ## 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
|
1180 %!testif HAVE_TIFF |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1181 %! 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
|
1182 %! 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
|
1183 %! 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
|
1184 %! "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
|
1185 %! "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
|
1186 %! "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
|
1187 %! 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
|
1188 %! write (img, data); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1189 %! img.close(); |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1190 %! 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
|
1191 %! endfunction |
828b7cc9aa36
Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31153
diff
changeset
|
1192 %! 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
|
1193 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1194 ## test write signed integer image |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1195 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1196 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1197 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1198 %! setTag (img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1199 %! "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
|
1200 %! "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
|
1201 %! "PhotometricInterpretation", Tiff.Photometric.RGB, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1202 %! "PlanarConfiguration", Tiff.PlanarConfiguration.Chunky)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1203 %! 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
|
1204 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1205 %! img.close (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1206 %! 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
|
1207 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1208 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1209 |
31156
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1210 ## 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
|
1211 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1212 %! 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
|
1213 %! 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
|
1214 %! 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
|
1215 %! "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
|
1216 %! 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
|
1217 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1218 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1219 %! 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
|
1220 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1221 %! 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
|
1222 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1223 ## 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
|
1224 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1225 %! 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
|
1226 %! 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
|
1227 %! 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
|
1228 %! "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
|
1229 %! "BitsPerSample", 16)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1230 %! 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
|
1231 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1232 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1233 %! 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
|
1234 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1235 %! 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
|
1236 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1237 ## 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
|
1238 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1239 %! 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
|
1240 %! 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
|
1241 %! 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
|
1242 %! "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
|
1243 %! "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
|
1244 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1245 %! "PlanarConfiguration", 1)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1246 %! 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
|
1247 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1248 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1249 %! 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
|
1250 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1251 %! 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
|
1252 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1253 ## 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
|
1254 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1255 %! 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
|
1256 %! 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
|
1257 %! 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
|
1258 %! "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
|
1259 %! "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
|
1260 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1261 %! "PlanarConfiguration", 2)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1262 %! 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
|
1263 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1264 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1265 %! 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
|
1266 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1267 %! 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
|
1268 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1269 ## 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
|
1270 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1271 %! 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
|
1272 %! 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
|
1273 %! 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
|
1274 %! "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
|
1275 %! "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
|
1276 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1277 %! "PlanarConfiguration", 1)); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1278 %! 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
|
1279 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1280 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1281 %! 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
|
1282 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1283 %! 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
|
1284 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1285 ## 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
|
1286 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1287 %! 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
|
1288 %! 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
|
1289 %! 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
|
1290 %! "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
|
1291 %! "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
|
1292 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1293 %! "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
|
1294 %! 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
|
1295 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1296 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1297 %! 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
|
1298 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1299 %! 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
|
1300 |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1301 ## 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
|
1302 %!testif HAVE_TIFF |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1303 %! 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
|
1304 %! 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
|
1305 %! 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
|
1306 %! "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
|
1307 %! "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
|
1308 %! "PhotometricInterpretation", 2, |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1309 %! "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
|
1310 %! 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
|
1311 %! write (img, data); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1312 %! img.close(); |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1313 %! 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
|
1314 %! endfunction |
1e633a093faa
Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31154
diff
changeset
|
1315 %! file_wrapper (@test_fn); |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1316 |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1317 ## test readEncodedStrip BiLevel image |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1318 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1319 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1320 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1321 %! 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
|
1322 %! "RowsPerStrip", 6)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1323 %! 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
|
1324 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1325 %! s1 = readEncodedStrip (img, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1326 %! s2 = readEncodedStrip (img, 2); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1327 %! assert ([s1;s2], data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1328 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1329 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1330 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1331 |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1332 ## test readEncodedStrip RGB Chunky |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1333 %!testif HAVE_TIFF |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1334 %! function test_fn (filename) |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1335 %! img = Tiff (filename, "w"); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1336 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1337 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1338 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1339 %! "PlanarConfiguration", 1)); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1340 %! 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
|
1341 %! write (img, data); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1342 %! s1 = readEncodedStrip (img, 1); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1343 %! s2 = readEncodedStrip (img, 2); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1344 %! assert ([s1;s2], data); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1345 %! img.close(); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1346 %! endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1347 %! file_wrapper (@test_fn); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1348 |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1349 ## test readEncodedStrip RGB Separated |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1350 %!testif HAVE_TIFF |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1351 %! function test_fn (filename) |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1352 %! img = Tiff (filename, "w"); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1353 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1354 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1355 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6, |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1356 %! "PlanarConfiguration", 2)); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1357 %! 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
|
1358 %! write (img, data); |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1359 %! s = cell (6, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1360 %! for i=1:6 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1361 %! s{i} = readEncodedStrip (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1362 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1363 %! 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
|
1364 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1365 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1366 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1367 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1368 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1369 ## test readEncodedTile BiLevel image |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1370 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1371 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1372 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1373 %! 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
|
1374 %! "TileWidth", 16, "TileLength", 16)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1375 %! 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
|
1376 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1377 %! t = cell (9, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1378 %! for i=1:9 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1379 %! t{i} = readEncodedTile (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1380 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1381 %! 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
|
1382 %! 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
|
1383 %! assert (data2, data); |
31157
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1384 %! img.close(); |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1385 %! endfunction |
dc3d2744916d
Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents:
31156
diff
changeset
|
1386 %! file_wrapper (@test_fn); |
31158
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1387 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1388 ## test readEncodedTile RGB Chunky |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1389 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1390 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1391 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1392 %! 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
|
1393 %! "TileWidth", 16, "TileLength", 16, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1394 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1395 %! "PhotometricInterpretation", 2, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1396 %! "PlanarConfiguration", 1)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1397 %! 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
|
1398 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1399 %! t = cell (9, 1); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1400 %! for i=1:9 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1401 %! t{i} = readEncodedTile (img, i); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1402 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1403 %! 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
|
1404 %! 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
|
1405 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1406 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1407 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1408 %! file_wrapper (@test_fn); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1409 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1410 ## test readEncodedTile RGB Separated |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1411 %!testif HAVE_TIFF |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1412 %! function test_fn (filename) |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1413 %! img = Tiff (filename, "w"); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1414 %! 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
|
1415 %! "TileWidth", 16, "TileLength", 16, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1416 %! "BitsPerSample", 16, "SamplesPerPixel", 3, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1417 %! "PhotometricInterpretation", 2, |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1418 %! "PlanarConfiguration", 2)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1419 %! 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
|
1420 %! write (img, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1421 %! data2 = uint16 (zeros (40, 40, 3)); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1422 %! tile = 1; |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1423 %! for sample=1:3 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1424 %! for row=1:16:40 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1425 %! for col=1:16:40 |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1426 %! 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
|
1427 %! = readEncodedTile(img, tile); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1428 %! tile += 1; |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1429 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1430 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1431 %! endfor |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1432 %! assert (data2, data); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1433 %! img.close(); |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1434 %! endfunction |
f2ae7763739a
Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents:
31157
diff
changeset
|
1435 %! 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
|
1436 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1437 ## test readRGBAImage |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1438 %!testif HAVE_TIFF |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1439 %! function test_fn (filename) |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1440 %! img = Tiff (filename, "w"); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1441 %! setTag(img, struct ( |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1442 %! "ImageLength", 10, "ImageWidth", 10, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1443 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1444 %! "PhotometricInterpretation", 2, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1445 %! "PlanarConfiguration", 1 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1446 %! )); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1447 %! 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
|
1448 %! write (img, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1449 %! [rgb, alpha] = readRGBAImage (img); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1450 %! assert (rgb, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1451 %! 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
|
1452 %! endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1453 %! file_wrapper (@test_fn); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1454 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1455 ## test readRGBAImage with orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1456 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1457 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1458 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1459 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1460 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1461 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1462 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1463 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1464 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1465 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1466 %! 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
|
1467 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1468 %! [rgb, alpha] = readRGBAImage (img); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1469 %! 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
|
1470 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1471 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1472 |
31170
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1473 ## test readRGBAImage with alpha |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1474 %!testif HAVE_TIFF |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1475 %! function test_fn (filename) |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1476 %! img = Tiff (filename, "w"); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1477 %! setTag(img, struct ( |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1478 %! "ImageLength", 10, "ImageWidth", 10, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1479 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1480 %! "PhotometricInterpretation", 2, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1481 %! "PlanarConfiguration", 1, |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1482 %! "ExtraSamples", 1 |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1483 %! )); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1484 %! 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
|
1485 %! write (img, data); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1486 %! [rgb, alpha] = readRGBAImage (img); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1487 %! 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
|
1488 %! assert (alpha, data(:,:,4)); |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1489 %! endfunction |
72a159bc5a4c
Tiff: added readRGBAImage method to read image using the RGBA interface
magedrifaat <magedrifaat@gmail.com>
parents:
31169
diff
changeset
|
1490 %! file_wrapper (@test_fn); |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1491 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1492 ## test readRGBAStrip |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1493 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1494 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1495 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1496 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1497 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1498 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1499 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1500 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1501 %! "RowsPerStrip", 3 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1502 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1503 %! data = uint8 (randi ([0,255], [10, 10, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1504 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1505 %! [rgb, alpha] = readRGBAStrip (img, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1506 %! assert (rgb, data(1:3,:,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1507 %! assert (alpha, uint8 (repmat ([255], [3, 10]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1508 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1509 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1510 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1511 ## test readRGBAStrip with orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1512 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1513 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1514 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1515 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1516 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1517 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1518 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1519 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1520 %! "RowsPerStrip", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1521 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1522 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1523 %! 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
|
1524 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1525 %! [rgb, alpha] = readRGBAStrip (img, 1); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1526 %! 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
|
1527 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1528 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1529 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1530 ## test readRGBAStrip boundary strip |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1531 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1532 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1533 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1534 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1535 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1536 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1537 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1538 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1539 %! "RowsPerStrip", 3 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1540 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1541 %! data = uint8 (randi ([0,255], [10, 10, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1542 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1543 %! [rgb, alpha] = readRGBAStrip (img, 10); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1544 %! assert (rgb, data(10,:,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1545 %! assert (alpha, uint8 (repmat ([255], [1, 10]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1546 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1547 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1548 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1549 ## test readRGBAStrip with alpha |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1550 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1551 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1552 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1553 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1554 %! "ImageLength", 10, "ImageWidth", 10, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1555 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1556 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1557 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1558 %! "RowsPerStrip", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1559 %! "ExtraSamples", 1 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1560 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1561 %! data = uint8 (randi ([0,255], [10, 10, 4])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1562 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1563 %! [rgb, alpha] = readRGBAStrip (img, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1564 %! assert (rgb, data(1:3,:, 1:3)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1565 %! assert (alpha, data (1:3, :, 4)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1566 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1567 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1568 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1569 ## test readRGBATile |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1570 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1571 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1572 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1573 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1574 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1575 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1576 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1577 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1578 %! "TileLength", 16, "TileWidth", 32 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1579 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1580 %! data = uint8 (randi ([0,255], [40, 40, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1581 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1582 %! [rgb, alpha] = readRGBATile (img, 1, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1583 %! assert (rgb, data(1:16,1:32,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1584 %! assert (alpha, uint8 (repmat ([255], [16, 32]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1585 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1586 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1587 |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1588 ## test readRGBATile ith orientation |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1589 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1590 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1591 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1592 %! setTag(img, struct ( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1593 %! "ImageLength", 40, "ImageWidth", 40, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1594 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1595 %! "PhotometricInterpretation", 2, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1596 %! "PlanarConfiguration", 1, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1597 %! "TileLength", 16, "TileWidth", 32, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1598 %! "Orientation", Tiff.Orientation.BottomRight |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1599 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1600 %! 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
|
1601 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1602 %! [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
|
1603 %! 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
|
1604 %! endfunction |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1605 %! file_wrapper (@test_fn); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1606 |
31171
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1607 ## test readRGBATile boundary tile |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1608 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1609 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1610 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1611 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1612 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1613 %! "BitsPerSample", 8, "SamplesPerPixel", 3, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1614 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1615 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1616 %! "TileLength", 16, "TileWidth", 32 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1617 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1618 %! data = uint8 (randi ([0,255], [40, 40, 3])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1619 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1620 %! [rgb, alpha] = readRGBATile (img, 40, 40); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1621 %! assert (rgb, data(33:end,33:end,:)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1622 %! assert (alpha, uint8 (repmat ([255], [8, 8]))); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1623 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1624 %! file_wrapper (@test_fn); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1625 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1626 ## test readRGBATile ith alpha |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1627 %!testif HAVE_TIFF |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1628 %! function test_fn (filename) |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1629 %! img = Tiff (filename, "w"); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1630 %! setTag(img, struct ( |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1631 %! "ImageLength", 40, "ImageWidth", 40, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1632 %! "BitsPerSample", 8, "SamplesPerPixel", 4, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1633 %! "PhotometricInterpretation", 2, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1634 %! "PlanarConfiguration", 1, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1635 %! "TileLength", 16, "TileWidth", 32, |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1636 %! "ExtraSamples", 1 |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1637 %! )); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1638 %! data = uint8 (randi ([0,255], [40, 40, 4])); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1639 %! write (img, data); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1640 %! [rgb, alpha] = readRGBATile (img, 1, 1); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1641 %! assert (rgb, data(1:16,1:32,1:3)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1642 %! assert (alpha, data(1:16,1:32,4)); |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1643 %! endfunction |
8bf3fa6b6977
Tiff: added readRGBAStrip and readRGBATile methods
magedrifaat <magedrifaat@gmail.com>
parents:
31170
diff
changeset
|
1644 %! file_wrapper (@test_fn); |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1645 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1646 ## test directory manipulation |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1647 %!testif HAVE_TIFF |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1648 %! function test_fn (filename) |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1649 %! img = Tiff (filename, "w"); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1650 %! tags = struct ( |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1651 %! "ImageLength", 10, "ImageWidth", 10, "BitsPerSample", 8 |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1652 %! ); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1653 %! setTag (img, tags); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1654 %! data = uint8 (reshape (1:100, [10, 10])); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1655 %! write(img, data); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1656 %! img.writeDirectory (); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1657 %! setTag (img, tags); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1658 %! write(img, data); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1659 %! img.close(); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1660 %! img = Tiff (filename); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1661 %! assert (img.currentDirectory, 1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1662 %! assert (img.lastDirectory, logical (0)); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1663 %! img.nextDirectory (); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1664 %! assert (img.currentDirectory, 2); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1665 %! assert (img.lastDirectory, logical (1)); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1666 %! img.setDirectory (1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1667 %! assert (img.currentDirectory, 1); |
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1668 %! endfunction |
31179
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1669 %! file_wrapper (@test_fn) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1670 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1671 ## test creating and reading subdirectories |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1672 %!testif HAVE_TIFF |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1673 %! function test_fn (filename) |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1674 %! img = Tiff (filename, "w"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1675 %! setTag(img, struct( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1676 %! "ImageLength", 10, "ImageWidth", 10, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1677 %! "BitsPerSample", 8, "SubIFD", 1 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1678 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1679 %! 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
|
1680 %! write (img, data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1681 %! img.writeDirectory (); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1682 %! setTag(img, struct( |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1683 %! "ImageLength", 15, "ImageWidth", 15, |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1684 %! "BitsPerSample", 8 |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1685 %! )); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1686 %! 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
|
1687 %! write (img, data_subdir); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1688 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1689 %! img = Tiff (filename); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1690 %! assert (img.read(), data); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1691 %! offsets = getTag (img, "SubIFD"); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1692 %! img.setSubDirectory (offsets (1)); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1693 %! assert (img.read(), data_subdir); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1694 %! img.close(); |
f294b800f002
Tiff.m: added tests for signed images and sub-directories.
magedrifaat <magedrifaat@gmail.com>
parents:
31178
diff
changeset
|
1695 %! endfunction |
31172
3f5f1404af8a
Tiff: added directory methods (currentDirectory, nextDirectory, ...)
magedrifaat <magedrifaat@gmail.com>
parents:
31171
diff
changeset
|
1696 %! file_wrapper (@test_fn) |