[kepler-dev] Problem with ImageReader actor

Daniel Higgins higgins at nceas.ucsb.edu
Wed Jul 21 14:43:12 PDT 2004


Hi Christopher,
 
    Perhaps you can pass this message on the the appropriate person in 
the Ptolemy group.

    I ran into a problem using the ImageReader actor in PTII4.0. I 
created a workflow (using 'R') which created an image file (jpeg) and 
then used the ImageReader and ImageDisplay actor to display this image. 
This works just fine the first time the workflow is executed. But if I 
change an input parameter, the workflow creates a new image file (with 
the same name as the first run), but the OLD IMAGE (original image) is 
displayed even though the contents of the file has changed on my disk! 
The new file will not appear until I shut down PT and restart it! [A key 
point is that the file name has not changed.]

    After some frustrating investigation, I discovered that the problem 
seems to be related to how Java handles images. Apparently image data is 
cached and not reloaded unless you call the 'flush()' method on the 
image object. I just added the line

        _image.flush();

to the 'fire' method in ptolemy/actor/lib/image/ImageReader after the 
'output.broadcast(new AWTImageToken(_image));' line and the problem got 
fixed!  :-) Apparently this forces the image to be reloaded even when 
the file name has not been changed. There may be a better place to put 
this fix; you may want to insert it somewhere before the next PT bug 
release.

Dan

-- 
---------------------------------
Dan Higgins
Software Developer
National Center for Ecological Analysis and Synthesis (NCEAS) 
735 State St. Rm 205 
Santa Barbara, CA 93101 
805-892-2531 
higgins at nceas.ucsb.edu 
---------------------------------




More information about the Kepler-dev mailing list