1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3//EN">
<HTML><HEAD>
<TITLE>User's Reference - ReadImage</TITLE>
<META HTTP-EQUIV="keywords" CONTENT="GRAPHICS VISUALIZATION VISUAL PROGRAM DATA
MINING">
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
</HEAD><BODY BGCOLOR="#FFFFFF" link="#00004b" vlink="#4b004b">
<TABLE width=510 border=0 cellpadding=0 cellspacing=0>
<TR>
<TD><IMG src="../images/spacer.gif" width=80 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=49 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=24 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=100 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=3 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=127 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=6 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=50 height=1></TD>
<TD><IMG src="../images/spacer.gif" width=71 height=1></TD>
</TR>
<TR>
<TD colspan=9><IMG src="../images/flcgh_01.gif" width=510 height=24 alt="OpenDX - Documentation"></TD>
</TR>
<TR>
<TD colspan=2><A href="../allguide.htm"><IMG src="../images/flcgh_02.gif" width=129 height=25 border="0" alt="Full Contents"></A></TD>
<TD colspan=3><A href="../qikguide.htm"><IMG src="../images/flcgh_03.gif" width=127 height=25 border="0" alt="QuickStart Guide"></A></TD>
<TD><A href="../usrguide.htm"><IMG src="../images/flcgh_04.gif" width=127 height=25 border="0" alt="User's Guide"></A></TD>
<TD colspan=3><B><A href="../refguide.htm"><IMG src="../images/flcgh_05d.gif" width=127 height=25 border="0" alt="User's Reference"></A></B></TD>
</TR>
<TR>
<TD><A href="refgu109.htm"><IMG src="../images/flcgh_06.gif" width=80 height=17 border="0" alt="Previous Page"></A></TD>
<TD colspan=2><A href="refgu111.htm"><IMG src="../images/flcgh_07.gif" width=73 height=17 border="0" alt="Next Page"></A></TD>
<TD><A href="../refguide.htm"><IMG src="../images/flcgh_08.gif" width=100 height=17 border="0" alt="Table of Contents"></A></TD>
<TD colspan=3><A href="refgu009.htm"><IMG src="../images/flcgh_09.gif" width=136 height=17 border="0" alt="Partial Table of Contents"></A></TD>
<TD><A href="refgu175.htm"><IMG src="../images/flcgh_10.gif" width=50 height=17 border="0" alt="Index"></A></TD>
<TD><A href="../srchindx.htm"><IMG src="../images/flcgh_11.gif" width=71 height=17 border="0" alt="Search"></A></TD>
</TR>
</TABLE>
<H3><A name="HDRREADIMA" ></A>ReadImage</H3>
<A NAME="IDX633"></A><A NAME="IDX634"></A>
<P><STRONG>Category</STRONG>
<P>
<A HREF="refgu008.htm#HDRCATIAE">Import and Export</A>
<A NAME="IDX635"></A>
<A NAME="IDX636"></A>
<P><STRONG>Function</STRONG>
<P>
Reads an image from an image file.
<P><STRONG>Syntax</STRONG>
<PRE><STRONG>
image</STRONG> = ReadImage(<STRONG>name, format, start, end, delta, width, height</STRONG>);
</PRE>
<P><STRONG>Inputs</STRONG>
<BR>
<TABLE BORDER>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Name
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Type
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Default
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">Description
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>name</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">"image"
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">file name
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>format</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">"rgb" or input
dependent
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">file format
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>start</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">integer
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">first frame
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">first movie frame
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>end</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">integer
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">last frame
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">last movie frame
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>delta</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">integer
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">1
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">delta of images to be read
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>width</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">integer
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">input dependent
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">width of image
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>height</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">integer
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">input dependent
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">height of image
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>delayed</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">environment dependent
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">use delayed colors if present in
file
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>colortype</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">environment dependent
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">data type for colors
</TD></TR></TABLE>
<P><STRONG>Outputs</STRONG>
<BR>
<TABLE BORDER>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Name
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Type
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Description
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%"><TT><STRONG>image</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">image or image series
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">resulting image
</TD></TR></TABLE>
<P><STRONG>Functional Details</STRONG>
<P>
This module supports four basic file formats: RGB and TIFF (Tag Image
File Format),
GIF (Graphics Interchange Format), and MIFF.
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B><TT><STRONG>name</STRONG></TT>
</B></TD><TD><P>is the name of the image file.
<P>
If <TT><STRONG>name</STRONG></TT> contains a series, the parameters
<TT><STRONG>start</STRONG></TT>, <TT><STRONG>end</STRONG></TT>, and
<TT><STRONG>delta</STRONG></TT> can be used to read a
subset of the images (see parameter
descriptions).
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>format</STRONG></TT>
</B></TD><TD><P>specifies the format of the image file.
This parameter is not required if <TT><STRONG>name</STRONG></TT> includes a
file extension defining the format (see following table).
If <TT><STRONG>name</STRONG></TT> is specified without the appropriate
extension, then the file format must be specified.
If <TT><STRONG>format</STRONG></TT> is specified as "rgb," and
<TT><STRONG>name</STRONG></TT> is "image," the module
will first try to open image.rgb.
If that fails, it will then try to open image.
<BR>
<TABLE BORDER>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">File Type
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">Format Specifier
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">Expected File Extension(s)
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">Multiframe/Series Data
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">RGB
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">"rgb"
<BR>
"r+g+b"
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">.rgb and .size
<BR>
.r,
.g,
.b,
.size,
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">Yes
</TD></TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">TIFF
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">"tiff"
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">.tiff
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">Yes
</TD></TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">MIFF
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">"miff"
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">.miff
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">Yes
</TD></TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">many different</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">"ImageMagick supported format"</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="29%">many different</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="21%">First frame only</TD>
</TR>
</TABLE>
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>start</STRONG></TT>
and <TT><STRONG>end</STRONG></TT>
</B></TD><TD><P>specify the first and last frame to be read from an image file
containing a series.
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>delta</STRONG></TT>
</B></TD><TD><P>specifies the increment in counting the frames in the range from
<TT><STRONG>start</STRONG></TT> to <TT><STRONG>end</STRONG></TT>.
For example, if the first and last frames are 10 and 20 respectively,
and <TT><STRONG>delta</STRONG></TT> = 2, the output
(<TT><STRONG>image</STRONG></TT>) is a series group
with six members (indexed from 0 to 5).
Frame numbers (10, 12,..., 20 in this example) are preserved as the
series position number.
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>width</STRONG></TT>
and <TT><STRONG>height</STRONG></TT>
</B></TD><TD><P>are used only for RGB format files.
The module obtains information about the size and number of images from
<TT><STRONG>name.size</STRONG></TT>, an ASCII file containing the string
"<VAR>w</VAR>×<VAR>h</VAR>×<VAR>f</VAR>," (where <VAR>w</VAR>
and <VAR>h</VAR> are pixel width and height of image
respectively, and <VAR>f</VAR> is the number
of frames).
<P>
If the <TT><STRONG>.size</STRONG></TT> file is not available, then
<TT><STRONG>width</STRONG></TT> and <TT><STRONG>height</STRONG></TT>
can be used to specify the size of the image(s).
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>delayed</STRONG></TT>
</B></TD><TD><P>specifies whether ReadImage should create a "delayed color"
image if the image file is stored in an "image with colormap"
format. By default, ReadImage will create a "delayed color" image
if possible, unless the environment variable <TT>DXDELAYEDCOLORS</TT>
is set to 0, or the <TT><STRONG>delayed</STRONG></TT> parameter is set to 0.
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>colortype</STRONG></TT>
</B></TD><TD><P>specifies whether the colors in the image should be byte or
floating
point. By default, ReadImage will create byte colors unless the
<TT>DXPIXELTYPE</TT> environment variable is set to DXFloat, or
<TT><STRONG>colortype</STRONG></TT> is set to "float".
</TD></TR></TABLE>
<P><B>Notes: </B>
<OL>
<P>
<LI>RGB format files can be either "rgb" or
"r+g+b."
The file format "rgb" contains the image with the bytes for the
red, green, and blue values interleaved.
An alternate file format is "r+g+b," where three output
files contain the non-interleaved image:
"<TT><STRONG>name.r</STRONG></TT>,"
"<TT><STRONG>name.g</STRONG></TT>," and
"<TT><STRONG>name.b</STRONG></TT>."
<p></p>
<LI>
TIFF format files must be either full color RGB images (TIFF Class R)
or palette color RGB images (TIFF Class P), uncompressed
("Compression=1"), and interleaved
("PlanarConfiguration=1").
If the extension is not part of the name, the format must be set to
"tiff."
Information about the size of the image is obtained from the file
itself, since TIFF files are self-describing.
(For more information on file formats, see
<A HREF="refgu173.htm#HDRWRITEIM">WriteImage</A>.)
<p></p>
<LI>With the <A HREF="http://www.imagemagick.org">ImageMagick<FONT SIZE="-2"><SUP>TM</SUP></FONT></A> libraries configured and compiled with DX, ReadImage can read and write a large number of image file formats. ImageMagick is a robust collection of tools and libraries to read, write, and manipulate an image in many image formats (over 68 major formats) including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. The formats that can be read by ReadImage will depend on what functionality is compiled into ImageMagick. The ImageMagick option supports:<BR>
<BR>
<UL>
<LI TYPE="disc">creating opacities/opacity map components for images which have opacities or a transparency map, such as the GIF format and PNG format,
<LI TYPE="disc">both delayed and direct color images, with delayed->direct option and float/byte option,
<LI TYPE="disc">smart chomping of supported ImageMagick extensions
<LI TYPE="disc">the DX convention for reading multi-frame multi-file sequences; such as name="t.gif", where the image files are t.0.gif, t.1.gif, t.2.gif, ...,
<LI TYPE="disc">for multi-frame single-file images such as animated GIFs, stacked TIFF/PNGs, but only loading the first image is supported (ImageMagick is missing basic sub-image support; see the source comments for details).
</UL>
<p></p>
<LI>If you do not specify the environment variable <TT>DXPIXELTYPE</TT> as "DXFloat", ReadImage will create byte colors internally. This will result in reduced storage required for the image, and will only affect networks that require the colors to be of type float, in which case the ReadImage parameter "colortype" should be set to "float", or the <TT>DXPIXELTYPE</TT> environment variable should be set to "DXFloat".
<P></P>
<LI>ReadImage will also maintain the delayed color status of an image, as will be the case for GIF, some TIFF, and some MIFF format files. If the visualization program requires full colors for each pixel, set the ReadImage "delayed" parameter to false (0) or set the environment variable <TT>DXDELAYEDCOLORS</TT> to 0.
<P></P>
<LI>If you want to convert an image file that does not already have delayed colors to one that does, use ReadImage to load it in and then use QuantizeImage to make it delayed color.
</OL>
<P><STRONG>Components</STRONG>
<P>
Creates an output with "positions," "connections," and
"colors" components.
<P><STRONG>Example Visual Programs</STRONG>
<PRE>
ReadImage.net
UsingFilter.net
</PRE>
<P><STRONG>See Also</STRONG>
<P>
<A HREF="refgu173.htm#HDRWRITEIM">WriteImage</A>
<P>
<HR>
<DIV align="center">
<P><A href="../allguide.htm"><IMG src="../images/foot-fc.gif" width="94" height="18" border="0" alt="Full Contents"></A> <A href="../qikguide.htm"><IMG src="../images/foot-qs.gif" width="94" height="18" border="0" alt="QuickStart Guide"></A> <A href="../usrguide.htm"><IMG src="../images/foot-ug.gif" width="94" height="18" border="0" alt="User's Guide"></A> <A href="../refguide.htm"><IMG src="../images/foot-ur.gif" width="94" height="18" border="0" alt="User's Reference"></A></P>
</DIV>
<DIV align="center">
<P><FONT size="-1">[ <A href="http://www.research.ibm.com/dx">OpenDX Home at IBM</A> | <A href="http://www.opendx.org/">OpenDX.org</A> ] </FONT></P>
<P></P>
</DIV>
<P></P>
</BODY></HTML>
|