annotate scripts/io/Tiff.m @ 31159:e960e3a3b3f6

Tiff.m: added structs for tag value enums to the Tiff class.
author magedrifaat <magedrifaat@gmail.com>
date Mon, 08 Aug 2022 00:06:19 +0200
parents f2ae7763739a
children b731c8f6db95
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
1 classdef Tiff < handle
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
2 properties (Constant = true)
31159
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
3 TagID = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
4 "SubFileType", 254,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
5 "ImageWidth", 256,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
6 "ImageLength", 257,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
7 "BitsPerSample", 258,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
8 "Compression", 259,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
9 "Photometric", 262,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
10 "Thresholding", 263,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
11 "FillOrder", 266,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
12 "DocumentName", 269,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
13 "ImageDescription", 270,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
14 "Make", 271,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
15 "Model", 272,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
16 "StripOffsets", 273,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
17 "Orientation", 274,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
18 "SamplesPerPixel", 277,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
19 "RowsPerStrip", 278,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
20 "StripByteCounts", 279,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
21 "MinSampleValue", 280,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
22 "MaxSampleValue", 281,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
23 "XResolution", 282,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
24 "YResolution", 283,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
25 "PlanarConfiguration", 284,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
26 "PageName", 285,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
27 "XPosition", 286,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
28 "YPosition", 287,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
29 "GrayResponseUnit", 290,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
30 'GrayResponseCurve', 291,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
31 "Group3Options", 292,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
32 "Group4Options", 293,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
33 "ResolutionUnit", 296,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
34 "PageNumber", 297,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
35 "TransferFunction", 301,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
36 "Software", 305,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
37 "DateTime", 306,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
38 "Artist", 315,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
39 "HostComputer", 316,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
40 "WhitePoint", 318,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
41 "PrimaryChromaticities", 319,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
42 "ColorMap", 320,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
43 "HalfToneHints", 321,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
44 "TileWidth", 322,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
45 "TileLength", 323,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
46 "TileOffsets", 324,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
47 "TileByteCounts", 325,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
48 "SubIFD", 330,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
49 "InkSet", 332,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
50 "InkNames", 333,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
51 "NumberOfInks", 334,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
52 "DotRange", 336,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
53 "TargetPrinter", 337,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
54 "ExtraSamples", 338,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
55 "SampleFormat", 339,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
56 "SMinSampleValue", 340,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
57 "SMaxSampleValue", 341,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
58 "YCbCrCoefficients", 529,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
59 "YCbCrSubSampling", 530,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
60 "YCbCrPositioning", 531,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
61 "ReferenceBlackWhite", 532,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
62 "XMP", 700,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
63 "ImageDepth", 32997,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
64 "Copyright", 33432,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
65 "RichTIFFIPTC", 33723,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
66 "Photoshop", 34377,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
67 "ICCProfile", 34675,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
68 "SToNits", 37439,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
69 "JPEGQuality", 65537,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
70 "JPEGColorMode", 65538,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
71 "ZipQuality", 65557,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
72 "SGILogDataFmt", 65560
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
73 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
74
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
75 Compression = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
76 "None", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
77 "CCITTRLE", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
78 "CCITTFax3", 3,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
79 "CCITTFax4", 4,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
80 "LZW", 5,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
81 "OJPEG", 6,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
82 "JPEG", 7,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
83 "AdobeDeflate", 8,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
84 "Next", 32766,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
85 "CCITTRLEW", 32771,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
86 "PackBits", 32773,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
87 "Thunderscan", 32809,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
88 "IT8CTPad", 32895,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
89 "IT8LW", 32896,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
90 "IT8MP", 32897,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
91 "IT8BL", 32898,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
92 "PixarFilm", 32908,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
93 "PixarLog", 32909,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
94 "Deflate", 32946,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
95 "DCS", 32947,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
96 "JBIG", 34661,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
97 "SGILog", 34676,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
98 "SGILog24", 34677,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
99 "JPEG2000", 34712,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
100 "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
101 "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
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 ExtraSamples = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
105 "Unspecified", 0,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
106 "AssociatedAlpha", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
107 "UnassociatedAlpha", 2
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 Group3Options = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
111 "Encoding2D", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
112 "Uncompressed", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
113 "FillBits", 4
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 InkSet = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
117 "CMYK", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
118 "MultiInk", 2
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 JPEGColorMode = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
122 "Raw", 0,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
123 "RGB", 1
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
124 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
125
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
126 Orientation = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
127 "TopLeft", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
128 "TopRight", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
129 "BottomRight", 3,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
130 "BottomLeft", 4,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
131 "LeftTop", 5,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
132 "RightTop", 6,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
133 "RightBottom", 7,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
134 "LeftBottom", 8
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
135 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
136
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
137 Photometric = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
138 "MinIsWhite", 0,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
139 "MinIsBlack", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
140 "RGB", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
141 "Palette", 3,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
142 "Mask", 4,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
143 "Separated", 5,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
144 "YCbCr", 6,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
145 "CIELab", 8,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
146 "ICCLab", 9,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
147 "ITULab", 10,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
148 "LogL", 32844,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
149 "LogLUV", 32845,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
150 "CFA", 32803,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
151 "LinearRaw", 34892
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
152 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
153
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
154 PlanarConfiguration = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
155 "Chunky", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
156 "Separate", 2
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
157 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
158
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
159 ResolutionUnit = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
160 "None", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
161 "Inch", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
162 "Centimeter", 3
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
163 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
164
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
165 SampleFormat = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
166 "UInt", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
167 "Int", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
168 "IEEEFP", 3
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
169 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
170
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
171 SGILogDataFmt = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
172 "Float", 0,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
173 "Bits8", 3
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
174 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
175
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
176 SubFileType = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
177 "Default", 0,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
178 "ReducedImage", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
179 "Page", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
180 "Mask", 4
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
181 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
182
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
183 Thresholding = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
184 "BiLevel", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
185 "HalfTone", 2,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
186 "ErrorDiffuse", 3
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
187 );
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
188
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
189 YCbCrPositioning = struct (
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
190 "Centered", 1,
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
191 "Cosited", 2
e960e3a3b3f6 Tiff.m: added structs for tag value enums to the Tiff class.
magedrifaat <magedrifaat@gmail.com>
parents: 31158
diff changeset
192 );
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
193 endproperties
31092
a736190ce738 Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff changeset
194
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
195 properties (Access = private)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
196 tiff_handle;
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
197 closed=false;
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
198 endproperties
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
199
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
200 methods
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
201 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
202 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
203 % print_usage();
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
204 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
205 endif
31092
a736190ce738 Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff changeset
206
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
207 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
208 endfunction
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
209
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
210 function close (t)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
211 if (! t.closed)
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
212 __close_tiff__ (t.tiff_handle);
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
213 t.closed = true;
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
214 endif
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
215 endfunction
31092
a736190ce738 Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff changeset
216
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
217 function tag = getTag (t, tag_name)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
218 if (t.closed)
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
219 error ("Image file was closed");
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
220 endif
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
221 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
222 endfunction
31092
a736190ce738 Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff changeset
223
31140
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
224 function setTag (t, varargin)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
225 if (t.closed)
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
226 error ("Image file was closed");
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
227 endif
31140
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
228 __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
229 endfunction
31126
7851c5b9c950 Tiff: implemented writeEncodedStrip function for writing a strip to an image
magedrifaat <magedrifaat@gmail.com>
parents: 31124
diff changeset
230
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
231 function argout = read (t)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
232 if (t.closed)
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
233 error ("Image file was closed");
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
234 endif
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
235 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
236 endfunction
31092
a736190ce738 Added the Tiff classdef files to octave
magedrifaat <magedrifaat@gmail.com>
parents:
diff changeset
237
31157
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
238 function stripData = readEncodedStrip (t, stripNumber)
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
239 if (t.closed)
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
240 error ("Image file was closed");
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
241 endif
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
242 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
243 endfunction
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
244
31158
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
245 function tileData = readEncodedTile (t, tileNumber)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
246 if (t.closed)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
247 error ("Image file was closed");
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
248 endif
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
249 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
250 endfunction
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
251
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
252 function write (t, imageData)
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
253 if (t.closed)
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
254 error ("Image file was closed");
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
255 endif
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
256 __tiff_write__ (t.tiff_handle, imageData);
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
257 endfunction
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
258
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
259 function writeEncodedStrip (t, stripNumber, imageData)
31141
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
260 if (t.closed)
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
261 error ("Image file was closed");
af4519cbfcae Tiff.m: prevented calling methods after the image file is closed.
magedrifaat <magedrifaat@gmail.com>
parents: 31140
diff changeset
262 endif
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
263 __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
264 endfunction
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
265
31146
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
266 function writeEncodedTile (t, tileNumber, imageData)
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
267 if (t.closed)
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
268 error ("Image file was closed");
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
269 endif
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
270 __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
271 endfunction
50402b8dfb4a Tiff: added writeEncodedTile function for writing tiled images
magedrifaat <magedrifaat@gmail.com>
parents: 31145
diff changeset
272
31148
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
273 function tf = isTiled (t)
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
274 if (t.closed)
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
275 error ("Image file was closed");
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
276 endif
31150
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
277 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
278 endfunction
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
279
31149
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
280 function numStrips = numberOfStrips (t)
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
281 if (t.closed)
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
282 error ("Image file was closed");
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
283 endif
31150
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
284 numStrips = __tiff_number_of_strips__ (t.tiff_handle);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
285 endfunction
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
286
31151
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
287 function numTiles = numberOfTiles (t)
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
288 if (t.closed)
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
289 error ("Image file was closed");
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
290 endif
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
291 numTiles = __tiff_number_of_tiles__ (t.tiff_handle);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
292 endfunction
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
293
31150
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
294 function stripNumber = computeStrip (t, varargin)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
295 if (t.closed)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
296 error ("Image file was closed");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
297 endif
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
298 stripNumber = __tiff_compute_strip__ (t.tiff_handle, varargin{:});
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
299 endfunction
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
300
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
301 function tileNumber = computeTile (t, varargin)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
302 if (t.closed)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
303 error ("Image file was closed");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
304 endif
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
305 tileNumber = __tiff_compute_tile__ (t.tiff_handle, varargin{:});
31149
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
306 endfunction
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
307
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
308 % 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
309 endmethods
31151
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
310
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
311 methods (Static = true)
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
312 function versionString = getVersion()
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
313 versionString = __tiff_version__ ();
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
314 endfunction
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
315 endmethods
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
316 endclassdef
31124
e8d1cc309bc9 Tiff: added initial implementation of setTag function for scalar tags
magedrifaat <magedrifaat@gmail.com>
parents: 31116
diff changeset
317
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
318 %!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
319 %! filename = [tempname() ".tif"];
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
320 %! unwind_protect
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
321 %! fn (filename);
31132
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
322 %! unwind_protect_cleanup
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
323 %! unlink (filename);
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
324 %! end_unwind_protect
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
325 %!endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
326
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
327 %!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
328 %! img = Tiff (filename, "r");
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
329 %! data2 = img.read ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
330 %! assert (size (data2), ex_size);
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
331 %! 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
332 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
333 %!endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
334
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
335 ## 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
336 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
337 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
338 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
339 %! setTag (img, "ImageWidth", 2);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
340 %! val = getTag (img, "ImageWidth");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
341 %! assert (val, 2);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
342 %! assert (class (val), "double");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
343 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
344 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
345
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
346 ## 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
347 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
348 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
349 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
350 %! fail ("getTag (img, \"ImageWidt\")", "Tiff tag not found");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
351 %! fail ("getTag (img, 999999)", "Tiff tag not found");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
352 %! fail ("setTag (img, \"ImageWidt\", 2)", "Tiff tag not found");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
353 %! fail ("setTag (img, 999999, 2)", "Tiff tag not found");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
354 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
355 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
356
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
357 ## test setTag structure input
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
358 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
359 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
360 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
361 %! 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
362 %! assert (getTag (img, "ImageLength"), 2);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
363 %! assert (getTag (img, "ImageWidth"), 2);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
364 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
365 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
366
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
367 ## test failure setTag structure unknown tag
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
368 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
369 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
370 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
371 %! setTag (img, "ImageLength", 1);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
372 %! setTag (img, "ImageWidth", 1);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
373 %! fail ("setTag (img, struct (\"ImageLength\", 2, \"a\", 1, \"ImageWidth\", 2))",
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
374 %! "Tag a not found");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
375 %! assert (getTag (img, "ImageLength"), 2);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
376 %! assert (getTag (img, "ImageWidth"), 1);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
377 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
378 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
379
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
380 ## 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
381 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
382 %! fail ("Tiff (\"test.tif\", \"rh\")",
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
383 %! "Invalid mode for openning Tiff file: rh");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
384 %! fail ("Tiff ([tempname() \".tif\"], \"r\")", "Failed to open Tiff file");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
385
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
386 ## 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
387 %!testif HAVE_TIFF
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
388 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
389 %! 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
390 %! 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
391 %! "BitsPerSample", 8));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
392 %! 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
393 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
394 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
395 %! 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
396 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
397 %! 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
398
c66f7c227e50 Tiff.m: added a test function and some base-case tests.
magedrifaat <magedrifaat@gmail.com>
parents: 31131
diff changeset
399 ## 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
400 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
401 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
402 %! 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
403 %! 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
404 %! 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
405 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
406 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
407 %! 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
408
31134
fc0366e009dd Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31132
diff changeset
409 ## 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
410 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
411 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
412 %! 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
413 %! 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
414 %! "BitsPerSample", 8));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
415 %! 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
416 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
417 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
418 %! 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
419 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
420 %! 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
421
31137
233130c0b1f6 Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents: 31136
diff changeset
422 ## 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
423 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
424 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
425 %! 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
426 %! 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
427 %! "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
428 %! 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
429 %! 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
430 %! "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
431 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
432 %! 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
433 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
434 %! 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
435
fc0366e009dd Tiff.m: added tests for 8-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31132
diff changeset
436 ## 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
437 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
438 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
439 %! 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
440 %! 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
441 %! "BitsPerSample", 8));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
442 %! 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
443 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
444 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
445 %! 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
446 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
447 %! 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
448
31137
233130c0b1f6 Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents: 31136
diff changeset
449 ## 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
450 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
451 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
452 %! 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
453 %! 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
454 %! "BitsPerSample", 8));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
455 %! 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
456 %! 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
457 %! "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
458 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
459 %! 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
460 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
461 %! 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
462
31135
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
463 ## 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
464 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
465 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
466 %! 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
467 %! 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
468 %! "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
469 %! "PlanarConfiguration", 1,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
470 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
471 %! 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
472 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
473 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
474 %! 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
475 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
476 %! 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
477
31137
233130c0b1f6 Tiff writeEncodedStrip: changed strip dimension check behavior to mimic matlab
magedrifaat <magedrifaat@gmail.com>
parents: 31136
diff changeset
478 ## 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
479 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
480 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
481 %! 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
482 %! 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
483 %! "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
484 %! "PlanarConfiguration", 1,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
485 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
486 %! 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
487 %! 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
488 %! "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
489 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
490 %! 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
491 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
492 %! 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
493
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
494 ## 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
495 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
496 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
497 %! 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
498 %! 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
499 %! "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
500 %! "PlanarConfiguration", 2,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
501 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
502 %! 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
503 %! 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
504 %! 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
505 %! endfor
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
506 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
507 %! 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
508 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
509 %! 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
510
31147
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
511 ## test 1-bit BiLevel image
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
512 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
513 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
514 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
515 %! 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
516 %! 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
517 %! writeEncodedStrip (img, 1, data);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
518 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
519 %! 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
520 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
521 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
522
31135
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
523 ## 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
524 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
525 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
526 %! 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
527 %! 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
528 %! "BitsPerSample", 16));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
529 %! 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
530 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
531 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
532 %! 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
533 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
534 %! 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
535
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
536 ## 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
537 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
538 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
539 %! 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
540 %! 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
541 %! "BitsPerSample", 32));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
542 %! 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
543 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
544 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
545 %! 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
546 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
547 %! 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
548
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
549 ## 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
550 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
551 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
552 %! 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
553 %! 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
554 %! "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
555 %! "PlanarConfiguration", 1,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
556 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
557 %! 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
558 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
559 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
560 %! 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
561 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
562 %! 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
563
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
564 ## 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
565 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
566 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
567 %! 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
568 %! 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
569 %! "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
570 %! "PlanarConfiguration", 1,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
571 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
572 %! 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
573 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
574 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
575 %! 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
576 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
577 %! 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
578
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
579 ## test failure unsupported bit-depth
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
580 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
581 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
582 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
583 %! 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
584 %! "BitsPerSample", 24));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
585 %! 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
586 %! 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
587 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
588 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
589 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
590
31147
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
591 ## 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
592 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
593 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
594 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
595 %! 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
596 %! "SamplesPerPixel", 3));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
597 %! 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
598 %! fail ("writeEncodedStrip (img, 1, data)",
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
599 %! "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
600 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
601 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
602 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
603
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
604 ## test multi-strip BiLevel image
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
605 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
606 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
607 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
608 %! 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
609 %! "RowsPerStrip", 2));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
610 %! 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
611 %! for strip = 1:5
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
612 %! 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
613 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
614 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
615 %! 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
616 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
617 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
618
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
619 ## test multi-strip grayscale image
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
620 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
621 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
622 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
623 %! setTag (img, struct ("ImageLength", 20, "ImageWidth", 20,
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
624 %! "BitsPerSample", 16, "RowsPerStrip", 3));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
625 %! data = uint16 (reshape (1:400, [20, 20]));
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
626 %! for strip = 1:7
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
627 %! 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
628 %! endfor
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
629 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
630 %! verify_data (filename, data, [20, 20]);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
631 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
632 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
633
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
634 ## test multi-strip RGB image
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
635 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
636 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
637 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
638 %! 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
639 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
640 %! "RowsPerStrip", 2, "PlanarConfiguration", 1,
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
641 %! "PhotometricInterpretation", 2));
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
642 %! 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
643 %! for strip = 1:10
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
644 %! 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
645 %! endfor
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
646 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
647 %! 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
648 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
649 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
650
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
651 ## 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
652 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
653 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
654 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
655 %! 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
656 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
657 %! "RowsPerStrip", 3, "PlanarConfiguration", 2,
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
658 %! "PhotometricInterpretation", 2));
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
659 %! 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
660 %! strip = 1;
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
661 %! for sample = 1:3
31153
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
662 %! for row = 1:3:20
c66d6c7f025e Tiff: implemented write method for stripped images
magedrifaat <magedrifaat@gmail.com>
parents: 31151
diff changeset
663 %! 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
664 %! strip = strip + 1;
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
665 %! endfor
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
666 %! endfor
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
667 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
668 %! 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
669 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
670 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
671
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
672 ## test single-precision image
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
673 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
674 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
675 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
676 %! 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
677 %! "BitsPerSample", 32, "SampleFormat", 3));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
678 %! 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
679 %! writeEncodedStrip (img, 1, data);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
680 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
681 %! verify_data (filename, data, [20, 20]);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
682 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
683 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
684
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
685 ## test double-precision image
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
686 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
687 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
688 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
689 %! 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
690 %! "BitsPerSample", 64, "SampleFormat", 3));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
691 %! 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
692 %! writeEncodedStrip (img, 1, data);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
693 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
694 %! verify_data (filename, data, [20, 20]);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
695 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
696 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
697
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
698 ## 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
699 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
700 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
701 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
702 %! 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
703 %! "BitsPerSample", 16, "SampleFormat", 3));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
704 %! 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
705 %! fail ("writeEncodedStrip (img, 1, data)",
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
706 %! "Floating point images are only supported for bit depths of 32 and 64");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
707 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
708 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
709 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
710
31135
b7ffe64e0287 Tiff.m: added test for 16- and 32-bit grayscale and RGB images.
magedrifaat <magedrifaat@gmail.com>
parents: 31134
diff changeset
711 ## 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
712 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
713 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
714 %! 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
715 %! 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
716 %! "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
717 %! "PlanarConfiguration", 1,
5f70efad6e2c Tiff setTag: added support for setting multiple tags at once using structs
magedrifaat <magedrifaat@gmail.com>
parents: 31139
diff changeset
718 %! "PhotometricInterpretation", 2));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
719 %! 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
720 %! 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
721 %! img.close ();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
722 %! endfunction
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
723 %! file_wrapper (@test_fn);
31138
68762676dab1 Tiff writeEncodedStrip: prevent writing to a read-only file
magedrifaat <magedrifaat@gmail.com>
parents: 31137
diff changeset
724
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
725 ## 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
726 %!testif HAVE_TIFF
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
727 %! function test_fn (filename)
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
728 %! 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
729 %! 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
730 %! "BitsPerSample", 8));
31139
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
731 %! data = uint8 (1);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
732 %! writeEncodedStrip (img, 1, data);
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
733 %! img.close();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
734 %! img = Tiff (filename, "r");
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
735 %! fail ("writeEncodedStrip(img, 1, [1])", "Can't write data to a file opened in read-only mode");
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
736 %! img.close();
3431a15b2c75 Tiff.m: refactored tests to use functions to reduce code repetition.
magedrifaat <magedrifaat@gmail.com>
parents: 31138
diff changeset
737 %! endfunction
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
738 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
739
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
740 ## test failure unsupported sample format
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
741 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
742 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
743 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
744 %! 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
745 %! "BitsPerSample", 16, "SampleFormat", 5));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
746 %! 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
747 %! 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
748 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
749 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
750 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
751
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
752 ## test failure wrong strip number
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
753 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
754 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
755 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
756 %! 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
757 %! "BitsPerSample", 16, "RowsPerStrip", 5));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
758 %! 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
759 %! fail ("writeEncodedStrip (img, 5, strip_data)",
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
760 %! "Strip number out of range");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
761 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
762 %! endfunction
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
763 %! file_wrapper (@test_fn);
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
764
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
765 ## 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
766 %!testif HAVE_TIFF
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
767 %! function test_fn (filename)
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
768 %! img = Tiff (filename, "w");
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
769 %! 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
770 %! "BitsPerSample", 16, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
771 %! "TileWidth", 16));
31143
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
772 %! 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
773 %! fail ("writeEncodedStrip (img, 1, data)",
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
774 %! "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
775 %! img.close ();
a68f2dadafee Tiff.m: added all remaining tests for implemented features.
magedrifaat <magedrifaat@gmail.com>
parents: 31141
diff changeset
776 %! endfunction
31147
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
777 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
778
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
779 ## test tiled BiLevel image
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
780 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
781 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
782 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
783 %! 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
784 %! "TileLength", 16, "TileWidth", 16));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
785 %! 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
786 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
787 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
788 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
789 %! 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
790 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
791 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
792 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
793 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
794 %! 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
795 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
796 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
797
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
798 ## test tiled grayscale image
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
799 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
800 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
801 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
802 %! 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
803 %! "BitsPerSample", 16, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
804 %! "TileWidth", 16));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
805 %! 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
806 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
807 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
808 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
809 %! 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
810 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
811 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
812 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
813 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
814 %! 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
815 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
816 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
817
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
818 ## 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
819 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
820 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
821 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
822 %! 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
823 %! "BitsPerSample", 16, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
824 %! "TileWidth", 16));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
825 %! 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
826 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
827 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
828 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
829 %! 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
830 %! col:min(col+15, 20)));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
831 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
832 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
833 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
834 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
835 %! 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
836 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
837 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
838
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
839 ## test tiled RGB image
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
840 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
841 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
842 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
843 %! 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
844 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
845 %! "PlanarConfiguration", 1, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
846 %! "TileWidth", 16, "PhotometricInterpretation", 2));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
847 %! 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
848 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
849 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
850 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
851 %! 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
852 %! col:min(col+15,20), :));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
853 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
854 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
855 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
856 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
857 %! 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
858 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
859 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
860
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
861 ## 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
862 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
863 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
864 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
865 %! 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
866 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
867 %! "PlanarConfiguration", 2, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
868 %! "TileWidth", 16, "PhotometricInterpretation", 2));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
869 %! 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
870 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
871 %! for channel=1:3
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
872 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
873 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
874 %! 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
875 %! 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
876 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
877 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
878 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
879 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
880 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
881 %! 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
882 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
883 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
884
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
885 ## 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
886 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
887 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
888 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
889 %! 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
890 %! "BitsPerSample", 16));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
891 %! 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
892 %! fail ("writeEncodedTile (img, 1, data)",
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
893 %! "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
894 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
895 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
896 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
897
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
898 ## 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
899 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
900 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
901 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
902 %! 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
903 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
904 %! "PlanarConfiguration", 1, "TileLength", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
905 %! "TileWidth", 16, "PhotometricInterpretation", 2));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
906 %! 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
907 %! tile = 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
908 %! for row = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
909 %! for col = 1:16:32
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
910 %! 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
911 %! 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
912 %! tile = tile + 1;
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
913 %! endfor
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
914 %! endfor
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: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
916 %! "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
917 %! 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
918 %! "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
919 %! 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
920 %! "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
921 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
922 %! 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
923 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
924 %! file_wrapper (@test_fn);
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
925
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
926 ## test failure wrong tile number
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
927 %!testif HAVE_TIFF
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
928 %! function test_fn (filename)
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
929 %! img = Tiff (filename, "w");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
930 %! 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
931 %! "BitsPerSample", 16, "TileWidth", 16,
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
932 %! "TileLength", 16));
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
933 %! 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
934 %! 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
935 %! "Tile number out of range");
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
936 %! img.close ();
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
937 %! endfunction
7af78a63d3c3 Tiff.m: added test for writing and reading tiled images.
magedrifaat <magedrifaat@gmail.com>
parents: 31146
diff changeset
938 %! 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
939
4bc9a1938f9a Tiff: added isTiled method to check if the image is tiled or stripped
magedrifaat <magedrifaat@gmail.com>
parents: 31147
diff changeset
940 ## 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
941 %!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
942 %! 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
943 %! 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
944 %! 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
945 %! 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
946 %! 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
947 %! 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
948 %! endfunction
31149
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
949 %! file_wrapper (@test_fn);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
950
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
951 ## test numberOfStrips returns the correct value
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
952 %!testif HAVE_TIFF
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
953 %! function test_fn (filename)
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
954 %! img = Tiff (filename, "w");
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
955 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10));
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
956 %! assert (numberOfStrips (img), 1);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
957 %! setTag (img, "RowsPerStrip", 2);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
958 %! assert (numberOfStrips (img), 5);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
959 %! setTag (img, "RowsPerStrip", 4);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
960 %! assert (numberOfStrips (img), 3);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
961 %! setTag (img, "TileLength", 16);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
962 %! setTag (img, "TileWidth", 16);
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
963 %! fail ("numberOfStrips (img)", "The image is tiled not stripped");
d4dbc69f301e Tiff: implemented numberOfStrips method
magedrifaat <magedrifaat@gmail.com>
parents: 31148
diff changeset
964 %! endfunction
31150
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
965 %! file_wrapper (@test_fn);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
966
31151
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
967 ## test numberOfTiles returns the correct value
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
968 %!testif HAVE_TIFF
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
969 %! function test_fn (filename)
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
970 %! img = Tiff (filename, "w");
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
971 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20,
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
972 %! "TileLength", 16, "TileWidth", 16));
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
973 %! assert (numberOfTiles (img), 4);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
974 %! setTag (img, "TileLength", 32);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
975 %! assert (numberOfTiles (img), 2);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
976 %! setTag (img, "TileWidth", 32);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
977 %! assert (numberOfTiles (img), 1);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
978 %! img = Tiff (filename, "w");
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
979 %! fail ("numberOfTiles (img)", "The image is stripped not tiled");
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
980 %! endfunction
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
981 %! file_wrapper (@test_fn);
6fb54834aa93 Tiff: added numberOfTiles and getVersion methods
magedrifaat <magedrifaat@gmail.com>
parents: 31150
diff changeset
982
31150
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
983 ## test computeStrip returns the correct value
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
984 %!testif HAVE_TIFF
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
985 %! function test_fn (filename)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
986 %! img = Tiff (filename, "w");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
987 %! setTag (img, struct ("ImageWidth", 10, "ImageLength", 10,
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
988 %! "RowsPerStrip", 2, "BitsPerSample", 8,
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
989 %! "SamplesPerPixel", 3, "PlanarConfiguration", 1));
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
990 %! assert (computeStrip (img, 1), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
991 %! assert (computeStrip (img, 2), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
992 %! assert (computeStrip (img, 0), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
993 %! assert (computeStrip (img, 10), 5);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
994 %! assert (computeStrip (img, 11), 5);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
995 %! setTag (img, "PlanarConfiguration", 2);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
996 %! ## 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
997 %! ## replaced by rewriteDirectory
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
998 %! writeEncodedStrip (img, 1, uint8 (reshape (1:20, [2, 10])));
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
999 %! assert (computeStrip (img, 1, 2), 6);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1000 %! assert (computeStrip (img, 100, 1), 5);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1001 %! img = Tiff ("test.tif", "w");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1002 %! setTag (img, "TileWidth", 16);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1003 %! setTag (img, "TileLength", 16);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1004 %! 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
1005 %! endfunction
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1006 %! file_wrapper (@test_fn);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1007
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1008 ## test computeTile returns the correct value
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1009 %!testif HAVE_TIFF
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1010 %! function test_fn (filename)
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1011 %! img = Tiff (filename, "w");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1012 %! setTag (img, struct ("ImageWidth", 20, "ImageLength", 20,
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1013 %! "BitsPerSample", 8, "SamplesPerPixel", 3,
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1014 %! "TileLength", 16, "TileWidth", 16,
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1015 %! "PlanarConfiguration", 1));
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1016 %! assert (computeTile (img, [1, 1]), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1017 %! assert (computeTile (img, [2, 2]), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1018 %! assert (computeTile (img, [0, 0]), 1);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1019 %! assert (computeTile (img, [8, 17]), 2);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1020 %! assert (computeTile (img, [19, 10]), 3);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1021 %! assert (computeTile (img, [17, 17]), 4);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1022 %! assert (computeTile (img, [100, 100]), 4);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1023 %! setTag (img, "PlanarConfiguration", 2);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1024 %! ## 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
1025 %! ## replaced by rewriteDirectory
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1026 %! writeEncodedTile (img, 1, uint8 (reshape (1:256, [16, 16])));
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1027 %! assert (computeTile (img, [1, 1], 2), 5);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1028 %! assert (computeTile (img, [100, 100], 1), 4);
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1029 %! img = Tiff ("test.tif", "w");
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1030 %! 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
1031 %! endfunction
6bede2d6f273 Tiff: added computeStrip and computeTile methods
magedrifaat <magedrifaat@gmail.com>
parents: 31149
diff changeset
1032 %! 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
1033
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1034 ## 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
1035 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1036 %! 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
1037 %! 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
1038 %! 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
1039 %! 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
1040 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1041 %! 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
1042 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1043 %! 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
1044
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1045 ## 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
1046 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1047 %! 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
1048 %! 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
1049 %! 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
1050 %! 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
1051 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1052 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1053 %! 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
1054 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1055 %! 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
1056
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1057 ## 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
1058 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1059 %! 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
1060 %! 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
1061 %! 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
1062 %! "RowsPerStrip", 3));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1063 %! 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
1064 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1065 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1066 %! 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
1067 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1068 %! 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
1069
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1070 ## 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
1071 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1072 %! 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
1073 %! 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
1074 %! 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
1075 %! "BitsPerSample", 8));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1076 %! 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
1077 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1078 %! 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
1079 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1080 %! 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
1081
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1082 ## 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
1083 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1084 %! 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
1085 %! 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
1086 %! 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
1087 %! "BitsPerSample", 8));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1088 %! 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
1089 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1090 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1091 %! 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
1092 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1093 %! 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
1094
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1095 ## 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
1096 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1097 %! 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
1098 %! 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
1099 %! 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
1100 %! "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
1101 %! 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
1102 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1103 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1104 %! 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
1105 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1106 %! 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
1107
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1108 ## 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
1109 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1110 %! 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
1111 %! 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
1112 %! 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
1113 %! "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
1114 %! "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
1115 %! "PhotometricInterpretation", 2));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1116 %! 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
1117 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1118 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1119 %! 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
1120 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1121 %! 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
1122
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1123 ## 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
1124 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1125 %! 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
1126 %! 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
1127 %! 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
1128 %! "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
1129 %! "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
1130 %! "PhotometricInterpretation", 2));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1131 %! 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
1132 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1133 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1134 %! 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
1135 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1136 %! 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
1137
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1138 ## 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
1139 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1140 %! 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
1141 %! 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
1142 %! 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
1143 %! "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
1144 %! "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
1145 %! "PhotometricInterpretation", 2));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1146 %! 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
1147 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1148 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1149 %! 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
1150 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1151 %! 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
1152
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1153 ## 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
1154 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1155 %! 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
1156 %! 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
1157 %! 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
1158 %! "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
1159 %! "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
1160 %! "PhotometricInterpretation", 2));
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1161 %! 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
1162 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1163 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1164 %! 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
1165 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1166 %! 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
1167
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1168 ## 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
1169 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1170 %! 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
1171 %! 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
1172 %! 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
1173 %! "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
1174 %! "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
1175 %! "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
1176 %! 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
1177 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1178 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1179 %! 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
1180 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1181 %! 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
1182
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1183 ## 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
1184 %!testif HAVE_TIFF
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1185 %! 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
1186 %! 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
1187 %! 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
1188 %! "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
1189 %! "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
1190 %! "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
1191 %! 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
1192 %! write (img, data);
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1193 %! img.close();
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1194 %! 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
1195 %! endfunction
828b7cc9aa36 Tiff write: added support for BiLevel stripped images and added unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31153
diff changeset
1196 %! 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
1197
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1198 ## 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
1199 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1200 %! 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
1201 %! 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
1202 %! 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
1203 %! "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
1204 %! 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
1205 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1206 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1207 %! 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
1208 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1209 %! 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
1210
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1211 ## 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
1212 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1213 %! 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
1214 %! 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
1215 %! 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
1216 %! "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
1217 %! "BitsPerSample", 16));
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1218 %! 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
1219 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1220 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1221 %! 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
1222 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1223 %! 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
1224
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1225 ## 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
1226 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1227 %! 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
1228 %! 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
1229 %! 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
1230 %! "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
1231 %! "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
1232 %! "PhotometricInterpretation", 2,
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1233 %! "PlanarConfiguration", 1));
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1234 %! 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
1235 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1236 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1237 %! 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
1238 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1239 %! 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
1240
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1241 ## 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
1242 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1243 %! 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
1244 %! 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
1245 %! 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
1246 %! "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
1247 %! "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
1248 %! "PhotometricInterpretation", 2,
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1249 %! "PlanarConfiguration", 2));
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1250 %! 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
1251 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1252 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1253 %! 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
1254 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1255 %! 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
1256
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1257 ## 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
1258 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1259 %! 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
1260 %! 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
1261 %! 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
1262 %! "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
1263 %! "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
1264 %! "PhotometricInterpretation", 2,
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1265 %! "PlanarConfiguration", 1));
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1266 %! 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
1267 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1268 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1269 %! 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
1270 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1271 %! 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
1272
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1273 ## 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
1274 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1275 %! 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
1276 %! 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
1277 %! 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
1278 %! "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
1279 %! "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
1280 %! "PhotometricInterpretation", 2,
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1281 %! "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
1282 %! 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
1283 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1284 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1285 %! 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
1286 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1287 %! 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
1288
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1289 ## 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
1290 %!testif HAVE_TIFF
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1291 %! 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
1292 %! 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
1293 %! 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
1294 %! "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
1295 %! "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
1296 %! "PhotometricInterpretation", 2,
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1297 %! "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
1298 %! 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
1299 %! write (img, data);
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1300 %! img.close();
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1301 %! 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
1302 %! endfunction
1e633a093faa Tiff write: added support for logical tile images and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31154
diff changeset
1303 %! file_wrapper (@test_fn);
31157
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1304
31158
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1305 ## test readEncodedStrip BiLevel image
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1306 %!testif HAVE_TIFF
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1307 %! function test_fn (filename)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1308 %! img = Tiff (filename, "w");
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1309 %! 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
1310 %! "RowsPerStrip", 6));
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1311 %! 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
1312 %! write (img, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1313 %! s1 = readEncodedStrip (img, 1);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1314 %! s2 = readEncodedStrip (img, 2);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1315 %! assert ([s1;s2], data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1316 %! img.close();
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1317 %! endfunction
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1318 %! file_wrapper (@test_fn);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1319
31157
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1320 ## test readEncodedStrip RGB Chunky
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1321 %!testif HAVE_TIFF
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1322 %! function test_fn (filename)
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1323 %! img = Tiff (filename, "w");
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1324 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1325 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1326 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1327 %! "PlanarConfiguration", 1));
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1328 %! 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
1329 %! write (img, data);
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1330 %! s1 = readEncodedStrip (img, 1);
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1331 %! s2 = readEncodedStrip (img, 2);
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1332 %! assert ([s1;s2], data);
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1333 %! img.close();
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1334 %! endfunction
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1335 %! file_wrapper (@test_fn);
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1336
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1337 ## test readEncodedStrip RGB Separated
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1338 %!testif HAVE_TIFF
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1339 %! function test_fn (filename)
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1340 %! img = Tiff (filename, "w");
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1341 %! setTag(img, struct ("ImageLength", 10, "ImageWidth", 10,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1342 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1343 %! "PhotometricInterpretation", 2, "RowsPerStrip", 6,
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1344 %! "PlanarConfiguration", 2));
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1345 %! 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
1346 %! write (img, data);
31158
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1347 %! s = cell (6, 1);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1348 %! for i=1:6
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1349 %! s{i} = readEncodedStrip (img, i);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1350 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1351 %! 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
1352 %! assert (data2, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1353 %! img.close();
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1354 %! endfunction
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1355 %! file_wrapper (@test_fn);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1356
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1357 ## test readEncodedTile BiLevel image
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1358 %!testif HAVE_TIFF
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1359 %! function test_fn (filename)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1360 %! img = Tiff (filename, "w");
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1361 %! 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
1362 %! "TileWidth", 16, "TileLength", 16));
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1363 %! 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
1364 %! write (img, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1365 %! t = cell (9, 1);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1366 %! for i=1:9
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1367 %! t{i} = readEncodedTile (img, i);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1368 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1369 %! 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
1370 %! 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
1371 %! assert (data2, data);
31157
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1372 %! img.close();
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1373 %! endfunction
dc3d2744916d Tiff: added readEncodedStrip method and corresponding unit tests
magedrifaat <magedrifaat@gmail.com>
parents: 31156
diff changeset
1374 %! file_wrapper (@test_fn);
31158
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1375
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1376 ## test readEncodedTile RGB Chunky
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1377 %!testif HAVE_TIFF
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1378 %! function test_fn (filename)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1379 %! img = Tiff (filename, "w");
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1380 %! 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
1381 %! "TileWidth", 16, "TileLength", 16,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1382 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1383 %! "PhotometricInterpretation", 2,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1384 %! "PlanarConfiguration", 1));
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1385 %! 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
1386 %! write (img, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1387 %! t = cell (9, 1);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1388 %! for i=1:9
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1389 %! t{i} = readEncodedTile (img, i);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1390 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1391 %! 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
1392 %! 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
1393 %! assert (data2, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1394 %! img.close();
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1395 %! endfunction
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1396 %! file_wrapper (@test_fn);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1397
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1398 ## test readEncodedTile RGB Separated
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1399 %!testif HAVE_TIFF
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1400 %! function test_fn (filename)
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1401 %! img = Tiff (filename, "w");
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1402 %! 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
1403 %! "TileWidth", 16, "TileLength", 16,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1404 %! "BitsPerSample", 16, "SamplesPerPixel", 3,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1405 %! "PhotometricInterpretation", 2,
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1406 %! "PlanarConfiguration", 2));
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1407 %! 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
1408 %! write (img, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1409 %! data2 = uint16 (zeros (40, 40, 3));
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1410 %! tile = 1;
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1411 %! for sample=1:3
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1412 %! for row=1:16:40
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1413 %! for col=1:16:40
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1414 %! 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
1415 %! = readEncodedTile(img, tile);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1416 %! tile += 1;
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1417 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1418 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1419 %! endfor
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1420 %! assert (data2, data);
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1421 %! img.close();
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1422 %! endfunction
f2ae7763739a Tiff: added writeEncodedTile method to read tiles from image
magedrifaat <magedrifaat@gmail.com>
parents: 31157
diff changeset
1423 %! file_wrapper (@test_fn);