home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / graphics / visualiz / 1973 < prev    next >
Encoding:
Text File  |  1993-01-07  |  19.8 KB  |  388 lines

  1. Newsgroups: comp.graphics.visualization
  2. Path: sparky!uunet!mcsun!sun4nl!ruuinf!prisma.cv.ruu.nl!rvloon
  3. From: rvloon@cv.ruu.nl (Ronald van Loon)
  4. Subject: Re: SDSC Image Tools and PBM Plus
  5. Originator: rvloon@triton.cv.ruu.nl
  6. Sender: usenet@cv.ruu.nl (Usenet Network)
  7. Message-ID: <1993Jan7.115559.14760@cv.ruu.nl>
  8. Date: Thu, 7 Jan 1993 11:55:59 GMT
  9. References: <1ifpdeINN2ov@network.ucsd.edu>
  10. Nntp-Posting-Host: triton.cv.ruu.nl
  11. Organization: University of Utrecht, 3D Computer Vision Research Group
  12. Lines: 374
  13.  
  14. In <1ifpdeINN2ov@network.ucsd.edu> nadeau@sdsc.edu (Dave Nadeau,,45062) writes:
  15.  
  16. |"1.  The SDSC Image Tools were designed as a C function library rather than
  17. |"    a set of independent tools, such as the PBMPlus package.  Using a function
  18. |"    library, image manipulation algorithms are encapsulated into generic
  19. |"    functions maintained in a central location.  Tool programmers are able to
  20. |"    quickly write new tools by simply calling library routines.  Tool source
  21. |"    is kept small and succinct.  If bugs are found in the underlying
  22. |"    library's image algorithm, the bug is fixed in one place and all tools
  23. |"    using that routine are relinked.  No tool source modification is required.
  24.  
  25. PBMPLUS also has libraries that help write new PBMPlus formats; the pbm, pgm,
  26. ppm and pnm libraries.
  27.  
  28. |"  In a non-library-oriented package, such as PBMPlus, new tools are written
  29. |"  by copying image manipulation code from prior tools.  If the original code
  30. |"  has a bug in it, so does the new tool.  Fixing such a bug requires searching
  31. |"    through all tools looking for copies of the original algorithm, updating
  32. |"    that source, recompiling and relinking.  The hassles of such an approach
  33. |"    are the prime reasons we have function libraries of any kind, such as the
  34. |"    standard C library, the math library, and so on.  One algorithm.  One copy
  35. |"    of the code.  One place to go to fix bugs.
  36.  
  37. One place - yes, maybe; what happens is that people will go and create copies
  38. of the library, because fixing bugs introduce new ones, and people tend to
  39. stick with what they know rather than trust something new.
  40.  
  41. [ SDSS: uses library for standard filling operations 
  42.   PBM+: has program;
  43.  
  44.   Programmer supposedly has to clone the code multiple times ]
  45.  
  46.  
  47. No. The programmer can take the code from PBMPlus (as source is available) and
  48. create his own library. Difference is that PBMPlus, as it provides source and
  49. an easy to manipulate format, leaves it up to the programmer to use either its
  50. fill function or a programmer supplied one. It is short-sighted to think that
  51. programmers would not be able to do so. The difference with your package is
  52. that you have made the decision on what fill algorithm to use, in other words,
  53. it is you who made the decision to take whatever code and put it in a library,
  54. thus saving the programmer the trouble.
  55.  
  56. |"2.  All SDSC Image Tools can read and write all of our supported image
  57. |"    file formats.  This is another direct result of encapsulating file format
  58. |"    handling within generic library functions.
  59.  
  60. [ examples of how to do this deleted ]
  61.  
  62. It also leads to huge executables, when shared libraries are not available; 
  63. even if the program only reads one format ever, it still has the code for all
  64. the other formats in its executable! 
  65.  
  66. |"    With PBMPlus, however, "pbm" tools only read PBM bitmaps, "pgm" tools only
  67. |"    read PGM grayscale images, and "ppm" tools only read PPM RGB images.
  68. |"    Fortunately, a combined set of "pnm" tools have been added that can
  69. |"    read PBM, PGM, or PPM files.  This would be more cool, however, if there
  70. |"    were actually "pnm" tools for all functionality available in the older
  71. |"    "pbm", "pgm", and "ppm" tools.  However, some functionality only exists
  72. |"    in "ppm" but not in "pnm", and so on.
  73.  
  74. Keep in mind that PBMPlus is volunteer work; Jef Poskanzer has done a great
  75. job of creating portable software - due to the fact that the format is simple,
  76. and easily extendable, a huge amount of conversion tools are available. The
  77. things you mention are, of course, things to be done, but one lives and
  78. learns; what you suggest will sure be included in PBMPlus, someday.
  79.  
  80. |"    Furthermore, PBMPlus tools that actually do something to images only work
  81. |"    on PBMPlus file formats.  If you want to read any other kind of image, you
  82. |"    first have to convert into one of the PBMPlus formats.  Then if you want
  83. |"    a result in another format, such as for transfer to a Mac or PC, or use
  84. |"    as a texture map in a ray tracer, you have to convert back out of the
  85. |"    PBMPlus formats into what you really wanted in the first place.
  86.  
  87. That's the general idea - rather than dealing with millions of file formats,
  88. one format that is easy to manipulate is used, thus greatly reducing the
  89. amount of code needed. The beauty of the package is by introducing an
  90. intermediary format suddenly the number of converters can be reduced from NxM
  91. (your case) to N+M. A very basic strategy, which can be found in most
  92. introductory courses on computer architecture and compiler writing.
  93.  
  94. |"3. Another natural result of developing the SDSC Image Tools as a C function
  95. |"   library is the ease with which image file handling can be added to existing
  96. |"   tools.  Non-SDSC users have built AVS and Explorer modules using the
  97. |"   SDSC Image Tools library, added image handling support to existing tools,
  98. |"   written windowing system user interfaces for the tools, and so on.
  99.  
  100. Great. The same can be done just as easily for PBMPLUS. I have done so; the
  101. format is so simple, that implementation and use of it is no work at all.
  102.  
  103. |"    At SDSC, we have implemented a generic lpr-based print filter system that
  104. |"    drives a number of computer graphics output devices from any of the
  105. |"    supported image file formats.  For instance, users of the system can queue
  106. |"    images to be printed to slides on a film recorder using:
  107. |"
  108. |"        vpr -Pslides title.rgb frames*.pix credits{1,2,3,4}.ras
  109. |"
  110. |"   There are no hardcopy device-specific file formats.  There is no need to
  111. |"   convert your SGI RGB image to quirky device protocol streams, then
  112. |"   transfer the file over to the specific host that drives the printer, then
  113. |"   invoke printer-specific software to print your image.  Instead, vpr handles
  114. |"   it all.  Images are transferred via lpr to the remote host that drives
  115. |"   the printer.  The lpr daemon invokes a device-specific print filter that
  116. |"   reads in the images, using the Image Tools library, adjusts image colors
  117. |"   appropriately for the device, again using the Image Tools library, and
  118. |"   scales the image up or down to the device resolution, once again using
  119. |"   the Image Tools library.  The final image is written directly to the
  120. |"   device, with communications protocol handled on the spot.
  121.  
  122. Nice. This can also be done by PBMPLUS, by having the program/driver convert
  123. to PBMPLUS format upon arrival. No big deal.
  124. |"
  125. |"  This kind of integration of image file format I/O into existing tools is not
  126. |"  possible using the PBMPlus package.  File format code is distributed all
  127. |"  about into multiple PBMPlus tools.  There is no file format function
  128. |"  library.
  129.  
  130. There is. Check the manual pages pbm(5),pgm(5),ppm(5) and pnm(5). I'll admit
  131. that the documentation could use some work, but hey, what do you expect ? It
  132. is FREE and it has SOURCE.
  133. |"
  134. |"4.  The SDSC Image Tools were designed to support a wide range of image
  135. |"    storage types:  monochrome, grayscale, color indexed (also called
  136. |"    pseudocolor), and RGB (also called truecolor), and images of all these
  137. |"    types that have alpha channels, Z-buffers, and other non-visual pixel
  138. |"    channels.
  139. |"
  140. |"    The PBMPlus tools, however, only support monochrome, grayscale, and RGB
  141. |"    images.  Alpha channels are unsupported and silently stripped from input
  142. |"    files as you convert into the less-functional PBMPlus file formats.  There
  143. |"    is no support whatsoever for color indexed images, such as those used by
  144. |"    non-RGB color graphics displays and most color image file formats.  To
  145. |"    handle a color indexed image, PBMPlus converts it to RGB.  The color table
  146. |"    is applied to the color indexes and then tossed.  The "indexed-ness" of
  147. |"    the original image is lost.  This is unacceptable.
  148.  
  149. Not really; the original can always be regenerated by functions that are
  150. present in the various p*m-libraries.
  151. |"
  152. |"    Consider a scientific data set that has been rendered by mapping different
  153. |"    data values to different color indexes with no two data values sharing the
  154. |"    same color table index.  Data values between 1 and 10, for instance,
  155. |"    map to color indexes 1 to 10.  The color table is then loaded to
  156. |"    illustrate a data classification scheme.  Color table entries 1-5 are
  157. |"    mapped to red, while 6-10 are mapped to blue, and so on.  By simply
  158. |"    changing the color table the scientist can highlight different data items
  159. |"    to detect patterns and anomalies.
  160. |"
  161. |"    But if you map this color indexed image and its data classification color
  162. |"    table to RGB, all color indexes that are red become permanently mapped to
  163. |"    red in the RGB image.  They can never be reclassified.  Data exploration
  164. |"    is impossible.  The color "indexed-ness" of the source image has been
  165. |"    lost and the scientific usefulness of the image has been reduced.
  166.  
  167. Not really a good example, IMHO.
  168.  
  169. |"    If you use PBMPlus, you have no choice because PBMPlus does not support
  170. |"    color indexed images.  The SDSC Image Tools do.
  171.  
  172. Nice. As you have the source of PBMPLUS, you could define your own extension
  173. to it, then mail your changes to Jef, so the whole world could benefit.
  174.  
  175. |"    xwdtopnm input.xwd | pnmtoxwd > output.xwd
  176. |"
  177. |"    Format readers parse the input file and drop tags and values into the
  178. |"    tag table.  Format writers scan the tag table for items relevant for the
  179. |"    output format and write them out.  The XWD reader, for instance, reads
  180. |"    in the image window name and drops it into the tag table along with the
  181. |"    image pixels and color table.  The Sun rasterfile RAS writer scans the
  182. |"    tag table for images and color tables and writes them out, but it ignores
  183. |"    the image window name because the RAS format does not support image names.
  184. |"    The XWD writer, on the other hand, does pick out the image name from the
  185. |"    tag table and write it out to the output format.  It all depends upon the
  186. |"    abilities and limitations of the output file format.  The SDSC Image Tools
  187. |"    do not arbitrarily limit image data to those things that fit into an
  188. |"    intermediate file format.
  189.  
  190. Of course they do; they limit image data to have the arbitrarily limits of the
  191. resulting data-type.
  192.  
  193. |"6.  The SDSC Image Tools and PBMPlus both support a wide range of image file
  194. |"    formats.  The following is a list of those formats.  The first column is
  195. |"    the source or vendor sponsoring the file format and the second column is
  196. |"    the most common name for the format.  Columns three and four indicate
  197. |"    whether the format has read (R), write (W), or both (RW) support in the
  198. |"    PBMPlus or SDSC Image Tools packages.  A blank in these columns means the
  199. |"    format is not supported in that package.  Formats have been roughly
  200. |"    grouped by the type of image data they can store.
  201. |"
  202. [ list deleted ]
  203. |"
  204. |"    PBMPlus support is strongest for monochrome and grayscale file formats
  205. |"    used on PCs, Ataris, Macs, and other low-end systems.  PBMPlus also
  206. |"    focuses on smaller software packages (like QRT and MTV), games and
  207. |"    cute programs (like PUZZ, and FS), and printer device protocol files
  208. |"    (like PTX and EPSON).
  209. |"
  210. |"    The SDSC Image Tools instead concentrate on high-end systems and high-end
  211. |"    color formats, such as Alias PIX, Wavefront RLA, Khoros VIFF, NCSA HDF,
  212. |"    Sun TAAC IFF, PIXAR PIC, AVS X, and SGI RGB.  These file formats dominate
  213. |"    the high-end workstation graphics world and are those we found ourselves
  214. |"    most in need of during scientific visualization and animation work.
  215. |"    PBMPlus supports none of these.
  216.  
  217. I am sorry; PBMPlus does not need to support these - those packages support
  218. PBMPlus! By taking an attitude of 'we don't need these low-end formats anyway'
  219. you first of all are arrogant - let the user decide what he wants if possible,
  220. not you ! - and second of all, it is easy to write additional converters for
  221. PBMPLUS (you have done so yourself).
  222. |"
  223. |"    PBMPlus image file format support is also strangely sparse.  Some formats
  224. |"    can only be read, but not written.  Other formats can only be written,
  225. |"    but not read.
  226.  
  227. This is due to the nature things get contributed to PBMPLUS: different people
  228. all over the world have contributed to the package. Some of the stuff is well
  229. written, others less so. PBMPLUS is not actively supported by people who get
  230. paid to do so.
  231.  
  232. |"    The SDSC Image Tools support read and write handlers for all supported
  233. |"    file formats, except PostScript and EPS.  These formats are written
  234. |"    but not read.  To read PostScript or EPS files properly requires the
  235. |"    implementation of a full PostScript interpreter and is well beyond
  236. |"    the scope of this project.
  237.  
  238. Besides, it already exists in the form of GhostScript.
  239. |"
  240. |"7.  Image file format conversion in the PBMPlus package is done with a
  241. |"    collection of ** 87 ** separate tools!  To read a Sun Rasterfile, use
  242. |"    "rasttopbm" or "rasttoppm" or "rasttopnm".  To write it back out again,
  243. |"    use "pbmtorast" or "ppmtorast" or "pnmtorast".  That's 6 tools for just
  244. |"    one file format.
  245.  
  246. Nope. That's 6 *functions* for *3* formats - those formats you mention are not
  247. the same. You have to do something similar to put those in a library.
  248.  
  249. |"    The prime tool for image file format conversion in the SDSC Image Tools
  250. |"    is "imconv", which supports all 30+ formats within 1 tool, not 87.
  251.  
  252. The size of which is considerably more than the 87 tools together. Remember,
  253. it is not size or quantity - it is quality! 
  254.  
  255. |"8.  The SDSC Image Tools are implemented atop a binary I/O package that
  256. |"    portably handles reading and writing binary data to files, streams, and
  257. |"    data arrays.  Such a package is absolutely necessary in order to handle
  258. |"    differences in byte order, word size, floating point format, and structure
  259. |"    padding.  The use of such a binary I/O package has allowed us to port the
  260. |"    Image Tools, without any change of higher-level code, to a dozen
  261. |"    architectures, including Suns, SGIs, DEC hosts, and even our Cray Y-MP.
  262. |"
  263. |"    The PBMPlus package is not implemented with portability in mind.  There
  264. |"    are numerous instances within the code where byte order or word size
  265. |"    is assumed.  Such code will not work on a Cray, for instance.
  266.  
  267. The PBMPlus package did have portability in mind - the p*m-libraries allow you
  268. to read and write binary data in a portable way. The people who contributed to
  269. PBMPLUS may have chosen to not use those. That's unfortunate.
  270. |"
  271. |"9.  The SDSC Image Tools were designed to have a consistent and intuitive user
  272. |"    interface.  All tools have -help arguments to display on-line help
  273. |"    information distilled from the full man pages.  Argument parsing is
  274. |"    consistent throughout the package.
  275.  
  276. Argument parsing can be done consistently in PBMPLUS, the facilities are
  277. there; again, people chose to use their own when contributing, rather than
  278. using the provide facilities. It's a matter of attitude: people who use your
  279. library are not in any way restricted to use the routines you provide, are
  280. they ?
  281.  
  282. |"   PBMPlus tools, however, use a mish-mash of command-line argument styles and
  283. |"   virtually never have on-line help.  Man pages are sparse and almost never
  284. |"   include usage examples.  The following, for instance, is the entire
  285. |"   PBMPlus man page for the "icontopbm" converter for the Sun icon file format:
  286.  
  287. A non example. As said, you have the means and manpower to write this
  288. documentation and are probably even *required* to do so. PBMPLUS is volunteer
  289. work. A free, spare-time kind of project. Invest dollars and it will improve.
  290.  
  291. |"  The SDSC Image Tools man page on the Sun icon format takes three pages.
  292.  
  293. I am not impressed.
  294.  
  295. |"And so on.  There are significant differences between the SDSC Image Tools
  296. |"and the PBMPlus package.  Let us return to the net posting that sparked this
  297. |"discussion:
  298. |"
  299. |"    >Don't forget pbmplus *is* available in source code and does 99 percent
  300. |"    >of what imconv does (and often does it faster!).  It's available with
  301. |"    >the X11 distribution in the contrib directory or from your favorite
  302. |"    >FTP site (wuarchive.uwstl.edu comes to mind).
  303. |"
  304. |"-  PBMPlus clearly does *not* do 99% of what the SDSC Image Tools do.
  305.  
  306. Ah, a matter of pride :-).
  307. |"
  308. |"-  PBMPlus is not faster.  It couldn't be.  To do anything in it you first
  309. |"   have to convert your image file to one of the PBMPlus file formats.  Then,
  310. |"   after doing your task, you have to convert back out again into the format
  311. |"   you really want your result in.  At a minimum this requires two extra file
  312. |"   reads and two extra file writes.
  313.  
  314. No. Ever heard of pipes ? After all, we are talking high-end machines here!
  315. |"
  316. |"   For example, to rotate an 8-bit Sun Rasterfile by 45 degrees, you must do
  317. |"   the following operations in PBMPlus:
  318. |"
  319. |"    rasttopnm file.ras > file.pnm        -- RAS to PNM
  320. |"    pnmrotate 45.0 file.pnm > rfile.pnm    -- Rotate by 45
  321. |"    ppmquant 256 rfile.pnm > r256file.pnm    -- Reduce to 256 colors
  322. |"    pnmtorast r256file.pnm > rfile.ras    -- PNM to RAS
  323.  
  324. this of course is:
  325.  
  326. rasttopnm file.ras | pnmrotate 45.0 | ppmquant 256 | pnmtorast >rfile.ras
  327.  
  328. Where are the intermediate files ? I don't see any...
  329.  
  330. |"   The "ppmquant" is necessary because the rotated image will have more than
  331. |"   256 colors (an artifact of the rotation algorithm).  Calling "pnmtorast"
  332. |"   on an image with more than 256 colors generates an RGB RAS file, not an
  333. |"   8-bit RAS file suitable for display on a SPARCstation.  So, if we want an
  334. |"   8-bit RAS file, we first have to quantize the image back down to 256 colors.
  335.  
  336. No, you should use Xloadimage instead.
  337. |
  338. "
  339. |"   This same task may be accomplished using the SDSC Image Tools:
  340. |"
  341. |"    imrotate file.ras -rot 45.0 -outindex rfile.ras
  342. |"
  343. |"   These operations were timed using an 8-bit 512x480 Sun Rasterfile of the
  344. |"   standard Mandrill.  File I/O was to and from local disk on a Sun
  345. |"   SPARCstation 2.
  346. |"
  347. |"            Execution Times (in seconds)
  348. |"            Real    User    Sys
  349. |"            ----    ----    ---
  350. |"    PBMPlus        95.9    90.7    3.0
  351. |"    Image Tools    11.5    10.7    0.5
  352. |"
  353. |"   On this operation, the SDSC Image Tools accomplished the task 8.3 times
  354. |"   faster than PBMPlus.
  355.  
  356. Apples and Oranges. 
  357.  
  358. |"
  359. |"- Version 2.1 of the SDSC Image Tools are available via anonymous ftp from
  360. |"   "ftp.sdsc.edu".  Tool source code is included.  Library source code is not.
  361. |"
  362. |"- Version 2.1 of the SDSC Utilities library, including the binary I/O package,
  363. |"  argument parsing package, and tag table package are also available via
  364. |"  anonymous ftp from "ftp.sdsc.edu".  Library source code is not included.
  365. |"
  366. |"Thank you.
  367.  
  368. Reading your article, you apparently feel the need to 'defend' yourself
  369. against PBMPLUS, either because you feel your package is not so great after
  370. all, or for some other reason. Furthermore, you make a number of claims in a
  371. condescending, ivory tower sort of way (by using phrases like 'high-end
  372. systems', 'PBMPLUS can't do this, while', 'even our CRAY-1'). You should
  373. consider yourself lucky to work on a package and get paid (I suppose you get
  374. paid). Comparing PBMPLUS and SDSS is not really useful: PBMPLUS is freely
  375. available, widely used, easy to extend. No need to learn how to do it, it's
  376. that simple! PBMPLUS utilities in our group are widely used, noone ever
  377. complained that features were missing.
  378.  
  379. Next time, a more objective comparison would be a lot nicer and increase your
  380. credibility.
  381.  
  382. Regards,
  383. -- 
  384. Ronald van Loon     | Consider this: In the United States, an automobile is
  385. (rvloon@cv.ruu.nl)  | stolen EVERY 14.7 SECONDS. 
  386. 3DCV Group, Utrecht |   If that statistic scares you, think how we felt when we 
  387. The Netherlands     | made it up. - Dave Barry, "CHRISTMAS BUYERS GUIDE"
  388.