(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 183459, 5360]*) (*NotebookOutlinePosition[ 184513, 5396]*) (* CellTagsIndexPosition[ 184469, 5392]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData["ReadTIFFpackage"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Currently this defines an almost-baseline \nTIFF Class G image file reader"], "Subtitle", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["by Simon Chandler"], "Subsubtitle", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["4/4/95"], "Subsubtitle", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["version 1.2"], "Subsubtitle", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["From the Author"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "If you have any comments about this package I'd like to hear them. For \ example, has the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " function failed to read one of your grayscale TIFF files? If you could \ send me details of the failure (e.g., any warning messages, the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " version number etc.) together with the image file then I'll try to fix \ it. I'd also like to hear from you if you can tell me how to improve the \ code - I'm not a programmer and know bits of it are klutzy.\n\nYou can \ contact me by e-mail at :\n\n simonc@bri.hp.com\n\nby post at :\n\n Dr \ Simon Chandler\n Hewlett-Packard Ltd (CPB)\n Filton Road\n Stoke \ Gifford\n Bristol\n BS12 6QZ\n\nor by phone :\n\n +44 (272) 228109\n\nI \ look forward to hearing from you.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Abstract"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["This package defines a function, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", that can read a grayscale image stored in the TIFF file format and \ return a 2-D matrix (i.e., a List of Lists) representing the image's bitmap. \ By using a MathLink routine to read the binary files a large image file \ (>100K) can be read-in in under 10 seconds.\n\nThe ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " function can currently (v1.x) handle only bilevel (TIFF Class B) and \ grayscale (TIFF Class G) images that are saved to the file WITHOUT INTERNAL \ DATA COMPRESSION. With this exception, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " satisfies the requirements of a format compliant 'baseline' TIFF Class G \ file reader, and has been tested on files created by the many applications \ [e.g., xv (on Unix), MacCubeView (on Mac), DigitalDarkroom (Mac), NIH-Image \ (Mac), XlateGraf (Mac), SuperConvert (Mac), Imagery (Mac), Optimas (PC)]. ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " may also, in many cases, successfully read files that violate the TIFF \ standard in some way.\n\nSeveral variables containing useful information \ about the image (e.g., its height and width) and the file's structure are set \ when the file is read-in, and these may be examined by setting the functions \ options.\n\nFor detailed information, see the extensive documentation at the \ start of my notebook, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage.m", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[". This includes a summary of the TIFF file format.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["ReadTIFFpackage`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" needs access to the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package written by Todd Gayley at Wolfram Research (tgayley@wri.com). \ Documentation at the start of the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage.m", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" notebook describes how to obtain ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and install it for use by the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["`.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["After writing ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " I found out that Jeffrey Adams (jeff@tiag.com) is about to release to the \ MathSource a more complete TIFF file reader ", Evaluatable->False, AspectRatioFixed->True], StyleBox["and writer", Evaluatable->False, AspectRatioFixed->True, FontVariations->{"Underline"->True}], StyleBox[ ". This should be able to handle 1, 2, 4, 8, 24 and 32 bit GrayLevel, \ RGBColor and CMYKColor TIFF files. His package is called ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Graphics`Tiff`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and the functions are ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["WriteTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". I've decided to go ahead and release my package, since his uses \ MathLink with NEXTSTEP specific code, so until his code is ported to other \ platforms my ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " may prove useful to some users. To avoid any confusion between his ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" function and mine (which ", Evaluatable->False, AspectRatioFixed->True], StyleBox["was", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[" called ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[") I've changed the name of my function to ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". This also highlights the fact that it is only designed to work on \ grayscale (Class G) images.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["History"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Name : ReadTIFFpackage.m\nAuthor : Dr Simon Chandler\nInstitution : \ Hewlett-Packard Ltd (CPB), Bristol, UK\n\nFirst released : 13/6/94, version \ 1.0\n\nModifications : 7/7/94, version 1.1\nChanges : Found out that Jeffrey \ Adams (jeff@tiag.com) is about to release to MathSource a more complete TIFF \ file reader and writer. This should be able to handle 1, 2, 4, 8, 24 and 32 \ bit GrayLevel, RGBColor and CMYKColor TIFF files. His package is called ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Graphics`Tiff`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and the functions are ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["WriteTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". I've decided to still release my package, since his uses MathLink with \ NEXTSTEP specific code. Until his code is ported to other platforms my ", Evaluatable->False, AspectRatioFixed->True], StyleBox["readTIFFpackage`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " may prove useful to some users. I will 'advertise' the fact that Jeff's \ package should soon be released. To avoid any confusion between his ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" function and mine (which was called ", Evaluatable->False, AspectRatioFixed->True], StyleBox["readTIFF", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[") I've changed the name of my function to ", Evaluatable->False, AspectRatioFixed->True], StyleBox["readTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". This also highlights the fact that it is only designed to work on \ grayscale (Class G) images. There have also been a few minor documentation \ changes.\n\nModifications : 4/4/95, version 1.2\nChanges : Changed function \ name from ", Evaluatable->False, AspectRatioFixed->True], StyleBox["readTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" to ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " at advise of Wolfram Research. Added legal notices. Added more \ documentation on how to load ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".\n\n\nNotes on current problems : None known", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Legal Notice"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "This Mathematica package is experimental and the author and copyright owner \ shall have no obligation to maintain or support it. The author and copyright \ owner makes no express or implied warranty of any kind with respect to this \ software, and shall not be liable for any direct, indirect, special, \ incidental or consequential damages (whether based on contract, tort or any \ other legal theory) arising in any way from use of the software.\n\nEveryone \ is granted permission to copy, modify and redistribute this Mathematica \ package, provided:\n\n 1. All modified copies shall carry a prominant notice \ stating who made the last \n modification and the date of such \ modification.\n\n 2. No charge is made for this software or works derived \ from it. This clause shall not be \n construed as constraining other \ software distributed on the same medium as this \n software, nor is a \ distribution fee considered a charge.\n\n Author: Simon Chandler, \ simonc@bri.hp.com\n Date: 11/7/94\n Copyright Holder: \ Hewlett-Packard"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Thanks to Prem Chawla (prem@wri.com) and Susan Zukosky (susanz@wri.com) for \ helping me with this legal stuff."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Background on the TIFF Image File Format"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "This section presents notes taken from Aldus/Microsoft Technical Memoranda \ \"TIFF 5.0\" (dated 8/8/88) and \"TIFF Revision 6.0\" (dated June 1992).\n\n\ Full documentation about the TIFF format specification is available by \ anonymous FTP from ", Evaluatable->False, AspectRatioFixed->True], StyleBox["zippy.nimh.nih.gov", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" in ", Evaluatable->False, AspectRatioFixed->True], StyleBox["/pub/image/documents/", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " or from\n\n\t Aldus Developers Desk\n\t Aldus Corporation\n\t 411 \ First Avenue South\n\t Suite 200\n\t Seattle, WA 98104\n\t (206) \ 622-5500\n\nThis summary was compiled by Simon Chandler, 10/6/94. Apologies \ to Aldus and Microsoft for my severe editing.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Abstract"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "This documentation begins with an overview of TIFF; a 'tag' based file \ format for digital image data. The TIFF Class G restricted sub-format is then \ introduced, with a detailed description of its required fields. Requirements \ for all 'baseline' TIFF readers are then outlined. Finally, limitations of \ the (slightly sub-baseline) TIFF Class G reading routine for Mathematica, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", will be described.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Tag Structure Rationale"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "A file format is defined by both form (structure) and content. It is the \ content that we are ultimately interested in - the structure merely tells us \ how to find it - yet the structure deserves serious consideration for a \ number of reasons. Since the structure used by TIFF departs significantly \ from several other approaches, it may be useful to discuss the rationale \ behind it.\n\nThe simplest, most straightforward structure for something like \ an image file is a positional format. In a positional scheme, the location of \ the data defines what the data means. For example, the field for 'number of \ rows' might begin at byte offset 30 in the image file.\n\nThis approach is \ simple and easy to implement and is perfect for static environments. But if a \ significant amount of ongoing change must be accommodated, subtle problems \ begin to appear. For example, suppose that a field must be superseded by a \ new, more general field. You could bump a version number to flag the change. \ Then new software has no problem doing something sensible with old data, and \ all old software will reject the new data, even software that didn't care \ about the old field. This may seem like no more than a minor annoyance at \ first glance, but causing old software to break more often than it would \ really need to can be very costly and, inevitably, causes much gnashing of \ teeth among customers.\n\nFurthermore, it can be avoided. One approach is to \ store a 'valid' flag bit for each field. Now you don't have to bump the \ version number, as long as you can put the new field somewhere that doesn't \ disturb any of the old fields. Old software that didn't care about that old \ field anyway can continue to function. (Old software that did care will of \ course have to give up, but this is an unavoidable price to be paid for the \ sake of progress, barring total omniscience.)\n\nAnother problem that crops \ up frequently is that certain fields are likely to make sense only if other \ fields have certain values. This is not such a serious problem in practice; \ it just makes things more confusing. Nevertheless, we note that the 'valid' \ flag bits described in the previous paragraph can help to clarify the \ situation.\n\nField-dumping programs can be very helpful for diagnostic \ purposes (see, for example, the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["report", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" option to the Mathematica ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " function). A desirable characteristic of such a program is that it \ doesn't have to know much about what it is dumping. In particular, it would \ be nice if the program could dump ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ASCII", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" data in ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ASCII", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " format, integer data in integer format, and so on, without having to \ teach the program about new fields all the time. So maybe we should add a \ 'data type' component to our fields, plus information on how long the field \ is, so that our dump program can walk through the fields without knowing what \ the fields mean.\n\nBut note that if we add one more component to each field, \ namely a tag that tells what the field means, we can dispense with the \ 'valid' flag bits, and we can also avoid wasting space on the non-valid \ fields in the file. Simple image creation applications can write out several \ fields and be done.\n\nWe have now derived the essentials of a tag-based \ image file format. ", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["The TIFF Structure"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "TIFF is a very rich format designed for the exchange of image data between \ many types of application (e.g., scanners, digitizers, painting programs). In \ TIFF, individual fields are identified with a unique tag. This allows \ particular fields to be present or absent from the file as required by the \ application.\n \nA TIFF file begins with an 8-byte", Evaluatable->False, AspectRatioFixed->True], StyleBox[" image file header ", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox["that points to one or more ", Evaluatable->False, AspectRatioFixed->True], StyleBox["image file directories", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " (IFDs). The image file directories contain information about the images, \ as well as pointers to the actual image data.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Image file header"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "A TIFF file begins with an 8-byte image file header, containing the \ following information:\n\nBytes 0-1: The first word of the file specifies \ the byte order used within the file. Legal values are:\n\n II (hex \ 4949)\n MM (hex 4D4D)\n\nIn the II format, byte order is always from \ least significant to most significant, for both 16-bit and 32-bit integers. \ In the MM format, byte order is always from most significant to least \ significant. In both formats, character strings are stored into sequential \ byte locations.\n\nBytes 2-3: The second word of the file is the TIFF \ 'version number'. The TIFF version number (42) has never changed, and \ probably never will (unless there are radical changes in the format). The \ number 42 was chosen for its deep philosophical significance. It can and \ should be used as additional verification that this is indeed a TIFF file. \n\ \nBytes 4-7: This long word contains the offset (in bytes) of the first \ Image File Directory, which may be at any location in the file after the \ header. In particular, an Image File Directory may follow the image data it \ describes. Readers must simply follow the pointers, wherever they may lead."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Image file directory"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "An Image File Directory (IFD) consists of a 2-byte count of the number of \ entries (i.e., the number of fields), followed by a sequence of 12-byte field \ entries, followed by a 4-byte offset of the next Image File Directory (or 0 \ if there are no further IFDs).\n\nEach 12-byte IFD entry has the following \ format:\n\nBytes 0-1: contain the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Tag", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" for the field.\nBytes 2-3: contain the field ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Type", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".\nBytes 4-7: contain the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Length", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" of the field. (Comment: '", Evaluatable->False, AspectRatioFixed->True], StyleBox["Count", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["' or '", Evaluatable->False, AspectRatioFixed->True], StyleBox["ValueCount", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "' may have been \n better terms, and the latter has \ been used in the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" program's code.) \nBytes 8-11: contain the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ValueOffset", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", the file offset (in bytes from start of file) of the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Value", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " for \n the field. This file offset may point to \ anywhere in the file, including after the image\n data.\n\ \nIn order to save time and space, the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ValueOffset", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is interpreted to contain the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Value", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" instead of just pointing to it if the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Value", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" fits into 4 bytes. If the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Value", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is less than 4 bytes, it is left-justified within the 4-byte ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ValueOffset", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[". Whether or not the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Value", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" fits within 4 bytes is determined by looking at the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Type", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Length", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" of the field.\n\nThe ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Length", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is specified in terms of the data type, not the total number of bytes. A \ single 16-bit word (", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[") has a ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Length", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " of 1, not 2, for example. The data types and their lengths are:\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["1 = BYTE ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["An 8-bit unsigned integer.", Evaluatable->False, AspectRatioFixed->True], StyleBox["\n2 = ASCII ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["8-bit bytes that store ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ASCII", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" codes; the last byte must be null.", Evaluatable->False, AspectRatioFixed->True], StyleBox["\n3 = SHORT ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["A 16-bit (2-byte) unsigned integer.", Evaluatable->False, AspectRatioFixed->True], StyleBox["\n4 = LONG ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["A 32-bit (4-byte) unsigned integer.", Evaluatable->False, AspectRatioFixed->True], StyleBox["\n5 = RATIONAL ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["Two ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "'s: the first represents the numerator of a fraction, the second the", Evaluatable->False, AspectRatioFixed->True], StyleBox[" \n ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["denominator.\n\nThe value of the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Length", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" part of an ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ASCII", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " field entry includes the null.\n\nTIFF currently allows more than one \ valid type for some fields. For example, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageWidth", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" can have the types ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ".\n\nNote that there may be more than one IFD. Each IFD is said to define \ a 'subfile'. One potential use of subsequent subfiles is to describe a \ 'sub-image' that is somehow related to the main image, such as a reduced \ resolution version of the image.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["TIFF Classes"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "TIFF was designed to be powerful and flexible at the expense of \ simplicity. It takes a fair amount of effort to handle all the options \ currently defined in the TIFF specification. ", Evaluatable->False, AspectRatioFixed->True], StyleBox["TIFF Classes", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " are restricted TIFF subsets that were introduced to simplify the job of \ the TIFF implementor.\n\nSo far, four TIFF Classes have been defined:\n\n \ Class B (TIFF B) for bilevel (1-bit) images\n Class G (TIFF G) for \ grayscale images\n Class P (TIFF P) for palette color images\n Class R \ (TIFF R) for RGB full color images\n\nThe term \"Class X\" refers to all \ classes.\n\nTIFF Classes have a defined subset of \"required fields\" that \ must be present in all files of that class. The following section describes \ the required fields for TIFF Class G. The documentation for each field \ contains the name of the field (quite arbitrary, but convenient), the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Tag", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" value, the field ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Type", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", the number of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Values", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (N) expected, and the default, if any. ", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["ImageWidth"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 256 (100) \nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "\nN = 1\n\nThe image's width, in pixels (X: horizontal). The number of \ columns in the image.\n\nNo default. See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageLength", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["ImageLength"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 257 (101)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "\nN = 1\n\nThe image's length (height) in pixels (Y: vertical). The number \ of rows (sometimes described as 'scan lines') in the image.\n\nNo default. \ See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageWidth", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["BitsPerSample"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 258 (102)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " (default = 1)\n\nNumber of bits per sample. Note that this tag allows a \ different number of bits per sample for each sample corresponding to a pixel. \ For TIFF Class G images ", Evaluatable->False, AspectRatioFixed->True], StyleBox["BitsPerSample", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" may be 4 or 8.\n\nNo default. See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" in the full TIFF specification.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Compression"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 259 (103)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = 1\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["Compression == 1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " when the data is not compressed. For Class G, bytes are stored as a \ simple array of type ", Evaluatable->False, AspectRatioFixed->True], StyleBox["BYTE", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". Rows are required to begin on byte boundaries. Therefore, the number of \ bytes per row is:\n \n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" (ImageWidth * BitsPerSample + 7) / 8 \n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" \nassuming integer arithmetic.\n \nWhen ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Compression", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is not equal to 1 a data compression scheme has been applied to the \ raster image data, as pointed to by ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripOffsets", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". All other TIFF information is unaffected. The several possible data \ compression schemes are discussed in the full TIFF specification.\n\nBaseline \ TIFF X readers ", Evaluatable->False, AspectRatioFixed->True], StyleBox["MUST", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[ " handle several possible compression schemes, and the TIFF specification \ recommends that compression is used.\n\nDefault = 1.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["PhotometricInterpretation"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 262 (106)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "\nN = 1\n\nvalue = 0 :\nFor bilevel and grayscale images: 0 is imaged as \ white, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["2**BitsPerSample-1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is imaged as black. If ", Evaluatable->False, AspectRatioFixed->True], StyleBox["GrayResponseCurve", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" exists (not required for baseline TIFF G), it overrides the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PhotometricInterpretation", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " value, although it is safer to make them match, since some applications \ (including ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[") may ignore ", Evaluatable->False, AspectRatioFixed->True], StyleBox["GrayResponseCurve", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ".\n\nvalue = 1 :\nFor bilevel and grayscale images: 0 is imaged as black, \ ", Evaluatable->False, AspectRatioFixed->True], StyleBox["2**BitsPerSample-1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is imaged as white. Above comments about ", Evaluatable->False, AspectRatioFixed->True], StyleBox["GrayResponseCurve", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " apply.\n\nValues of 2, 3 and 4 apply to RGB, palette colour and \ transparency mask images respectively so are not valid in TIFF class G image \ files.\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["PhotometricInterpretation", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" has no default value and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["is", Evaluatable->False, AspectRatioFixed->True, FontVariations->{"Underline"->True}], StyleBox[ " required, so should strictly be defined in each TIFF G file. Applications \ should not default to whatever they want ! ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PhotometricInterpretation = 1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is recommended for grayscale images.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["StripOffsets"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 273 (111)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" \nN = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration == 1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[". \nN = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel * StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration == 2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ".\n\nFor each strip, the byte offset of that strip. The offset is \ specified with respect to the beginning of the TIFF file. Note that this \ implies that each strip has a location independent of the locations of other \ strips. This feature may be useful for editing applications. This field is \ the only way for a reader to find the image data, and hence must exist.\n\n\ Note that either ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" values can be used to specify the strip offsets. ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " values may be used for small TIFF files. It should be noted, however, \ that earlier TIFF specifications required ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" strip offsets and that some software may not expect ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" values.\n\nNo default. See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripByteCounts", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (and in full TIFF specification, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["). The pseudo-variable ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is described in documentation for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["RowsPerStrip"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 278 (116)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "\nN = 1\n\nThe number of rows per strip. The image data is organized into \ strips for fast access to individual rows when the data is compressed; though \ this field is valid even if the data is not compressed.\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageLength", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " together give the number of strips in the entire image, from:\n \n", Evaluatable->False, AspectRatioFixed->True], StyleBox[ " StripsPerImage = (ImageLength + RowsPerStrip - 1) / RowsPerStrip\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" \nassuming integer arithmetic.\n\nNote that either ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" values can be used to specify ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[". ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " values may be used for small TIFF files. It should be noted, however, \ that earlier TIFF specification revisions required ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" values and that some software may not expect ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" values.\n\nDefault is ", Evaluatable->False, AspectRatioFixed->True], StyleBox["2**32 - 1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", which is effectively infinity. That is, the entire image is one strip. A \ single strip is not recommended, however. ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is usually chosen so that each strip is about 8K bytes, since it makes \ buffering simpler for readers.\n\nSee also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageLength", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripOffsets", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripByteCounts", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["StripByteCounts"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 279 (117)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration == 1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[". \nN = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel * StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration == 2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ".\n\nFor each strip, the number of bytes in that strip. Many existing TIFF \ images do not contain ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripByteCounts", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", because, in a strict sense, they are unnecessary. However, the existence \ of this field greatly simplifies the chore of buffering compressed data, if \ the strip size is reasonable. For this reason, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripByteCounts", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is required in all TIFF X files.\n\nNo default. See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripOffsets", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (and in full TIFF specification, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SamplesPerPixel", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["PlanarConfiguration", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["). The pseudo-variable ", Evaluatable->False, AspectRatioFixed->True], StyleBox["StripsPerImage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is described in documentation for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RowsPerStrip", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["XResolution"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 282 (11A)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RATIONAL", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = 1\n\nThe number of pixels per ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" in the X direction, i.e., in the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageWidth", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " direction. It is, of course, not mandatory that the image be actually \ printed at the size implied by this parameter. It is up to the application to \ use this information as it wishes. Note that the X and Y resolutions may be \ unequal. A TIFF reader must be able to handle this case. In many cases ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is set to zero when the image size is uncalibrated.\n\nNo default. See \ also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["YResolution"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 283 (11B)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RATIONAL", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = 1\n\nThe number of pixels per ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" in the Y direction, i.e., in the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageLength", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " direction. Note that the X and Y resolutions may be unequal. A TIFF \ reader must be able to handle this case. In many cases ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is set to zero when the image size is uncalibrated. \n\nNo default. See \ also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["ResolutionUnit"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Tag = 296 (128)\nType = ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nN = 1\n\nTo be used with ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ".\n\nvalue = 1 :\nNo absolute unit of measurement. Used for images that \ may have a non-square aspect ratio, but no meaningful absolute dimensions. \ The drawback of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit=1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " is that different applications will import the image at different sizes. \ Even if the decision is quite arbitrary, it might be better to use dots per \ inch or dots per centimeter, and pick ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " such that the aspect ratio is correct and the maximum dimension of the \ image is about four inches (the 'four' is quite arbitrary). In many cases ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " are set to zero when the image size is uncalibrated. \n\nvalue = 2 : \ Inch. \n\nvalue = 3 : Centimeter.\n\nTIFF readers must be prepared to handle \ all three values for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ResolutionUnit", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".\n\nDefault is 2. See also ", Evaluatable->False, AspectRatioFixed->True], StyleBox["XResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["YResolution", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Baseline TIFF Readers"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "The following are required characteristics of all 'baseline' TIFF Class X \ file readers.\n\nOptions. Where there are options TIFF Class X readers must \ be able to handle all of them.\n\nDefaults. TIFF X writers may, but are not \ required, to write out a field that has a default value, if the default value \ is the one desired. TIFF X readers must be prepared to handle either \ situation, with the default value used if the field does not exist.\n\n\ Non-required and unknown fields. TIFF X readers must be prepared to encounter \ and ignore non-required fields and private fields not described in the TIFF \ specification. TIFF X writers are allowed to write fields such as ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Make", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Model", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["DateTime", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", and so on, and TIFF X readers can certainly make use of such fields if \ they exist. TIFF X readers must not, however, refuse to read the file if such \ optional fields do not exist.\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["MM", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["II", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " byte order. TIFF X readers must be able to handle both byte orders. \n\n\ Multiple subfiles. TIFF X readers must be prepared for multiple images (i.e., \ subfiles) per TIFF file, although they are not required to do anything with \ any image after the first one.\n\nValue Type. TIFF readers should check the \ type to ensure that it is valid for the tag. TIFF currently allows more than \ one valid type for some fields. For example, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageWidth", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ImageLength", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" can have types ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" or ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". A baseline TIFF reader must be prepared to encounter and skip over \ (gracefully) unexpected field types, such as floating-point data. It must not \ expect ", Evaluatable->False, AspectRatioFixed->True], StyleBox["BYTE", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ASCII", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["SHORT", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["LONG", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["RATIONAL", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" to be a complete list of field types.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData[ "Info on the ReadTIFFpackage` and the ReadTIFFg Function"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[{ StyleBox["Limitations of the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" Mathematica Function", Evaluatable->False, AspectRatioFixed->True] }], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["In all respects other than the following the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " function works as a \"law abiding\" baseline TIFF Class G reader:\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " cannot handle compressed TIFF files. This was done on purpose because I \ needed to speed up the writing of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", and because I think the need for decompression can be avoided; I think \ most users of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFg", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" can be forewarned not to compress their images.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[{ StyleBox["How to use the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9] }], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["First, put the file ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " somewhere that your Mathematica Kernel can access it, i.e., somewhere \ that is included in the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["$Path", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " variable. You will then (after a few more steps - see below) be able to \ load the package by simply typing\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" Needs[\"ReadTIFFpackage`\"]\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nAlternatively, you can put the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" somewhere that is not explicitly on the Mathematica ", Evaluatable->False, AspectRatioFixed->True], StyleBox["$Path", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " but you must then use a more complete pathname when loading it. For \ example, if the following directory \n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" /users/coreResearch/math/PackagesExtension/\n\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["is in ", Evaluatable->False, AspectRatioFixed->True], StyleBox["$Path", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" and you create in it a new directory \n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" /users/coreResearch/math/PackagesExtension/graphics\n\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["into which you put the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", then you will have to load ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" using\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" Needs[\"graphics`ReadTIFFpackage`\"]\n\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["This will produce a warning message", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Needs::nocont: Warning:Context graphics`ReadTIFFpackage`\n was not \ created when Needs was evaluated."], "Message", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["because the context added to ", Evaluatable->False, AspectRatioFixed->True], StyleBox["$ContextPath", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" is simply ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (rather than the expected ", Evaluatable->False, AspectRatioFixed->True], StyleBox["graphics`ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["). This is nothing to worry about.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["ReadTIFFpackage", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" needs access to the ", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package written by Todd Gayley at Wolfram Research (tgayley@wri.com). \ For details on this package see \"The Mathematica Journal\", Vol. ", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["4", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[ ", No. 2, Spring 1994, pp.44-51. The package can be obtained from the \ MathSource archive, where the package is item number 0206-783. Get it from \ the mail server using this number, or by anonymous ftp (to \ mathsource.wri.com) from the /pub/NumberedItems/ directory.\n\nTo give your \ Mathematica kernel access to the ", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package you will need to either manually load it or make a small change \ to the ", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["ReadTIFFpackage.m", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" file in order to automatically load it.", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True] }], "Text", Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["To manually load FastBinaryFiles`"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Before loading the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" with\n\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[" Needs[\"ReadTIFFpackage`\"],\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nmanually install the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" package. This is done with the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Install", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " command, using an argument which is the full pathname to the MathLink \ binary executable file for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (if you don't know what this means see the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package documentation or the Mathematica Journal article mentioned \ above). The ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" will detect that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" has been loaded and should load successfully itself.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["To automatically load FastBinaryFiles`"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["In the section of this ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage.m", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" file entitled\n\n \"", Evaluatable->False, AspectRatioFixed->True], StyleBox[ "Implementation of the Package: \n set up the package context, including \ any imports, installs etc", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Chicago", FontSize->9], StyleBox[ "\"\n\n(which is only about one page on from here) change the variable ", Evaluatable->False, AspectRatioFixed->True], StyleBox["binaryFilename", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " to be the full pathname to where you keep the MathLink binary executable \ file for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" (again, if you don't know what this means see the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package documentation or the Mathematica Journal article mentioned \ above).\n\nOn my computer system the executable is \n\n ", Evaluatable->False, AspectRatioFixed->True], StyleBox[ "/users/coreResearch/math/PackagesExtension/fileRoutines/binaryFiles/\ binary", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ "\n \nso, by default, the code sets the variable to\n \n", Evaluatable->False, AspectRatioFixed->True], StyleBox[ "binaryFilename =\n\ \"/users/coreResearch/math/PackagesExtension/fileRoutines/binaryFiles/binary\"\ ;\n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["\nIf this correctly points to the executable then the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" will automatically load ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" if required.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[TextData[{ StyleBox["If either of these have been done then the ", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" will load successfully and the \n", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["ReadTIFFg", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" function will be available. For more help type ", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox["? ReadTIFFg", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " after loading the package. \nThe following lines give an example of \ importing the package, loading an image and plotting it.\n\n\t\t\t ", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True], StyleBox[ "Needs[\"ReadTIFFpackage`\"];\n\t\t\t\n\t\t\t\ SetDirectory[\"/users/simonc/experiments/imageProc/l#.tif/\"];\n\t\t\t\n\t\t\t\ myImage = \n\t\t\t ReadTIFFg[\n\t\t\t \"theImage.tif\",\n\t\t\t \ report -> True,\n\t\t\t ignoreNonBaseline->False\n\t\t\t ]\n\t\t\t\n\t\t\t\ ListDensityPlot[\n\t\t\t myImage,\n\t\t\t Mesh -> False\n\t\t\t];", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9] }], "Text", PageWidth->Infinity, Evaluatable->False, CellHorizontalScrolling->True, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Implementation of the Package"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "In early versions of this package (including v1.2) I will leave in \ numerous comments and commented-out pieces of code that proved useful during \ development and debug. The commented-out parts are shown in this ", Evaluatable->False, AspectRatioFixed->True], StyleBox["colour, which on my Mac is BLUE", Evaluatable->False, AspectRatioFixed->True, FontColor->RGBColor[0, 0, 1]], StyleBox[". The comments are in this ", Evaluatable->False, AspectRatioFixed->True], StyleBox["colour, which on my Mac is MAGENTA", Evaluatable->False, AspectRatioFixed->True, FontColor->RGBColor[1, 0, 1]], StyleBox[ ". I may take these out at some future date but I doubt it. Should I ?", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[ "set up the package context, including any imports, installs etc"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Because the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package is actally a MathLink program it can't be imported into this \ package in the usual way (see Programming in Mathematica by Roman Maeder \ sections 2.2.1 and 2.2.2). The following section checks to see if it is \ already imported, in which case it just starts the definition of the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". If it is not already known then we try to install the MathLink \ executable associated with the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package from a default location, specified by the following variable, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["binaryFilename", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "binaryFilename = \ \"/users/coreResearch/math/PackagesExtension/fileRoutines/binaryFiles/binary\"\ ;"], "Input", CellFrame->True, CellMargins->{{Inherited, 56}, {Inherited, Inherited}}, InitializationCell->True, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "If[\n Not[\n MemberQ[\n $ContextPath,\n \ \"FastBinaryFiles`\"\n ]\n ],\n If[\n FileType[binaryFilename] \ === File,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* it's there - so do it *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" link = Install[binaryFilename],\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* else, say its not and quit *)\n\t\t\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " Print[\"The ReadTIFFpackage` needs access to the FastBinaryFiles` \ package.\"];\n Print[\"Either manually 'Install[]' the relevant MathLink \ executable file\"];\n Print[\"before using \ Needs[\\\"ReadTIFFpackage`\\\"], or move the \"];\n Print[\"executable \ to the following location :\"];\n\t\t\t Print[\"\"];\n\t\t\t \ Print[binaryFilename];\n\t\t\t Print[\"\"];\n\t\t\t Print[\"If this file \ exists then the FastBinaryFiles` package will be\"];\n\t\t\t Print[\"loaded \ automatically by the ReadTIFFpackage. I've already looked\"];\n \ Print[\"there and the file doesn't exist; the ReadTIFFpackage can't load.\"];\ \n Print[\"For more information see documentation at the beginning of \ the file\"];\n Print[\"\\\"ReadTIFFpackage.m\\\"\"];\n \ Print[\"\\n\\nTerminating the loading of ReadTIFFpackage.m. Bye Bye\"];\n \ Abort[]\n ]\n];", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True], Cell[TextData["BeginPackage[ \"ReadTIFFpackage`\" ]"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[{ StyleBox["If we get to this point then the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles`", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ " package has loaded or was already loaded. We need to make this known to \ trhe Kernel inside the ", Evaluatable->False, AspectRatioFixed->True], StyleBox["BeginPackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[" definition of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ReadTIFFpackage", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[", so we need to add the packages name to the context path.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["PrependTo[$ContextPath,\"FastBinaryFiles`\"];"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "This is all a bit klutzy, since importing required packages is usually \ handled by ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Needs[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ". It is because I'm installing a MathLink program that I've had to do all \ this manually. I'll ask the author of ", Evaluatable->False, AspectRatioFixed->True], StyleBox["FastBinaryFiles", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox[ ", Todd Gayley, if he can think of a better way of importing it into other \ packages.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["usage messages"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[" for the context itself"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "ReadTIFFpackage::usage = \"This package defines a function, ReadTIFFg, that \ can import into Mathematica a grayscale image stored in the TIFF format. \ \\n\\nReadTIFFg[filename_String] reads-in the TIFF file and returns a 2-D \ matrix (i.e., a List of Lists) representing the image's bitmap. In addition, \ several variables containing useful information about the image (e.g., its \ height and width) are set when the file is read-in. These variables all start \ with \\\"tiff\\\"; see ? tiff*. \\n\\nThe ReadTIFFg function can currently \ (v1.x) handle only bilevel (TIFF Class B) and grayscale (TIFF Class G) images \ that are saved to the file WITHOUT INTERNAL DATA COMPRESSION. With this \ exception, ReadTIFFg satisfies the requirements of a format compliant \ 'baseline' TIFF Class G file reader, and has been successfully tested on \ files created by the following applications: xv (on Unix), MacCubeView (on \ Mac), DigitalDarkroom (Mac), NIH-Image (Mac), XlateGraf (Mac), SuperConvert \ (Mac), Imagery (Mac), Optimas (PC). \\n\\nFor detailed information, see the \ documentation given at the start of the \\\"ReadTIFFpackage`\\\" notebook. \ \\n\\nSee also ? ReadTIFFg, ? tiff*, ? tiffImageWidth, ? tiffImageLength, ? \ tiffBitsPerSample, ? tiffCompression, ? tiffPhotometricInterpretation, ? \ tiffStripOffsets, ? tiffRowsPerStrip, ? tiffStripByteCounts, ? \ tiffXResolution, ? tiffYResolution and ? tiffResolutionUnit\";"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[" for exported function(s)"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "ReadTIFFg::usage = \"ReadTIFFg[filename_String] reads a grayscale image \ stored in the TIFF file format, and returns the 2-D matrix (i.e., a List of \ Lists) representing the image's bitmap. For detailed information see ? \ ReadTIFFpackage\";"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["for exported variables/values"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "tiffImageWidth::usage = \"tiffImageWidth (an integer) is the image's \ horizontal width in pixels. Equivalently, it is the number of columns in the \ bitmap image. \\n\\nSee also ? tiffImageLength.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffImageLength::usage =\"tiffImageLength (an integer) is the image's length \ (height) in pixels. Equivalently, it is the number of rows (sometimes \ described as 'scan lines') in the bitmap image. \\n\\nSee also ? ImageWidth.\ \";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffBitsPerSample::usage = \"tiffBitsPerSample (an integer: 4 or 8) is the \ number of bits per sample. For TIFF Class G images BitsPerSample may be 4 or \ 8. \\n\\nSee also \\\"SamplesPerPixel\\\" in the full TIFF \ specification.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffCompression::usage = \"When tiffCompression equals 1 the image data is \ not compressed and the ReadTIFFg function will be able to import the image \ into Mathematica. When tiffCompression is not equal to 1 a data compression \ scheme has been applied (internally) to the image data and it cannot be \ read-in. Format compliant 'baseline' TIFF file readers are required to \ handle several possible compression schemes; however, the ReadTIFFg \ Mathematica function cannot currently do this (version 1.x, N.B., this is the \ only shortfall from being a fully compliant TIFF Class G reader). I'm hoping \ that most users of the ReadTIFFg package will be forewarned, so will be able \ to avoid using compressed images. If you do find lack of a decompression \ facility a big problem then contact the author (simonc@bri.hp.com) for \ advice. If you're running out of disk space you can always compress the image \ files externally (e.g., using Unix 'compress' command) then uncompress them \ (either manually or by calling the Unix command from within Mathematica) \ before using the ReadTIFFg function.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffPhotometricInterpretation::usage = \"tiffPhotometricInterpretation (an \ integer: 0-4) determines how a pixel's color is calculated from its value. \ For 8-bit grayscale images the color varies linearly from white to black - \ with 253 intermediate shades of gray. When tiffPhotometricInterpretation = 0 \ then a pixel with value 0 is imaged as white, whilst one with value \ (2**BitsPerSample-1) is imaged as black; this may be called \\\"white-is-zero \ format\\\". When tiffPhotometricInterpretation = 1 the system is reversed \ and pixels with value (2**BitsPerSample-1) are imaged as white whilst pixels \ with value 0 are imaged as black; this may be called \\\"black-is-zero format\ \\\".\\n\\nNote: the ReadTIFFg program does not handle the IFD field, \ \\\"GrayResponseCurve\\\" (see full TIFF specification).\\n\\nNote: \ tiffPhotometricInterpretation values of 2, 3 and 4 apply to non-grayscale \ images so are not valid in Class G files. I originally allowed the pixel \ values of colour images to be read-in, even though they were incorrectly \ interpreted. This caused a few programming problems and also seemed silly so, \ in the end, I decided to reject colour images completely. If you do need to \ load a colour image as grayscale there are several powerful image \ manipulation programs that can do this properly (e.g., xv on Unix).\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffStripOffsets::usage = \"tiffStripOffsets is a List of integer values \ that, for each strip, gives the byte offset of that strip from the beginning \ of the file; the Nth element in tiffStripOffsets is the offset of the Nth \ strip.\\n\\nSee also ? tiffStripByteCounts, ? tiffRowsPerStrip, ? \ tiffStripsPerImage (and, in the full TIFF specification, \ \\\"SamplesPerPixel\\\" and \\\"PlanarConfiguration\\\"). The \ pseudo-variable \\\"StripsPerImage\\\" is described in ? \ tiffRowsPerStrip.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffRowsPerStrip::usage = \"tiffRowsPerStrip (an integer) is the number of \ rows in each strip (other than the last, which may contain fewer rows). The \ image data is organized into strips for fast access to individual rows when \ the data is compressed; though this field is valid even if the data is not \ compressed. The image file's fields tiffRowsPerStrip and tiffImageLength \ together give the number of strips in the entire image, see ? \ tiffStripsPerImage. \\n\\nSee also ? tiffImageLength, ? tiffStripOffsets, ? \ tiffStripByteCounts.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffStripByteCounts::usage = \"tiffStripByteCounts is a List of integer \ values that gives the number of bytes in each strip; the Nth element in \ tiffStripByteCounts is the number of rows in the Nth strip. Many existing \ TIFF images do not contain this field because it is not strictly necessary; \ however, tiffStripByteCounts IS required in all TIFF G files. If the \ tiffStripByteCounts field is missing the image cannot be read by the \ Mathematica ReadTIFFg function.\\n\\nSee also ? tiffStripOffsets, ? \ tiffRowsPerStrip, ? tiffStripsPerImage (and, in the full TIFF specification, \ \\\"SamplesPerPixel\\\" and \\\"PlanarConfiguration\\\"). The \ pseudo-variable \\\"StripsPerImage\\\" is described in ? \ tiffRowsPerStrip.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffStripsPerImage::usage = \"tiffStripsPerImage is NOT an IFD field. It is \ merely a value that any TIFF reader must calculate in order to check the \ number of tiffStripOffsets and the number of tiffStripByteCounts.\\n\\n \ tiffStripsPerImage = \ Floor[(tiffImageLength+tiffRowsPerStrip-1)/tiffRowsPerStrip] \\n\\nSee also ? \ tiffImageLength, ? tiffRowsPerStrip, ? tiffStripOffsets, ? \ tiffStripByteCounts.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffXResolution::usage = \"tiffXResolution (an integer) is the number of \ pixels per tiffResolutionUnit in the X direction, i.e., in the tiffImageWidth \ direction. In many cases tiffXResolution is set to zero when the image size \ is uncalibrated.\\n\\nSee also ? tiffYResolution, ? tiffResolutionUnit.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffYResolution::usage = \"tiffYResolution (an integer) is the number of \ pixels per tiffResolutionUnit in the Y direction, i.e., in the \ tiffImageLength direction. In many cases tiffYResolution is set to zero when \ the image size is uncalibrated.\\n\\nSee also ? tiffXResolution, ? \ tiffResolutionUnit.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffResolutionUnit::usage = \"tiffResolutionUnit (an integer:1,2 or 3) is \ used with tiffXResolution and tiffYResolution. When tiffResolution = 1 there \ is no absolute unit of measurement; however, tiffXResolution and \ tiffYResolution may be different indicating that the image has a non-square \ aspect ratio but no meaningful absolute dimensions. In many cases \ tiffXResolution and tiffYResolution are set to zero when the image size is \ truely uncalibrated. When tiffResolution = 2 the resolution unit is an inch. \ When tiffResolution = 3 the resolution unit is a centimeter. \\n\\nSee also ? \ tiffXResolution, ? tiffYResolution.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffArtist::usage = \"tiffArtist is an optional ASCII string containing \ information about the person who created the image. Copyright information may \ also be written here. This field is often placed immediately after the 8-byte \ TIFF header.\\n\\nSee also tiffCopyright.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffCopyright::usage = \"tiffCopyright is an optional ASCII string \ containing copyright information about the image.\\n\\nSee also \ tiffArtist.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffHostComputer::usage = \"tiffHostComputer is an optional ASCII string \ containing information about the computer used to create the image \ file.\\n\\nSee also tiffMake, tiffModel, tiffSoftware.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffImageDescription::usage = \"tiffImageDescription is an optional ASCII \ string containing information about the image (e.g., \\\"1988\ncompany picnic\ \\\"). This is what the newspaper and magazine industry call a \ \\\"slug\\\".\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffMake::usage = \"tiffMake is an optional ASCII string containing \ information about the manufacturer of the scanner, video digitizer, or \ whatever.\\n\\nSee also tiffModel, tiffSoftware, tiffHostComputer.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffModel::usage = \"tiffModel is an optional ASCII string containing \ information about the the model name/number of the scanner, video digitizer, \ or whatever. This tag is intended for user information only.\\n\\nSee also \ tiffMake, tiffSoftware, tiffHostComputer.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffMaxSampleValue::usage = \"tiffMaxSampleValue (an integer) is the maximum \ used sample value in the image. For example, if the image consists of 6-bit \ data low-order-justified into 8-bit bytes, MaxSampleValue will be no greater \ than 63. This field is not to be used to affect the visual appearance of the \ image when displayed. Nor should the values of this field affect the \ interpretation of any other field. Use it for statistical purposes \ only.\\n\\nSee also tiffMinSampleValue.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffMinSampleValue::usage = \"tiffMinSampleValue (an integer) is the minimum \ used sample value in the image. This field is not to be used to affect the \ visual appearance of the image when displayed. Nor should the values of this \ field affect the interpretation of any other field. Use it for statistical \ purposes only.\\n\\nSee also tiffMaxSampleValue.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffNewSubfileType::usage = \"The value of tiffNewSubfileType (an integer) \ is a general indication of the kind of data that is contained in the subfile. \ This field is made up of a set of 32 flag bits. Unused bits are 0. Bit 0 is \ the low-order bit. Currently defined values are: \\n\\nBit 0 is 1 if the \ image is a reduced resolution version of another image in the TIFF file; else \ the bit is 0. \\n\\nBit 1 is 1 if the image is a single page of a multi-page \ image (see the \\\"PageNumber\\\" tag description in the full TIFF \ specification); else the bit is 0. \\n\\nBit 2 is 1 if the image defines a \ transparency mask for another image in this TIFF file. The \ tiffPhotometricInterpretation value must then be 4,\ndesignating a \ transparency mask.\\n\\ntiffNewSubfileType replaces the old \\\"SubfileType\\\ \" field (see full TIFF specification), due to limitations in the definition \ of that field.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffOrientation::usage = \"tiffOrientation is an integer (1-8) representing \ the orientation of the image. The standard/default orientation of a TIFF \ image is with the 0th row representing the visual top of the image, and the \ 0th column representing the visual left-hand side of the image. Other \ orientations are possible, and these are indicated by a non-zero value of \ tiffOrientation. This version of the Mathematica ReadTIFFpackage (v1.x) does \ not support non-default orientations, however, it should be easy enough to \ get Mathematica to rotate (etc) the List returned by the ReadTIFFg function, \ so converting it to the correct orientation. Possible image orientations are \ \\n\\ntiffOrientation = 1: The 0th row represents the visual top of the \ image, and the 0th column represents the visual left hand side. \ \\n\\ntiffOrientation = 2: The 0th row represents the visual top of the \ image, and the 0th column represents the visual right hand side. \ \\n\\ntiffOrientation = 3: The 0th row represents the visual bottom of the \ image, and the 0th column represents the visual right hand side. \ \\n\\ntiffOrientation = 4: The 0th row represents the visual bottom of the \ image, and the 0th column represents the visual left hand side. \ \\n\\ntiffOrientation = 5: The 0th row represents the visual left hand side \ of the image, and the 0th column represents the visual top. \ \\n\\ntiffOrientation = 6: The 0th row represents the visual right hand side \ of the image, and the 0th column represents the visual top. \ \\n\\ntiffOrientation = 7: The 0th row represents the visual right hand side \ of the image, and the 0th column represents the visual bottom. \ \\n\\ntiffOrientation = 8: The 0th row represents the visual left hand side \ of the image, and the 0th column represents the visual bottom.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffSoftware::usage = \"tiffSoftware is an optional ASCII string containing \ information about the name and release number of the software package that \ created the image. This tag is intended for user information only.\\n\\nSee \ also tiffMake, tiffModel, tiffHostComputer.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffDateTime::usage = \"tiffDateTime is an optional ASCII string containing \ information about the date and time of image creation. The format of this \ string is YYYY:MM:DD HH:MM:SS, with hours on a 24-hour clock, and one space \ character between the date and the time. The length of the string, including \ the null character at the end, is always 20 bytes.\\n\\nSee also \ tiffImageDescription.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffSamplesPerPixel::usage = \"tiffSamplesPerPixel (an integer) is the \ number of samples per pixel. SamplesPerPixel is 1 for bilevel, grayscale, and \ palette color images. SamplesPerPixel is 3 for RGB images. \\n\\nSee also \ tiffBitsPerSample, tiffPhotometricInterpretation.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffDocumentName::usage = \"tiffDocumentName is an optional ASCII string \ containing the name of the document from which the image was scanned. \ \\n\\nSee also tiffPageName.\";"], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "tiffPageName::usage = \"tiffPageName is an optional ASCII string containing \ the name of the page from which this image was scanned. \\n\\nSee also \ tiffDocumentName.\";\n"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["for options to exported functions"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "report::usage = \"This option is included as a 'field-dumping' utility to \ give technical users (e.g., the author of ReadTIFFg) a diagnostic tool with \ which to examine the guts of a TIFF file. Most users of ReadTIFFg will not be \ interested in this option, and some knowledge of the TIFF specification is \ required in order to understand its output. \\n\\nreport -> True, prints a \ description of entries (aka 'fields') in the Image File Directory (IFD), \ including their tag numbers and their values. Fields that are 'required' by \ Class G are always printed when report -> True. When ignoreNonBaseline -> \ False (in addition to report->True) a report will also be printed for other, \ non-required fields that are 'known' by the Mathematica code that defines the \ ReadTIFFg package. To make a field 'known', just fill in an entry for it in \ the List variable, nonbaselineTIFFparameters, found in the \\\"", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["definition of local (static) variables", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Times", FontSize->12], StyleBox[ "\\\" section of the \\\"ReadTIFFpackage.m\\\" notebook. 'Unknown' fields \ are not printed by the report option, however a Message[] is printed about \ them whenever ignoreNonBaseline -> False\\n\\nThe default value for the \ report option is False. See also ? ignoreNonBaseline, ? ReadTIFFg, ? \ ReadTIFFpackage.\";", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True], Cell[TextData[ "ignoreNonBaseline::usage = \"This option is included to allow technical \ users (e.g., the author of ReadTIFFg) to turn-on handling of non-required \ fields in a TIFF Class G file. Most users of ReadTIFFg will not be \ interested in this facility, and some knowledge of the TIFF specification is \ probably required in order to use it. \\n\\nignoreNonBaseline -> True, the \ default setting, causes all entries in the Image File Directory (IFD) that \ are not required for TIFF Class G images to be totally ignored. With \ ignoreNonBaseline -> False non-required fields are read and, if necessary and \ possible, are processed. Note: with ignoreBaseline -> True a warning will \ not be given if the IFD contains unknown fields. \\n\\nThe default value for \ the ignoreNonBaseline option is True. See also ? report, ? ReadTIFFg, ? \ ReadTIFFpackage.\";"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["declare options to exported functions"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Options[ReadTIFFg] = {report -> False, ignoreNonBaseline -> True};"], "Input",\ InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["begin the private context"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Begin[\"`Private`\"]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "unprotect any system functions for which rules will be defined"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["(* protected = Unprotect[ Sin, Cos ] *)\n", Evaluatable->False, AspectRatioFixed->True, FontColor->RGBColor[0, 0, 1]], StyleBox[ "(* use blue colour to show commented-out parts, and magenta to show \ comments *)", Evaluatable->False, AspectRatioFixed->True, FontColor->RGBColor[1, 0, 1]], StyleBox["", Evaluatable->False, AspectRatioFixed->True, FontColor->RGBColor[0, 0, 1]] }], "Special3", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["error messages for the exported objects"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "ReadTIFFg::formatErr = \"Format error type `1` occurred.\";\n\n\ ReadTIFFg::filenameErr = \"Sorry, the file \\\"`1`\\\" does not exist.\";\n\n\ ReadTIFFg::typeErr = \"Cannot load the file because the Type of a required \ baseline field is invalid.\\n\\nTerminating import process. Bye Bye.\";\n\n\ ReadTIFFg::valueErr = \"Because the value of the required baseline parameter \ is invalid, this file cannot be read-in. \\n\\nTerminating import process. \ Bye Bye.\";\n\nReadTIFFg::unknownTag = \"This TIFF file's IFD contains a \ field for an unknown tag (`1`) of type `2` There are `3` values with \ Value/Offset `4`. This field will be ignored, but the image will be \ read-in.\";\n\nReadTIFFg::compressedErr = \"A compression scheme was used on \ the image data in this TIFF file. Sadly, this version of the Mathematica \ ReadTIFFg package (v1.x) cannot handle compressed images. This is a serious \ shortfall and violates the minimum requirements for a true baseline TIFF \ reader; however, I'm hoping that most users of the ReadTIFFg package will be \ able to avoid using compressed images. If you do find lack of a decompression \ facility a big problem then contact Simon Chandler (simonc@bri.hp.com) for \ advice. \\n\\nTerminating import process. Bye Bye.\";\n\n\ ReadTIFFg::orientationErr = \"The standard/default orientation of a TIFF \ image is with 0th row representing the visual top of the image, and the 0th \ column representing the visual left-hand side of the image. This file's TIFF \ image has a different orientation (type `1`, see p.36 of the full TIFF \ specification document). This version of the Mathematica ReadTIFFpackage \ (v1.x) does not support non-default orientations, however, it should be easy \ enough to get Mathematica to rotate (etc) the List returned by this function, \ so convert it to the correct orientation. See ? tiffOrientation for \ explanation of the orientation types.\";\n\nReadTIFFg::stripErr = \"This file \ violates the TIFF format. The bitmap image should be broken into one or more \ 'strips' with a stated numer of bytes in each strip. The IFD shows there \ should be `3` strip(s) (see ? tiffStripsPerImage), however, the IFD also \ gives `1` strip file offset(s) (see ? tiffStripOffsets) and `2` byte count(s) \ (see ? tiffStripByteCounts), which is inconsistent. \\n\\nTerminating import \ process. Bye Bye.\";\n\nReadTIFFg::colourErr = \"This TIFF file contains \ `1`However, this version of the Mathematica ReadTIFFg package can only handle \ grayscale images (TIFF Class G reader). The image will not be \ read-in.\\n\\nNote: I originally intended the pixel values of colour images \ to be read-in, even though they would be incorrectly interpreted. This caused \ a few programming problems and also seemed silly so, in the end, I decided to \ reject colour images completely. If you do need to load a colour image as \ grayscale there are several powerful image manipulation programs that can do \ this properly (e.g., xv on Unix).\";\n\nReadTIFFg::badBitErr = \"This version \ of the Mathematica ReadTIFFg function (v1.x) can handle bilevel images (Class \ B), which have 1 bit per pixel, and TIFF grayscale images (Class G), with 4 \ or 8 bits per pixel. However, this file has `1` bit(s) per pixel so the file \ cannot be read-in. \\n\\nTerminating import process. Bye Bye.\";\n\n\ ReadTIFFg::unknownResolutionUnit = \"This TIFF file has a value for \ tiffResolutionUnit whose meaning is unknown. Known (valid) values are: \ \\n\\n1, for no absolute unit of measurement \\n\\n2, for resolution unit of \ inch \\n\\n3, for resolution unit of centimeter \\n\\nWill set \ tiffResolutionUnit to 1. See also ? tiffXResolution, ? tiffYResolution.\";\n\ \nReadTIFFg::StripByteCountsErr = \"This TIFF file's IFD did not contain a \ StripByteCounts field. This is strictly a format violation for TIFF Class X \ files; however, in simple cases the StripByteCounts parameter may be \ calculated from other field values. I will try to use the calculated value \ but may crash.\\n\\nWish me luck !\";"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["definition of local (static) variables"], "Subsection", PageWidth->Infinity, Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "typeCodes = {1->BYTE, 2->ASCII, 3->SHORT, 4->LONG, 5->RATIONAL};"], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True], Cell[TextData[{ StyleBox["The following 'table' lists the IFD tags that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["MUST", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[ " all be present in a baseline TIFF grayscale files (TIFF class G). The \ format is:\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[ " 1. The standard parameter name,\n 2. The tag number,\n 3. List \ of valid types,\n 4. List of valid values, ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9], StyleBox["(* note: these are no longer used in the code *)", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9, FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n 5. Default value which is used if entry not present in IFD\n - \ set to Null if no default ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "baselineTIFFparameters = \n{\n { tiffImageWidth, 256, \ {SHORT,LONG}, Null, Null },\n { tiffImageLength, 257, \ {SHORT,LONG}, Null, Null },\n { tiffBitsPerSample, 258, \ {SHORT}, {1,4,8}, 1 },\n { tiffCompression, 259, {SHORT}, {1", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[",32773", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 0]], StyleBox["}, 1 },\n { tiffPhotometricInterpretation, 262, {SHORT}, {0,1", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[",2,3,4", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 0]], StyleBox[ "}, Null },\n { tiffStripOffsets, 273, {SHORT,LONG}, Null, \ Null },\n { tiffRowsPerStrip, 278, {SHORT,LONG}, Null, \ (2^32)-1 },\n { tiffStripByteCounts, 279, {SHORT,LONG}, Null, ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["-1", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 0]], StyleBox[ " },\n { tiffXResolution, 282, {RATIONAL}, Null, 0 },\n { \ tiffYResolution, 283, {RATIONAL}, Null, 0 },\n { \ tiffResolutionUnit, 296, {SHORT", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[", LONG", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 0]], StyleBox["}, {1,2,3}, 2 } \n};", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "The following 'table' lists non-baseline but known IFD tags that may be \ present in a TIFF G file. The format is:\n", Evaluatable->False, AspectRatioFixed->True], StyleBox[ " 1. The standard parameter name,\n 2. The tag number,\n 3. List \ of valid types,\n 4. List of valid values, (* note: these are no longer \ used in the code *)\n 5. Default value which is used if entry not present \ in IFD\n - set to Null if no default ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Monaco", FontSize->9] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Don't forget to include a usage message if you add to the following table"], "Text", Evaluatable->False, AspectRatioFixed->True, FontSize->24, FontColor->RGBColor[0.500008, 0, 0]], Cell[TextData[ "nonbaselineTIFFparameters = \n{\n { tiffArtist, 315, \ {ASCII}, Null, Null },\n { tiffCopyright, 33432, {ASCII}, \ Null, Null },\n { tiffHostComputer, 316, {ASCII}, Null, Null \ },\n { tiffImageDescription, 270, {ASCII}, Null, Null },\n { \ tiffMake, 271, {ASCII}, Null, Null },\n { tiffModel, \ 272, {ASCII}, Null, Null },\n { tiffMaxSampleValue, \ 281, {SHORT}, Null, Null },\n { tiffMinSampleValue, 280, \ {SHORT}, Null, 0 },\n { tiffNewSubfileType, 254, {LONG}, Null, \ 0 },\n { tiffOrientation, 274, {SHORT}, Range[8], 1 },\n { \ tiffSoftware, 305, {ASCII}, Null, Null },\n { \ tiffDateTime, 306, {ASCII}, Null, Null },\n { \ tiffDocumentName, 269, {ASCII}, Null, Null },\n { \ tiffPageName, 285, {ASCII}, Null, Null },\n { \ tiffSamplesPerPixel, 277, {SHORT}, Null, 1 } \n};\n\n"], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["definition of auxiliary functions"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[ "Define Function : stringDropBeforeLast and stripContext"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "stringDropBeforeLast[theString_String,chars_String]:=\nModule[\n \ {positionsOfChars = Flatten[StringPosition[theString,chars]]},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (*Print[\"theString = \",theString];\n Print[\"chars = \",chars];*)\n\ ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" If[\n positionsOfChars == {},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then doesn't occur, so return all of theString *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" theString,\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* else it does occur so drop before *)\n\t\t\t", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t StringDrop[\n\t\t\t\t\t theString,\n\t\t\t\t\t \ Last[positionsOfChars]\n\t\t\t\t\t ]\n\t\t\t]\n];\n \n\ stringDropBeforeLast[theObject_,chars_String]:=\n \ stringDropBeforeLast[ToString[theObject],chars];\n\n\ stripContext[listOfObjects_List]:= \n stripContext[#]& /@ listOfObjects;\n\n\ stripContext[theObject_]:= stringDropBeforeLast[theObject,\"`\"];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : readInTIFFheader"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Clear[readInTIFFheader];\n\nreadInTIFFheader::byteOrderErr = \"This file \ may not be a TIFF format image file.\\n\\nThe first two bytes of file should \ be II or MM, indicating the file's byte order. This file has bytes `1` so is \ invalid. \\n\\nTerminating import process. Bye Bye.\";\n\n\ readInTIFFheader::notTIFFerr = \"This file may not be a TIFF format image \ file.\\n\\nBytes 2 and 3 of all TIFF files should be the number 42 (chosen \ because it's the answer to the ultimate question !). This file fails with the \ byte value `1` \\n\\nTerminating import process. Bye Bye.\";\n\n\ readInTIFFheader[stream_]:=\nModule[\n {byteOrder, checkItsTIFF, \ offsetOfFirstIFD},\n\t\t\tbyteOrder = ReadListBinary[stream,Byte,2];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* Print[\"byteOrder = \", byteOrder,\"\\n\\n\"]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" Which[\n byteOrder == {73,73},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" theByteOrder = LeastSignificantByteFirst,\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* else if *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" byteOrder == {77,77},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" theByteOrder = MostSignificantByteFirst,\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* else default to *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " True,\n Message[\n readInTIFFheader::byteOrderErr,\n \ FromCharacterCode[byteOrder]\n ];\n Throw[1]\n ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* note that theByteOrder is not local to ReadTIFFg, but is local to \n \ the package variable *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " \n checkItsTIFF = \n\t ReadBinary[\n\t stream,\n\t Int16,\ \n\t ByteOrder->theByteOrder\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t(* Print[\"checkItsTIFF = \", checkItsTIFF,\"\\n\\n\"]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" If[\n checkItsTIFF != 42,\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then this fails the validation test so exit*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " Message[\n readInTIFFheader::notTIFFerr,\n \ checkItsTIFF\n ];\n Throw[2]\n ];\n\t\t\t \n\t\t\t\ offsetOfFirstIFD = \n\t\t\t ReadBinary[\n\t\t\t stream,\n\t\t\t Int32,\n\ \t\t\t ByteOrder->theByteOrder\n\t\t\t\t];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t(* Print[\"offsetOfFirstIFD = \", offsetOfFirstIFD,\"\\n\\n\"];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\t{theByteOrder, offsetOfFirstIFD}\n]\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : readInImageFileDirectory"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Clear[readInImageFileDirectory];\n\n\ readInImageFileDirectory::canOnlyReadOneSubfile = \"This TIFF file contains \ more than one image. However, only the first of these can be read-in by this \ version (v1.x) of the Mathematica ReadTIFFg function. \\n\\nReading first \ image but skipping rest\";\n\nreadInImageFileDirectory[stream_]:=\nModule[\n \ {noOfFields, theTag, theType, valueCount, valueOffset, theIFD={}, \n \ nextIFD},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* Print[\"theByteOrder = \",theByteOrder]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ " noOfFields = \n\t ReadBinary[\n\t stream,\n\t Int16,\n\t \ ByteOrder->theByteOrder\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* Print[\"noOfFields = \", noOfFields,\"\\n\\n\"];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t \n Do[\n\n\t\t\t theTag = \n\t\t\t\t ReadBinary[\n\t\t\t\t \ stream,\n\t\t\t\t Int16,\n\t\t\t\t ByteOrder->theByteOrder\n\t\t\t\t\ ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* SetStreamPosition[stream,StreamPosition[stream]-2];\n\t\t\t\t \ rawBytes = \n\t\t\t\t ReadListBinary[\n\t\t\t\t stream,\n\t\t\t\t \ Byte,\n\t\t\t\t 2\n\t\t\t\t ];\n\t\t\t Print[\"theTag = \", theTag,\ \" : raw bytes were \",rawBytes];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t \n\t\t\t theType = \n\t\t\t\t ReadBinary[\n\t\t\t\t \ stream,\n\t\t\t\t Int16,\n\t\t\t\t ByteOrder->theByteOrder\n\t\t\t\t\ ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* SetStreamPosition[stream,StreamPosition[stream]-2];\n\t\t\t\t \ rawBytes = \n\t\t\t\t ReadListBinary[\n\t\t\t\t stream,\n\t\t\t\t \ Byte,\n\t\t\t\t 2\n\t\t\t\t ];\n\t\t\t Print[\"theType = \", \ theType,\" : raw bytes were \",rawBytes];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t \n\t\t\t valueCount = \n\t\t\t\t ReadBinary[\n\t\t\t\t \ stream,\n\t\t\t\t Int32,\n\t\t\t\t ByteOrder->theByteOrder\n\t\t\t\t\ ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* SetStreamPosition[stream,StreamPosition[stream]-4];\n\t\t\t\t \ rawBytes = \n\t\t\t\t ReadListBinary[\n\t\t\t\t stream,\n\t\t\t\t \ Byte,\n\t\t\t\t 4\n\t\t\t\t ];\n\t\t\t Print[\"valueCount = \", \ valueCount,\" : raw bytes were \",rawBytes];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t \n\t\t\t valueOffset = \n\t\t\t\t ReadBinary[\n\t\t\t\t \ stream,\n\t\t\t\t Int32,\n\t\t\t\t ByteOrder->theByteOrder\n\t\t\t\t\ ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* SetStreamPosition[stream,StreamPosition[stream]-4];\n\t\t\t\t \ rawBytes = \n\t\t\t\t ReadListBinary[\n\t\t\t\t stream,\n\t\t\t\t \ Byte,\n\t\t\t\t 4\n\t\t\t\t ];\n\t\t\t Print[\"valueOffset = \", \ valueOffset,\" : raw bytes were \",rawBytes,\"\\n\\n\"];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t \n\t\t\t \ AppendTo[theIFD,{theTag,theType,valueCount,valueOffset}],\n\t\t\t \ {noOfFields}\n\t\t\t\t\t\t];\n\n nextIFD = \n\t ReadBinary[\n\t \ stream,\n\t Int32,\n\t ByteOrder->theByteOrder\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* Print[\"nextIFD = \", nextIFD];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ " If[\n nextIFD != 0,\n \ Message[readInImageFileDirectory::canOnlyReadOneSubfile]\n ];\n\t\t\t \n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* Print[\"IFD = \", theIFD];\n\t\t\tPrint[\"\"];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\ttheIFD\n]\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : selectTags"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "selectTags[theItems_List,fromParameterList_List]:=\nModule[\n {targetTags \ = Transpose[fromParameterList][[2]] },\n Select[\n theItems,\n \ MemberQ[ targetTags, #[[1]] ]&\n ]\n]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : setMissingParamsToDefault"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "setMissingParamsToDefault::missingAndNoDefault = \"\nThis TIFF file has an \ invalid format; it does not contain an IFD entry for the field(s) `1` \ \\n\\nThis field does not have a default value so MUST be present. \ \\n\\nTerminating import process. Bye Bye.\";\n\n\ setMissingParamsToDefault[itemsInIFD_List,requiredParameterList_List]:=\n\ Module[\n {tagsPresent, missingParams, missingParamsSansDefault={}},\n \ tagsPresent = Transpose[itemsInIFD][[1]];\n missingParams =\n\t Select[\n\ \t requiredParameterList,\n\t Not[ MemberQ[ tagsPresent, #[[2]] ]] \ &\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t (* Print[\"missingParams = \", missingParams];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t missingParamsSansDefault = \n\t Select[\n\t missingParams,\n\t \ #[[5]] == Null &\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t (* Print[\"missingParamsSansDefault = \", missingParamsSansDefault];*)\ \n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t If[\n\t missingParamsSansDefault != {},\n\t Message[\n\t \ setMissingParamsToDefault::missingAndNoDefault,\n\t \ Transpose[missingParamsSansDefault][[1]]\n\t ];\n\t Throw[3]\n\t ];\n\ \t \n\t missingParams = Transpose[missingParams];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t (* Print[\"missingParams = \", missingParams]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t \n\t MapThread[\n\t Set,\n\t \ {First[missingParams],Last[missingParams]}\n\t ];\n];", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : passOnlyValidTypes"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Clear[passOnlyValidTypes];\n\npassOnlyValidTypes::wrongType = \"The file's \ IDF field `1` (tag = `2`) has an entry of type `3`, which is invalid. Valid \ types are `4`\\n\\nWill attempt to continue loading...\\n\\n\";\n\n\ passOnlyValidTypes[itemsInIFD_List,parameterList_List]:=\nModule[\n \ {itemsWithValidType, itemsWithInvalidType},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* Print[\"itemsInIFD = \",itemsInIFD,\"\\n\\n\"]; *)\n (* \ Print[\"parameterList = \",parameterList,\"\\n\\n\"]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ " itemsWithValidType = \n\t Select[\n\t itemsInIFD,\n\t \ MemberQ[\n\t\t\t\t parameterList[[\n\t\t\t\t \ (First[First[Position[parameterList,#[[1]]]]]),\n\t\t\t\t 3\n\t\t\t\t \ ]],\n\t\t\t\t #[[2]] /. typeCodes\n\t ] &\n\t ];\n\t \ itemsWithInvalidType = Complement[itemsInIFD,itemsWithValidType];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* Print[\"itemsWithValidType = \",itemsWithValidType,\"\\n\\n\"];\n \ Print[\"itemsWithInvalidType = \",itemsWithInvalidType,\"\\n\\n\"]; *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" If[\n Length[itemsWithInvalidType] != 0,\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then report which were in error*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " parametersInError = \n\t getParameterInfoForIFDentry[\n\t \ #,\n\t parameterList\n\t ]& /@ itemsWithInvalidType;\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* Print[\"parametersInError = \",parametersInError ,\"\\n\\n\"];*)\ \n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t MapThread[\n\t\t\t\t Message[\n\t\t\t\t \ passOnlyValidTypes::wrongType,\n\t\t\t\t stripContext[ #2[[1]] ],\n\t\t\ \t\t #2[[2]],\n\t\t\t\t stripContext[ #1[[2]] /. typeCodes ],\n\ \t\t\t\t\t stripContext[ #2[[3]] ]\n\t\t\t\t\t ]&,\n\t\t\t\t {\n\ \t\t\t\t itemsWithInvalidType,\n\t\t\t\t parametersInError\n\t\t\t\t\ }\n\t ];\n\t\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t (* Now return the valid items *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\t\t itemsWithValidType\n]", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "Define Function : getParameterInfoForIFDentry"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "getParameterInfoForIFDentry[theIFDEntry_List,parameterList_List]:=\n\t\ parameterList[[\n\t Position[\n\t\t Transpose[parameterList][[2]],\n\ \t\t theIFDEntry[[1]]\n\t ][[1,1]]\n\t]]\n"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function: valueFitsInFourBytesQ"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "valueFitsInFourBytesQ is a function that returns true iff the directory \ entry value fits into four bytes"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "valueFitsInFourBytesQ[theType_,valueCount_]:=\nModule[\n {unitLength},\n \ unitLength =\n Which[\n theType == 1, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* BYTE, 8-bit byte unsigned integer *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n 1,\n theType == 2, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "(* ASCII, 8-bit byte containing 7-bit ascii code &\n \ zero in last bit *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n 1,\n theType == 3, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* SHORT, 16-bit 2-byte unsigned integer *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n 2,\n theType == 4, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* LONG , 36-bit 4-byte unsigned integer *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n 4,\n theType == 5, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "(* RATIONAL , Two LONGs: first is numerator and\n \ second is denominator *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n 8\n ];\n (valueCount * unitLength) < 5\n];", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : getItemFromFile"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "getItemFromFile[theType_,valueCount_,valueOffset_,stream_]:=\nModule[\n \ {theValuesList},\n SetStreamPosition[stream,valueOffset];\n \ theValuesList=\n Which[\n\t theType == 1, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* BYTE *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t ReadListBinary[\n\t stream,\n\t Byte,\n\t \ valueCount,\n\t ByteOrder->theByteOrder\n\t ],\n\t\n\t \ theType == 2, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* ASCII *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t {StringJoin[ \n\t\t\t Map[\n\t\t\t \ FromCharacterCode[#] &,\n\t\t\t Drop[\n\t\t\t \ ReadListBinary[\n\t\t\t stream,\n\t\t\t Byte,\n\ \t\t\t valueCount,\n\t\t\t \ ByteOrder->theByteOrder\n\t\t\t ],\n\t\t\t -1\n\t\t\t \ ]\n\t\t\t ]\n\t\t\t ]},\n\t\n\t theType == 3, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* SHORT *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t ReadListBinary[\n\t stream,\n\t Int16,\n\t \ valueCount,\n\t ByteOrder->theByteOrder\n\t ],\n\t\n\t \ theType == 4, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* LONG *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t ReadListBinary[\n\t stream,\n\t Int32,\n\t \ valueCount,\n\t ByteOrder->theByteOrder\n\t ],\n\t \n\t \ theType == 5, ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* RATIONAL *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t Module[\n\t {numbers},\n\t numbers = \n\t\t \ ReadBinary[\n\t\t\t\t\t\t\t\t\t stream,\n\t\t\t\t\t\t\t\t\t Int32,\ \n\t\t\t\t\t\t\t\t\t ByteOrder->theByteOrder\n\t\t\t\t\t\t\t\t\t ]& /@ \ Range[2*valueCount];\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t Divide @@ # & /@ \ Partition[numbers,2]\n\t\t\t\t\t ]\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t (* Print[\"theValuesList = \",theValuesList];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "(* the above items are all lists. Strip off the enclosing brackets if \ there is only one element in the list *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\t If[\n\t Length[theValuesList] == 1,\n\t ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n\t theValuesList[[1]],\n\t ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* else *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n\t theValuesList\n\t ]\n\t \n];", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : getItemFromValueOffset"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "getItemFromValueOffset[theTag_,theType_,valueCount_,valueOffset_]:=\n\ Module[\n {tempFilename, tempStream, theValue},\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t(* Print[\"Getting value from valueOffset\"];\n\t\t\tPrint[\"theTag \ = \",theTag];\n\t\t\tPrint[\"theType = \",theType];\n\t\t\tPrint[\"valueCount \ = \",valueCount];\n\t\t\tPrint[\"valueOffset = \",valueOffset];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\ttempFilename = Close[OpenTemporary[]];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* Print[\"file = \",tempFilename];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\ttempStream = OpenWriteBinary[tempFilename];\n\t\t\tWriteBinary[\n\t\t\ \t tempStream,\n\t\t\t valueOffset,\n IntegerConvert -> Int32,\n\t\t\ \t ByteOrder -> theByteOrder\n\t\t\t];\n\t\t\tClose[tempStream];\n\n\t\t\t\ tempStream = OpenReadBinary[tempFilename];\n\n theValue = \ getItemFromFile[theType,valueCount,0,tempStream];\n\t\t\tClose[tempStream];\n\ \t\t\tDeleteFile[tempFilename];\n\t\t\t\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* Print[\"value = \",theValue,\"\\n\\n\"];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\t\n theValue\n];", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function: getValue"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "\ngetValue[{theTag_,theType_,valueCount_,valueOffset_},stream_]:=\n\tIf[ \n\ \t valueFitsInFourBytesQ[theType,valueCount],\n\t ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t getItemFromValueOffset[theTag,theType,valueCount,valueOffset],\n\t \ ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* else *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t getItemFromFile[theType,valueCount,valueOffset,stream],\n\t]", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : valuesOfIFDsValidQ"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "valuesOfIFDsValidQ::badValue = \"The value of this file's IDF parameter \ `1` (tag = `2`) is `3`. Only the following are valid for TIFF Class G files \ : `4`. \\n\\n\";\n\nvaluesOfIFDsValidQ[theIFDsWithValues_List]:=\nModule[\n \ {restrictedValueItems, invalidRestrictedValueItems},\n restrictedValueItems \ = \n\t Select[\n\t theIFDsWithValues,\n\t Not[#[[4]]===Null] &\n\t\ ];\n invalidRestrictedValueItems = \n\t Select[\n\t \ restrictedValueItems,\n\t Not[MemberQ[\n\t #[[4]],\n\t \ #[[6]]\n\t ]] &\n\t ];\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* Print[\"", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["invalidRestrictedValueItems", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" = \",", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["invalidRestrictedValueItems", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["];*)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" \n If[\n Length[invalidRestrictedValueItems]==0,\n ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "(* then no items have obviously invalid values so return True *)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n True,\n ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "(* else some values are invalid, so report them and return False *)\n", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " Message[\n valuesOfIFDsValidQ::badValue,\n \ stripContext[ #[[1]] ],\n #[[2]],\n #[[6]],\n #[[4]]\n\ ] & /@ invalidRestrictedValueItems;\n False\n ]\n]", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : setTIFFparameterValues"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "setTIFFparameterValues[theIFDsWithValues_List]:=\nModule[\n {itemInfo},\n\ itemInfo = Transpose[theIFDsWithValues];\n ", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* Print[\"itemInfo = \",itemInfo];*)", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\n\t MapThread[\n\t Set,\n\t {First[itemInfo],Last[itemInfo]}\n\t \ ]\n]", InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : reportTIFFparameterValues"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "reportTIFFparameterValues[theIFDsWithValues_List]:=\n Print[\n \"Tiff \ parameter \",\n stripContext[ #[[1]] ],\n \" (tag = \",\n #[[2]],\n \ \") is set to \",\n #[[6]]\n ] & /@ theIFDsWithValues"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Define Function : getStrip"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "getStrip[\n theStream_, \n offset_Integer, \n bytes_Integer, \n \ imageWidth_Integer, \n bitsPerSample_Integer\n]:=\nModule[\n {rawStrip},\n\ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* Print[\"offset = \",offset];\n Print[\"bytes to read = \",bytes]; \ *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ " SetStreamPosition[theStream,offset];\n rawStrip = \ ReadListBinary[theStream,Byte,bytes];\n \n Which[\n bitsPerSample == \ 1,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* then each byte is 8 bilevel pixels, so break up each byte into bits \ *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t\tMap[\n\t\t\t\t\t\t Take[#,imageWidth] &,\n\t\t\t\t\t\t \ Partition[\n\t\t\t\t\t\t Flatten[ IntegerDigits[#,2,8]& /@ rawStrip ],\n\ \t\t\t\t\t\t 8*(1+Quotient[imageWidth - 0.5, 8])\n\t\t\t\t\t\t ]\n\t\t\ \t\t\t\t],\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* else if *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" bitsPerSample == 4,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* then each byte is 2 16-level grayscale pixels, so break up each byte \ \n into two nibbles *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t\tMap[\n\t\t\t\t\t\t Take[#,imageWidth] &,\n\t\t\t\t\t\t \ Partition[\n\t\t\t\t\t\t Flatten[ IntegerDigits[#,16,2]& /@ rawStrip ],\n\ \t\t\t\t\t\t 2*(1+Quotient[imageWidth - 0.5, 2])\n\t\t\t\t\t\t ]\n\t\t\ \t\t\t\t],\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t(* else if *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" bitsPerSample == 8,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then each byte is a single grayscale pixel *) \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t Partition[\n\t\t\t\t rawStrip,\n\t\t\t\t imageWidth\n\ \t\t\t\t ]\n ]\n]", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["definition of exported functions : ReadTIFFg"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "ReadTIFFg[filename_String,opts___Rule]:=\nModule[\n {\n \ verboseReport,\n ignoreOther,\n stream,\n failure,\n \ theByteOrder,\n offsetOfFirstIFD,\n theIFD, baselineIFDs, \ otherIFDs, knownIFDs, unknownIFDs, validKnownIFDs,\n theIFDsWithValues, \ rawData\n },\n \n verboseReport = report /. {opts} /. \ Options[ReadTIFFg];\n ignoreOther = ignoreNonBaseline /. {opts} /. \ Options[ReadTIFFg];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (*Print[\"verboseReport = \",verboseReport];\n Print[\"ignoreOther = \ \",ignoreOther];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\n Clear[\"ReadTIFFpackage`tiff*\"];\n \ Clear[\"ReadTIFFpackage`private`tiff*\"];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" If[\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" Not[FileType[filename] === File],\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then file does not exist so Abort *)\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ " Message[ReadTIFFg::filenameErr, filename];\n\t Abort[]\n\t ];\n\n\ stream = OpenReadBinary[filename];\n failure = Catch[\n \n \ {theByteOrder, offsetOfFirstIFD} = readInTIFFheader[stream];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t (* Print[\"theByteOrder = \", theByteOrder, \"\\n\\n\"];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\n SetStreamPosition[stream,offsetOfFirstIFD]; ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* jump to IFD *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n theIFD = readInImageFileDirectory[stream];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t (* Print[\"IFD = \", theIFD, \"\\n\\n\"]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\n\t\t\t baselineIFDs = selectTags[theIFD,baselineTIFFparameters];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t (* Print[\"baselineIFDs = \", baselineIFDs, \"\\n\\n\"];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\t\t\t\totherIFDs = Complement[theIFD, baselineIFDs];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t (* Print[\"otherIFDs = \", otherIFDs, \"\\n\\n\"]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t knownIFDs = selectTags[otherIFDs,nonbaselineTIFFparameters];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t (* Print[\"knownIFDs = \", knownIFDs, \"\\n\\n\"]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" unknownIFDs = Complement[otherIFDs,knownIFDs];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t (* Print[\"unknownIFDs = \", unknownIFDs, \"\\n\\n\"]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ " validKnownIFDs = \n\t passOnlyValidTypes[\n\t\t\t\t\t\t\t \ knownIFDs,\n\t\t\t\t\t\t\t\t\t\tnonbaselineTIFFparameters\n\t\t\t\t\t\t\t];\n\ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t (* Print[\"validKnownIFDs = \", validKnownIFDs, \"\\n\\n\"]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\t\t\t\t\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t(* Work on the baseline TIFF parameters. i.e., \n Handle \ defaults, \n check types are valid, \n get values, \n \ check values are valid,\n set parameters \n *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontColor->RGBColor[1, 0, 1]], StyleBox[ " \n\t\t setMissingParamsToDefault[\n\t\t baselineIFDs,\n\t\t \ baselineTIFFparameters\n\t\t ];\n\t\t \n\t\t If[\n\t\t\t\t\t \ passOnlyValidTypes[baselineIFDs, baselineTIFFparameters] != \n\t\t\t\t\t \ baselineIFDs,\n\t\t\t\t\t\t\t\t Message[ReadTIFFg::typeErr];\n\t\t\t\t\t\t\t\ \t Throw[5]\n\t\t\t\t\t ];\n\t\t\t\t\t \n\t\t\t\t\t theIFDsWithValues = \n\t\t\ \t\t\t\t MapThread[\n\t\t\t\t\t\t Append,\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\ \t getParameterInfoForIFDentry[\n\t\t\t\t\t\t #,\n\t\t\t\t\t\t \ baselineTIFFparameters\n\t\t\t\t\t\t ] & /@ baselineIFDs,\n\t\t\ \t\t\t\t getValue[#,stream] & /@ baselineIFDs\n\t\t\t\t\t\t\t }\n\t\t\ \t\t\t\t ];\n\t\t\t\t\t \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t(* Print[\"theIFDsWithValues = \", theIFDsWithValues, \ \"\\n\\n\"];*)\n\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t\t\t If[\n\t\t\t\t\t verboseReport,\n\t\t\t\t\t \ Print[\"Essential IFD fields\\n--------------------\"];\n\t\t\t\t\t \ reportTIFFparameterValues[theIFDsWithValues];\n\t\t\t\t\t ];\n\t\t\t\t\t \n\t\ \t\t\t\t setTIFFparameterValues[theIFDsWithValues];\n\n\t\t\t\t\t \ tiffStripsPerImage = \n\t\t\t\t\t \ Floor[(tiffImageLength+tiffRowsPerStrip-1)/tiffRowsPerStrip];\n\n\t\t\t\t\t \ If[\n\t\t\t\t\t verboseReport,\n\t\t\t\t\t Print[\"tiffStripsPerImage = \ \",tiffStripsPerImage];\n\t\t\t\t\t ];\n\t\t\t\t\t \n\t\t\t\t\t If[\n\t\t\t\t\ \t tiffStripByteCounts == -1,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t (* then the IFD did not contain a StripByteCounts field. This \ is strictly \n\t\t\t\t\t invalid but the parameter can actually be \ calculated in simple cases. \n\t\t\t\t\t Report then try to calculate *)\n\ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t Message[ReadTIFFg::StripByteCountsErr];\n\t\t\t\t\t \ tiffStripByteCounts = \n\t\t\t\t\t Table[\n\t\t\t\t\t \ Ceiling[tiffImageLength/tiffStripsPerImage] (* no rows/strip *)\n\t\t\ \t\t\t * Ceiling[tiffImageWidth * tiffBitsPerSample / 8], (* no bytes \ / row *)\n\t\t\t\t\t {tiffStripsPerImage}\n\t\t\t\t\t ];\n\t\t\t\t\ \t ];\n\t\t\t\t\t \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t (* Print[\"tiffStripByteCounts = \",tiffStripByteCounts];\n\t\t\ \t\t\t Print[\"tiffStripOffsets = \",tiffStripOffsets]; *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\n\t\t\t\t\t If[\n\t\t\t\t\t tiffCompression != 1,\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t\t (* then image is compressed, so report and Throw *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t Message[ReadTIFFg::compressedErr];\n\t\t\t\t\t Throw[7]\n\ \t\t\t\t\t ];\n\t\t\t\t\t \n\t\t\t\t\t If[\n\t\t\t\t\t \ (Length[Flatten[{tiffStripOffsets}]] != tiffStripsPerImage) || \n\t\t\t\t\t \ (Length[Flatten[{tiffStripByteCounts}]] != tiffStripsPerImage),\n\t\t\t\t\t \ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then a format error, report and throw *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t Message[\n\t\t\t\t\t ReadTIFFg::stripErr,\n\t\t\t\t\t\ Length[Flatten[{tiffStripOffsets}]],\n\t\t\t\t\t \ Length[Flatten[{tiffStripByteCounts}]],\n\t\t\t\t\t tiffStripsPerImage\n\ \t\t\t\t\t ];\n\t\t\t\t\t Throw[8]\n\t\t\t\t\t ];\n\t\t\t\t\t \n\t\t\t\t\ \t If[\n\t\t\t\t\t tiffPhotometricInterpretation > 1,\n\t\t\t\t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* this is a colour image, report then Throw *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t Message[\n\t\t\t\t\t ReadTIFFg::colourErr,\n\t\t\t\ \t\t Which[\n\t\t\t\t\t tiffPhotometricInterpretation == 0,\n\ \t\t\t\t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then a *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t \"a grayscale image in WhiteIsZero format.\",\n\t\t\ \t\t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* if *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox["\n\t\t\t\t\t tiffPhotometricInterpretation == 1,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["\t\t\t\t\t (* then a *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t \"a grayscale image in BlackIsZero format.\",\n\t\t\t\ \t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* if *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t tiffPhotometricInterpretation == 2,\n\t\t\t\t\t \ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then a *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t \"an RGB full colour image.\",\n\t\t\t\t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* if *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t tiffPhotometricInterpretation == 3,\n\t\t\t\t\t \ ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* then a *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t \"a pallete-colour image.\",\n\t\t\t\t\t ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox["(* default *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\n\t\t\t\t\t True,\n\t\t\t\t\t \"an unknown format \ image.\"\n\t\t\t\t\t ]\n\t\t\t\t\t ];\n\t\t\t\t\t Throw[9]\n\t\ \t\t\t\t ];\n\n\t\t\t\t\t If[\n\t\t\t\t\t Not[ \ MemberQ[{1,4,8},tiffBitsPerSample] ],\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* then image is not 1,4 or 8-bit, so report and Throw *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t Message[ReadTIFFg::badBitErr,tiffBitsPerSample];\n\t\t\t\t\t \ Throw[10]\n\t\t\t\t\t ];\n\t\t\t\t\t \n\t\t\t\t\t If[\n\t\t\t\t\t Not[ \ MemberQ[{1,2,3},tiffResolutionUnit] ],\n\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* then tiffResolutionUnit is not 1,2 or 3, so report and reset \ *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t \ Message[ReadTIFFg::unknownResolutionUnit,tiffResolutionUnit];\n\t\t\t\t\t \ tiffResolutionUnit = 1\n\t\t\t\t\t ];\n\t\t\t\t\t \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ " (* Note: checking values by valuesOfIFDsValidQ[] was here *)\n (* \ This checking has now been commented out. All checking of \n important \ parameters must now be done manually, in individual\n lines of code *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t (*If[\n\t\t\t\t\t Not[valuesOfIFDsValidQ[theIFDsWithValues]],\n\t\ \t\t\t\t\t\t\t Message[ReadTIFFg::valueErr];\n\t\t\t\t\t\t\t\t Throw[6]\n\t\t\ \t\t\t ];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox["\t\t\t\t \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco"], StyleBox[ "(* If user wants non-required fields processed then \n work on other, \ non-essential TIFF parameters. i.e.,\n report unknown IFD items, \n \ filter out known items with invalid types,\n get values of \ known items, \n check values are valid,\n report values \n \ *)", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontColor->RGBColor[1, 0, 1]], StyleBox["\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco"], StyleBox[" If[\n Not[ignoreOther],\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* Print[\"Processed non-essential fields\"];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t Message[\n\t\t\t ReadTIFFg::unknownTag,\n\t\t\t \ #[[1]],\n\t\t\t stripContext[ #[[2]] /. typeCodes ],\n\t\t\t \ #[[3]],\n\t\t\t #[[4]]\n\t\t\t ]& /@ unknownIFDs;\n\t\t\t\n\t\t\t\ \t\t\t\t\t theIFDsWithValues = \n\t\t\t\t\t\t\t\t\t MapThread[\n\t\t\t\t\t\t\t\ \t\t Append,\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t \ getParameterInfoForIFDentry[\n\t\t\t\t\t\t\t\t\t #,\n\t\t\t\t\t\t\t\t\ \t nonbaselineTIFFparameters\n\t\t\t\t\t\t\t\t\t ] & /@ \ validKnownIFDs,\n\t\t\t\t\t\t\t\t\t getValue[#,stream] & /@ \ validKnownIFDs\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t ];\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t\t\t\t\t(* Print[\"theIFDsWithValues = \", theIFDsWithValues, \"\ \\n\\n\"];*)\n\t\t\t", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[ "\t\t\t\t\t If[\n\t\t\t\t\t\t\t\t verboseReport,\n\t\t\t\t\t \ Print[\"\\n\\nOptional IFD fields\\n-------------------\"]\n\t\t\t\t\t\t\t\t\t\ \t\t\treportTIFFparameterValues[theIFDsWithValues];\n\t\t\t\t\t\t\t\t ];\n\t\t\ \t\t\t setTIFFparameterValues[theIFDsWithValues];\n\t\t\t\t\t\t\t\t If[\n\t\ \t\t\t\t\t\t\t tiffOrientation != 1,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t\t\t\t (* then report that not handled by this version of \ ReadTIFFg *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t\t\t\t Message[ReadTIFFg::orientationErr,tiffOrientation]\n\t\ \t\t\t\t\t\t\t ];\n\t\t\t\t\t\t];\n\t\t\t\t \n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t (* Now you have all the parameters - get the image *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t \n\t\t\t\t\t\trawData = \n\t\t\t\t\t\t\tReverse[Flatten[\n\t\t\t\ \t\t \t\t\tMapThread[\n\t\t\t\t\t\t\t\t\t\t\t getStrip[\n\t\t\t\t\t\t\t\t\t\ \t\t stream,\n\t\t\t\t\t\t\t\t\t\t\t #1,\n\t\t\t\t\t\t\t\t\t\t\t \ #2,\n\t\t\t\t\t\t\t\t\t\t\t tiffImageWidth,\n\t\t\t\t\t\t\t\t\t\t\t \ tiffBitsPerSample\n\t\t\t\t\t\t\t\t\t\t\t ]&,\n\t\t\t\t\t\t\t\t\t\t\t {\n\t\ \t\t\t\t\t\t\t\t\t\t Flatten[{tiffStripOffsets}],\n\t\t\t\t\t\t\t\t\t\t\t \ Flatten[{tiffStripByteCounts}]\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\ \t\t],\n\t\t\t\t\t\t\t\t\t\t1\n\t\t\t\t\t\t\t]];\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ If[\n\t\t\t\t\t\t tiffPhotometricInterpretation == 0,\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[ "\t\t\t\t\t\t(* WhiteIsZero - which is reverse of MMA default so *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[ "\t\t\t\t\t\t rawData = (2^tiffBitsPerSample - 1) - rawData\n\t\t\t\t\t\t\ ];\n\t\t\t\t\t\t\n\t\t\t];\n Close[stream];\n\n If[\n \ NumberQ[failure],\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* then *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" (* Print[\"Error type \", failure,\" occured.\"];*)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[" Null,\n ", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"], StyleBox[" (* else *)\n", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain", FontColor->RGBColor[1, 0, 1]], StyleBox[" rawData\n ]\n];", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True, FontFamily->"Monaco", FontWeight->"Plain"] }], "Input", PageWidth->Infinity, InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["rules for system functions"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["\n(* Sin/: Sin[x_]^2 := 1 - Cos[x]^2 *)"], "Special3", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["restore protection of system symbols"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["\n(*Protect[ Evaluate[protected] ] *) "], "Special3", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["end the private context"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["End[]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["protect exported symbols"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Protect[ ReadTIFFg ]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["end the package context"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["EndPackage[]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["report that package loaded"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Print[\"ReadTIFFpackage.m version 1.1 loaded. Enjoy !\"]"], "Input", InitializationCell->True, AspectRatioFixed->True]}, Open]]}, Open]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 640}, {0, 460}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 365}, WindowMargins->{{28, Automatic}, {Automatic, 1}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ AVU/IFiQKFD000000VHFh09V7j0000000OlH809FV" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1711, 51, 90, 2, 70, "Title", Evaluatable->False], Cell[1804, 55, 156, 4, 70, "Subtitle", Evaluatable->False], Cell[1963, 61, 98, 2, 70, "Subsubtitle", Evaluatable->False], Cell[2064, 65, 87, 2, 70, "Subsubtitle", Evaluatable->False], Cell[2154, 69, 92, 2, 70, "Subsubtitle", Evaluatable->False], Cell[CellGroupData[{ Cell[2269, 73, 92, 2, 70, "Section", Evaluatable->False], Cell[2364, 77, 1247, 33, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[3643, 112, 85, 2, 70, "Section", Evaluatable->False], Cell[3731, 116, 2367, 63, 70, "Text", Evaluatable->False], Cell[6101, 181, 1248, 45, 70, "Text", Evaluatable->False], Cell[7352, 228, 2722, 94, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[10106, 324, 84, 2, 70, "Section", Evaluatable->False], Cell[10193, 328, 3292, 102, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[13517, 432, 89, 2, 70, "Section", Evaluatable->False], Cell[13609, 436, 1145, 17, 70, "Text", Evaluatable->False], Cell[14757, 455, 186, 4, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[14975, 461, 117, 2, 70, "Section", Evaluatable->False], Cell[15095, 465, 1073, 30, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[16191, 497, 88, 2, 70, "Subsection", Evaluatable->False], Cell[16282, 501, 736, 19, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[17050, 522, 103, 2, 70, "Subsection", Evaluatable->False], Cell[17156, 526, 4161, 82, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[21349, 610, 98, 2, 70, "Subsection", Evaluatable->False], Cell[21450, 614, 1015, 27, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[22488, 643, 100, 2, 70, "Subsubsection", Evaluatable->False], Cell[22591, 647, 1286, 19, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[23909, 668, 103, 2, 70, "Subsubsection", Evaluatable->False], Cell[24015, 672, 8099, 282, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[32155, 956, 92, 2, 70, "Subsection", Evaluatable->False], Cell[32250, 960, 1807, 49, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[34080, 1011, 93, 2, 70, "Subsubsection", Evaluatable->False], Cell[34176, 1015, 853, 32, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[35061, 1049, 94, 2, 70, "Subsubsection", Evaluatable->False], Cell[35158, 1053, 894, 33, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[36084, 1088, 96, 2, 70, "Subsubsection", Evaluatable->False], Cell[36183, 1092, 1192, 41, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[37407, 1135, 94, 2, 70, "Subsubsection", Evaluatable->False], Cell[37504, 1139, 2155, 72, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[39691, 1213, 108, 2, 70, "Subsubsection", Evaluatable->False], Cell[39802, 1217, 3055, 104, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[42889, 1323, 95, 2, 70, "Subsubsection", Evaluatable->False], Cell[42987, 1327, 4209, 150, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[47228, 1479, 95, 2, 70, "Subsubsection", Evaluatable->False], Cell[47326, 1483, 4057, 145, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[51415, 1630, 98, 2, 70, "Subsubsection", Evaluatable->False], Cell[51516, 1634, 3385, 123, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[54933, 1759, 94, 2, 70, "Subsubsection", Evaluatable->False], Cell[55030, 1763, 1771, 60, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[56833, 1825, 94, 2, 70, "Subsubsection", Evaluatable->False], Cell[56930, 1829, 1596, 58, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[58558, 1889, 97, 2, 70, "Subsubsection", Evaluatable->False], Cell[58658, 1893, 3023, 105, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[61722, 2000, 101, 2, 70, "Subsection", Evaluatable->False], Cell[61826, 2004, 4281, 139, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[66148, 2145, 133, 3, 70, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[66304, 2150, 376, 14, 70, "Subsection", Evaluatable->False], Cell[66683, 2166, 1264, 43, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[67979, 2211, 289, 11, 70, "Subsection", Evaluatable->False], Cell[68271, 2224, 2949, 100, 70, "Text", Evaluatable->False], Cell[71223, 2326, 184, 4, 70, "Message", Evaluatable->False], Cell[71410, 2332, 832, 30, 70, "Text", Evaluatable->False], Cell[72245, 2364, 2012, 62, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[74280, 2428, 116, 2, 70, "Subsubsection", Evaluatable->False], Cell[74399, 2432, 2095, 74, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[76526, 2508, 121, 2, 70, "Subsubsection", Evaluatable->False], Cell[76650, 2512, 2684, 91, 70, "Text", Evaluatable->False] }, Closed]], Cell[79346, 2605, 1983, 60, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[81370, 2667, 106, 2, 70, "Section", Evaluatable->False], Cell[81479, 2671, 865, 24, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[82367, 2697, 147, 4, 70, "Subsection", Evaluatable->False], Cell[82517, 2703, 1402, 45, 70, "Text", Evaluatable->False], Cell[83922, 2750, 259, 7, 70, "Input", InitializationCell->True], Cell[84184, 2759, 2095, 52, 70, "Input", InitializationCell->True], Cell[86282, 2813, 117, 2, 70, "Input", InitializationCell->True], Cell[86402, 2817, 930, 32, 70, "Text", Evaluatable->False], Cell[87335, 2851, 126, 2, 70, "Input", InitializationCell->True], Cell[87464, 2855, 816, 28, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[88312, 2885, 94, 2, 70, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[88429, 2889, 106, 2, 70, "Subsubsection", Evaluatable->False], Cell[88538, 2893, 1517, 21, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[90087, 2916, 108, 2, 70, "Subsubsection", Evaluatable->False], Cell[90198, 2920, 325, 6, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[90555, 2928, 112, 2, 70, "Subsubsection", Evaluatable->False], Cell[90670, 2932, 283, 5, 70, "Input", InitializationCell->True], Cell[90956, 2939, 315, 6, 70, "Input", InitializationCell->True], Cell[91274, 2947, 316, 6, 70, "Input", InitializationCell->True], Cell[91593, 2955, 1192, 17, 70, "Input", InitializationCell->True], Cell[92788, 2974, 1449, 21, 70, "Input", InitializationCell->True], Cell[94240, 2997, 583, 10, 70, "Input", InitializationCell->True], Cell[94826, 3009, 633, 10, 70, "Input", InitializationCell->True], Cell[95462, 3021, 820, 13, 70, "Input", InitializationCell->True], Cell[96285, 3036, 496, 9, 70, "Input", InitializationCell->True], Cell[96784, 3047, 392, 7, 70, "Input", InitializationCell->True], Cell[97179, 3056, 392, 7, 70, "Input", InitializationCell->True], Cell[97574, 3065, 727, 11, 70, "Input", InitializationCell->True], Cell[98304, 3078, 360, 6, 70, "Input", InitializationCell->True], Cell[98667, 3086, 231, 5, 70, "Input", InitializationCell->True], Cell[98901, 3093, 283, 5, 70, "Input", InitializationCell->True], Cell[99187, 3100, 318, 6, 70, "Input", InitializationCell->True], Cell[99508, 3108, 297, 6, 70, "Input", InitializationCell->True], Cell[99808, 3116, 354, 6, 70, "Input", InitializationCell->True], Cell[100165, 3124, 581, 9, 70, "Input", InitializationCell->True], Cell[100749, 3135, 447, 7, 70, "Input", InitializationCell->True], Cell[101199, 3144, 1003, 15, 70, "Input", InitializationCell->True], Cell[102205, 3161, 1911, 27, 70, "Input", InitializationCell->True], Cell[104119, 3190, 361, 6, 70, "Input", InitializationCell->True], Cell[104483, 3198, 484, 8, 70, "Input", InitializationCell->True], Cell[104970, 3208, 363, 6, 70, "Input", InitializationCell->True], Cell[105336, 3216, 260, 5, 70, "Input", InitializationCell->True], Cell[105599, 3223, 255, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[105886, 3230, 116, 2, 70, "Subsubsection", Evaluatable->False], Cell[106005, 3234, 1729, 35, 70, "Input", InitializationCell->True], Cell[107737, 3271, 937, 14, 70, "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[108715, 3287, 117, 2, 70, "Subsection", Evaluatable->False], Cell[108835, 3291, 150, 4, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[109017, 3297, 105, 2, 70, "Subsection", Evaluatable->False], Cell[109125, 3301, 101, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[109258, 3305, 146, 4, 70, "Subsection", Evaluatable->False], Cell[109407, 3311, 509, 17, 70, "Special3", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[109948, 3330, 119, 2, 70, "Subsection", Evaluatable->False], Cell[110070, 3334, 4140, 56, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[114242, 3392, 141, 3, 70, "Subsection", Evaluatable->False], Cell[114386, 3397, 169, 4, 70, "Input", InitializationCell->True], Cell[114558, 3403, 1088, 35, 70, "Text", Evaluatable->False], Cell[115649, 3440, 2407, 73, 70, "Input", InitializationCell->True], Cell[118059, 3515, 652, 17, 70, "Text", Evaluatable->False], Cell[118714, 3534, 206, 6, 70, "Text", Evaluatable->False], Cell[118923, 3542, 1137, 17, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[120092, 3561, 113, 2, 70, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[120228, 3565, 139, 3, 70, "Subsubsection", Evaluatable->False], Cell[120370, 3570, 1807, 51, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[122209, 3623, 117, 2, 70, "Subsubsection", Evaluatable->False], Cell[122329, 3627, 4721, 130, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[127082, 3759, 125, 2, 70, "Subsubsection", Evaluatable->False], Cell[127210, 3763, 5413, 140, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[132655, 3905, 111, 2, 70, "Subsubsection", Evaluatable->False], Cell[132769, 3909, 277, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[133078, 3916, 126, 2, 70, "Subsubsection", Evaluatable->False], Cell[133207, 3920, 2330, 60, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[135569, 3982, 119, 2, 70, "Subsubsection", Evaluatable->False], Cell[135691, 3986, 3398, 87, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[139121, 4075, 129, 3, 70, "Subsubsection", Evaluatable->False], Cell[139253, 4080, 281, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[139566, 4087, 121, 2, 70, "Subsubsection", Evaluatable->False], Cell[139690, 4091, 181, 4, 70, "Text", Evaluatable->False], Cell[139874, 4097, 2260, 69, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[142166, 4168, 116, 2, 70, "Subsubsection", Evaluatable->False], Cell[142285, 4172, 4514, 127, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[146831, 4301, 123, 2, 70, "Subsubsection", Evaluatable->False], Cell[146957, 4305, 1995, 52, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[148984, 4359, 108, 2, 70, "Subsubsection", Evaluatable->False], Cell[149095, 4363, 1075, 35, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[150202, 4400, 119, 2, 70, "Subsubsection", Evaluatable->False], Cell[150324, 4404, 2709, 76, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[153065, 4482, 123, 2, 70, "Subsubsection", Evaluatable->False], Cell[153191, 4486, 740, 23, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[153963, 4511, 126, 2, 70, "Subsubsection", Evaluatable->False], Cell[154092, 4515, 295, 5, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[154419, 4522, 109, 2, 70, "Subsubsection", Evaluatable->False], Cell[154531, 4526, 3577, 110, 70, "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[158149, 4638, 124, 2, 70, "Subsection", Evaluatable->False], Cell[158276, 4642, 23661, 668, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[181969, 5312, 106, 2, 70, "Subsection", Evaluatable->False], Cell[182078, 5316, 117, 2, 70, "Special3", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[182227, 5320, 116, 2, 70, "Subsection", Evaluatable->False], Cell[182346, 5324, 118, 2, 70, "Special3", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[182496, 5328, 103, 2, 70, "Subsection", Evaluatable->False], Cell[182602, 5332, 86, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[182720, 5336, 104, 2, 70, "Subsection", Evaluatable->False], Cell[182827, 5340, 101, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[182960, 5344, 103, 2, 70, "Subsection", Evaluatable->False], Cell[183066, 5348, 93, 2, 70, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[183191, 5352, 106, 2, 70, "Subsection", Evaluatable->False], Cell[183300, 5356, 138, 3, 70, "Input", InitializationCell->True] }, Closed]] }, Closed]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)