home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / imagetoo / imagtlc2.asc < prev    next >
Text File  |  1992-07-17  |  16KB  |  474 lines

  1. 3.1    NCSA ImageTool
  2.  
  3.  
  4. Animation, Palettes, and Plots    3.1
  5.  
  6. National Center for Supercomputing Applications
  7.  
  8. January 1991
  9.  
  10.                                                                 
  11.  
  12.  
  13.  
  14.  
  15. 3.1    NCSA ImageTool
  16.  
  17.  
  18. Animation, Palettes, and Plots    3.1
  19.  
  20.  
  21.  
  22.  
  23. Chapter 3    Animation, Palettes, and Plots
  24.  
  25.  
  26.  
  27. Chapter Overview
  28. Animation
  29. Starting Animation
  30. Animation Controls
  31. Virtual Memory Animation
  32. FTP Options
  33. Connect
  34. Get Loop
  35. Disconnect
  36. Color Palette Support
  37. Color Palettes
  38. Loading Palettes
  39. Modifying Palettes
  40. Saving Modified Palettes
  41. Restoring the Palette
  42. Displaying the Palette
  43. Plots
  44. XY Graphs
  45. Mouse Usage for Making Selections
  46. Contour Plots
  47. 3D Plots
  48.  
  49. Chapter Overview
  50.  
  51. This chapter covers more advanced display options in NCSA 
  52. ImageTool, including animation, palette modification, and plots. 
  53.  
  54.  
  55. Animation
  56.  
  57. Animation is an integral part of NCSA ImageTool. The program 
  58. uses the information in the text fields of the Control window for 
  59. loading animation images, just as it does for individual images. 
  60. In most cases, the file specification matches more than one file.
  61.  
  62. NCSA ImageTool displays the animation sequence at the origin 
  63. point of the canvas. If the file specification does not match any 
  64. files, the file sizes conflict with the dimensions, or some type of file 
  65. error occurs during animation, an error message is displayed in 
  66. the Message window. 
  67.  
  68.  
  69. Starting Animation
  70. Located under the Image menu is the Animate submenu 
  71. (Figure 3.1). The submenu contains the default option, Regular 
  72. size, and a Zoom (2X) option which initially magnifies individual 
  73. frames by a factor of two in each direction. 
  74.  
  75. Figure 3.1    Animate Submenu
  76.                
  77.  
  78.  
  79. NOTE:  Besides selecting animation size from the Animate 
  80. submenu, you can also initiate a regular size animation from the 
  81. Image text field by pressing CONTROL-A at the end of the file 
  82. specification.
  83.  
  84.  
  85. Animation Controls
  86. When you select an animation type, five new buttons appear in the 
  87. Control window. They are labeled Pause, Last, Next, +, and -. Use 
  88. the left button to activate these control buttons.
  89.  
  90.  
  91. Pause Button
  92. The Pause toggle temporarily stops the animation. You will want 
  93. to pause the animation when you want to perform some other 
  94. operation on the images; i.e., magnifying the image, loading an 
  95. alternative palette, etc. 
  96.  
  97.  
  98. Last and Next Buttons
  99. While also in pause mode, you can use the Last and Next buttons to 
  100. sequence through images. 
  101.  
  102. + and - Buttons
  103. The + and - buttons control the animation speed, speeding it up or 
  104. slowing it down, respectively.
  105.  
  106.  
  107. Cancel
  108. Cancel quits the animation mode. 
  109.  
  110.  
  111. Virtual Memory Animation
  112. If all of the images for an animation do not fit in the available 
  113. physical memory, the images are swapped out to disk until they are 
  114. needed. This transfer creates a great deal of network traffic if 
  115. your disk is mounted on the network, and a great deal of disk I/O 
  116. activity in any case, often causing mouse tracking to slow down. If 
  117. this happens, you can click the Pause button, then perform any 
  118. necessary action such as slowing down the animation or 
  119. canceling the operation.
  120.  
  121.  
  122. FTP Options
  123.  
  124. Further expanding the animation options of NCSA ImageTool is 
  125. its built-in network communications capabilities. By using the 
  126. FTP (File Transfer Protocol) menu (Figure 3.2), you can connect 
  127. to a remote machine and grab images as they are being created.
  128.  
  129. Figure 3.2    FTP Menu
  130.            
  131.  
  132.  
  133. Connect
  134. Before you can transfer images from a remote machine, you must 
  135. establish a connection to the machine generating or containing the 
  136. images. To do so:
  137.  
  138. 1.    Select Connect from the FTP menu. A dialog box prompts you for 
  139. the name of the host machine. 
  140.  
  141. 2.    Enter the name of the host in the text field labeled Host name. 
  142.  
  143. 3.    Click the OK button to continue. 
  144.  
  145. Text in the tty window describes the file transfer. The messages 
  146. displayed vary from system to system. This is an example of what 
  147. you might see in the tty window:
  148.  
  149. ftp cray
  150. Connected to cray
  151. 220-cray FTP Server. Report Problems to ajc@uxc.cso.uiuc.edu
  152. Name (cray:redman):
  153.  
  154.  
  155. 4.    Enter the appropriate user name for the remote machine at the 
  156. Name prompt. 
  157.  
  158. 5.    Enter the password, if necessary, and possibly an account or 
  159. other necessary codes. 
  160.  
  161. After entering all of the required information, you should see a 
  162. message that looks like this:
  163.  
  164. 230 Logged in.
  165.  
  166.  
  167. If a message like this does not appear, it may be necessary to re-
  168. enter the user name and password. If this message does appear, the 
  169. connection is successful, and you may continue to perform one of 
  170. the other operations from this menu. FTP runs in the tty window. 
  171. Use the FTP commands available on your machine to change 
  172. directories on the remote machine, change options, and so on.
  173.  
  174.  
  175. Get Loop
  176. Once the connection is established, you can use the Get loop option. 
  177. Get loop transfers the file whenever it becomes available. The 
  178. images are displayed in the form of an animation sequence on the 
  179. canvas as they are acquired.
  180.  
  181. Select Get loop from the FTP menu and a dialog box  appears. The 
  182. images' filenames are expected to end with a string of digits such 
  183. as denap009. This naming scheme is useful for sequencing 
  184. animation images. 
  185.  
  186. Specify an increment in the dialog box. This increment is added to 
  187. the image filename to create the filename for the subsequent frame 
  188. in the sequence. The next field, labeled Interval (sec), specifies the 
  189. maximum allowable time to complete the file transfer. FTP times 
  190. out if the transfer is not complete in this period of time. If images 
  191. are large, you may need to increase this value in order to avoid 
  192. timing out in the process of transferring the files. Zoomed image 
  193. has two settings: on and off. If it is on, the images are magnified 
  194. by a factor of two before being displayed.
  195.  
  196. The filename in the Image text field of the control panel specifies 
  197. the first file to be transferred. The next file to be obtained is 
  198. determined automatically by NCSA ImageTool. The numeric 
  199. suffix on the original filename is incremental by the amount that 
  200. you specified in the Increment field of the dialog box. The name in 
  201. the Image field changes to the name of the file presently displayed.
  202.  
  203. This process continues until you select Stop from the FTP menu.
  204.  
  205.  
  206. Disconnect
  207. Select Disconnect from the FTP menu to close the connection with 
  208. the host machine. Select Stop to cancel the Get loop option before you 
  209. disconnect.
  210.  
  211.  
  212. Stop
  213. This option cancels the Get loop operation. In the tty window, a 
  214. message is displayed such as:
  215.  
  216. Get loop stopped
  217.  
  218.  
  219. If you do not cancel the Get loop option before disconnecting, NCSA 
  220. ImageTool continues to try to receive images, unsuccessfully.
  221.  
  222.  
  223. Color Palette Support
  224.  
  225. NCSA ImageTool supports using, modifying, and creating color 
  226. palettes. You can load, change, and save color palettes. For 
  227. detailed information on the file format of color palette files, see the 
  228. section, "File Formats," in Chapter 2.
  229.  
  230.  
  231. Color Palettes
  232.  
  233. The Sun Workstation can display 256 colors from a palette of over 
  234. 16 million colors. You can change most of the 256 colors to any one 
  235. of the other available colors. Some entries are reserved by the 
  236. system and cannot be used by NCSA ImageTool. The first four 
  237. entries in the color palette are used for foreground and background 
  238. colors, window colors, and text.
  239.  
  240.  
  241. Loading Palettes
  242. You can use palette files to initialize your Sun Workstation's 
  243. hardware color table. The section, "File Formats," in Chapter 2 
  244. describes the file format. To load a new color palette, select Load 
  245. from the Palette menu (Figure 3.3). 
  246.  
  247. Figure 3.3    Palette Menu
  248.             
  249.  
  250.  
  251. NCSA ImageTool tries to read colors from the file entered in the 
  252. Control window's Palette text field. If the filename does not end in 
  253. .pal, the program automatically appends .pal to the filename. If 
  254. NCSA ImageTool can't find this file cannot be found, an error 
  255. message appears in the Message window. Otherwise, the color 
  256. hardware is initialized using the colors from the palette file.
  257.  
  258. Alternately, to directly load the palette from the Palette text field, 
  259. press CTRL-L at the end of the palette filename.
  260.  
  261.  
  262. Modifying Palettes
  263. You can alter the currently active palette using NCSA ImageTool's 
  264. palette editing capabilities:  Contour, Fiddle, and Transpose. 
  265. Selecting either Contour or Fiddle switches to a mode Contour and 
  266. to have a special effect. To exit either of these modes, click the right 
  267. mouse button.
  268.  
  269.  
  270. Contour Mode
  271. Using the contour mode, you can set entries in the palette to white. 
  272. To use contour mode:
  273.  
  274. 1.    Select Contour from the Palette menu. 
  275.  
  276. 2.    Select a contouring functions by clicking the left or middle 
  277. mouse button in the Canvas area.
  278.  
  279. 3.    Depress the left mouse button to set the color under the mouse on 
  280. the Canvas to white. Alternatively, move the mouse off of that 
  281. point to restore its color. 
  282.  
  283. 4.    Release the mouse button to permanently set the color under the 
  284. mouse to white. 
  285.  
  286. To use the color initially under the cursor, instead of white:
  287.  
  288. 1.    Hold down CTRL when you press the left mouse button. While 
  289. the middle mouse button is pressed, NCSA ImageTool clears 
  290. randomly selected colors and leaves others in place. This 
  291. creates a contouring effect.
  292.  
  293.  
  294. Fiddle Mode
  295. The fiddle mode reduces or expands the range of the spectrum in 
  296. the color palette, depending on the mouse location on the Canvas. 
  297. To manipulate the palette:
  298.  
  299. 1.    Depress the left button. 
  300.  
  301. 2.    Move the mouse toward the top of the Canvas to expand the 
  302. spectrum. 
  303.  
  304. 3.    Move the mouse toward the bottom of the image to reduce the 
  305. range of the spectrum. 
  306.  
  307. 4.    Move the fiddle horizontally to shift the spectrum to the right or 
  308. left. 
  309.  
  310. 5.    Select Transpose from the Palette menu to flip the color palette. 
  311. After flipping the palette, the mouse buttons operate normally.
  312.  
  313. Notice also that while you hold down the middle mouse button you 
  314. can rotate the palette in a wrap-around fashion.
  315.  
  316.  
  317. Saving Modified Palettes
  318. After altering a palette, you may want to save it for future use by 
  319. selecting Save from the Palette menu. A dialog box appears. Use 
  320. the text field labeled Palette to enter the name for the new palette 
  321. file. Click OK to continue the operation or Cancel to abort.
  322.  
  323.  
  324. Restoring the Palette
  325. Use the Restore option in the Palette menu to restore the palette to its 
  326. original state. Any modifications that you have made since you 
  327. last saved will be lost.
  328.  
  329.  
  330. Displaying the Palette
  331. It may help you to display the palette when in this mode so that you 
  332. can see the effect of your actions. Use the Show option from the 
  333. Palette menu to display a color strip at the origin point on the 
  334. Canvas. Once the colors are displayed, you can remove them by 
  335. selecting Cut or Clear from the Edit menu.
  336.  
  337.  
  338. Plots
  339.  
  340. In addition to using color to display data, NCSA ImageTool also 
  341. provides other plotting capabilities, such as XY graphs, contour, 
  342. and 3D plots.
  343.  
  344.  
  345. XY Graphs
  346. To create a Cartesian graph:
  347.  
  348. 1.    Choose the XY option from the Graph menu (Figure 3.4). 
  349.  
  350. Figure 3.4    Graph Menu
  351.            
  352.  
  353.  
  354. A new frame and window appear, as well as a dialog box.
  355.  
  356. 2.    Fill in the text field first, then enter the minimum and 
  357. maximum horizontal and vertical dimensions into the fields 
  358. labeled Xmin, Xmax, Ymin and Ymax. 
  359.  
  360. 3.    Enter the minimum and maximum data values for the plot in 
  361. the Gmin and Gmax fields. 
  362.  
  363. 4.    Click OK to continue or Cancel to abort the operation. If you 
  364. select OK, the new window remains on the screen. Otherwise, it 
  365. disappears. 
  366.  
  367. If you've selected OK, proceed with the following steps to select a 
  368. slice of the image (on the Canvas) that you would like to have 
  369. plotted.
  370.  
  371. 5.    Depress the left mouse button while dragging the mouse over a 
  372. line of data values you want plotted.
  373.  
  374. 6.    Release the mouse button. A line appears over the area you have 
  375. just drawn across (if one doesn't, try clicking the middle mouse 
  376. button). If the line is not acceptable, redraw the line by repeating 
  377. this process. The previously selected line disappears when you 
  378. start to draw a new one. The data values represented by the 
  379. colors under the line are used for the plot. 
  380.  
  381. 7.    Click the Draw button to plot the points under this line.
  382.  
  383. Notice the other control buttons in the window. Scale specifies the 
  384. values previously entered at the dialog box. Note that the data 
  385. range does not have to be in the range 0 to 255, even though the 
  386. actual data values displayed fall in this range.
  387.  
  388. Clear clears the plot window, Print prints the plot on the postscript 
  389. printer specified using the Options menu, and Done removes the 
  390. window and returns to normal processing. The text field contains 
  391. the text that creates the title of the plot.
  392.  
  393. To produce multiline graphs, draw horizontal or vertical lines 
  394. parallel to one another in the image and select Draw after you 
  395. select each line.
  396.  
  397. NOTE:  If NCSA ImageTool does determine that the lines you've 
  398. drawn are parallel, the XY plot canvas does not clear to draw the 
  399. additional lines; it is drawn over the existing plot.
  400.  
  401.  
  402. Mouse Usage for Making 
  403. Selections
  404. When making contour or 3D plots, you'll often be making 
  405. selections within your images using mouse buttons. The middle 
  406. mouse button drags a selection box; clicking outside of this 
  407. selection cancels the selection. 
  408.  
  409. If instead of clicking outside the box you press the middle mouse 
  410. button inside the box, the cut and paste functions are performed on 
  411. the selection, and you can drag the selected area to a new location 
  412. on the canvas. 
  413.  
  414. Alternately, holding down CTRL and pressing the middle button 
  415. with the mouse inside the selection box performs the copy and paste 
  416. operations simultaneously. 
  417.  
  418. Clicking the right mouse button on the canvas undoes the original 
  419. selection.
  420.  
  421.  
  422. Contour Plots
  423. To create a contour plot:
  424.  
  425. 1.    Select a rectangle from an image to be plotted using the middle 
  426. mouse button. (You can also use the middle button to extend your 
  427. selection area.)
  428.  
  429. 2.    Select Contour from the Graph menu. A window appears that 
  430. displays some buttons and a text field. 
  431.  
  432. 3.    Enter the values at which you would like contour lines to be 
  433. drawn in the Contour levels text field. You can enter as many or 
  434. as few values as you like; the more values you enter, the more 
  435. contour lines you'll see.
  436.  
  437. 4.    Click the Draw button. NCSA ImageTool draws the contour plot 
  438. in the Canvas area of the plotting window. 
  439.  
  440. To clear this Canvas, click the Clear button. (The image remains 
  441. on disk if you have saved it there.) 
  442.  
  443. You can also Print the contour plot to the postscript printer you've 
  444. designated using the Set laser printer default item in the 
  445. Options menu. If you haven't specified a default laser printer, a 
  446. dialog box appears. 
  447. Clicking on Done removes the window and returns to normal 
  448. processing.
  449.  
  450.  
  451. 3D Plots
  452. To create a 3D plot:
  453.  
  454. 1.    Select a rectangle that you would like to plot using the middle 
  455. mouse button. (You can also use the middle button to extend your 
  456. selection area.)
  457.  
  458. 2.    Select the 3D plot option from the Graph menu. A plot window 
  459. appears. 
  460.  
  461. 3.    Enter the yaw, pitch, and roll values in their respective text 
  462. fields. These three elements compose the viewing angle for a 3D 
  463. image. Specifically, yaw is the rotation around the x axis, pitch 
  464. is the rotation around the x axis, and roll is the rotation about the 
  465. z axis. The defaults are 10, 40 and 5, respectively. 
  466.  
  467. 4.    Click Draw to plot the selected rectangle. Click Draw again to 
  468. change the yaw, pitch, and roll and replot the data.
  469.  
  470. Pressing the Clear button clears the plot window's Canvas, while 
  471. the Print button prints the plot to a postscript printer. Clicking Done 
  472. returns NCSA ImageTool to normal operation.
  473.  
  474.