NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 204 - Problem on opening images from the editor and vice versa
Problem on opening images from the editor and vice versa
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Other
unspecified
Macintosh Mac OS
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2010-08-01 17:15 CDT by Thomas Julou
Modified: 2010-09-22 18:17 CDT
0 users

See Also:

Description Thomas Julou 2010-08-01 17:15:31 CDT
Hello,

Among other (numerous) reasons, I am interested in Fiji because of its nice script editor.
Unfortunately I noticed two bugs with it:
 - when the editor is active, the open menu is accessible and works fine to open additional text files (displaid as new tab). However if I select an image, Fiji will try forever to open it without success and basically freeze.

- to the contrary, if one script and one image are already opened, if the image is active and I use the open menu to open another text file, Fiji freezes after opening a new tab. I get a similar freezeif I drag and drop a text file on the status bar while another text file is already opened.

This is with Fiji 1.44d on mac os 10.5.8, Java 1.5.0_24 [64-bit].
Thank you in advance for your help.

Regards,

Thomas Julou
Comment 1 Thomas Julou 2010-08-01 17:16:02 CDT
This may be linked to bug 192… Not sure.
Comment 2 G. Landini 2010-08-01 18:15:18 CDT
You do not specify which "File" menu...

Everything seems to work fine here under linux 64 and Java 1.6.0_20.
I can open an image, with an open macro in the script editor and I could open a further image and a further image from the Samples link.

I wonder if you are trying to open a very large image from the File menu of the Script Editor (which would not be the right thing to do anyway). Just for the record I can open images like that and they are shown as garbled text in a new Script Editor tab.
Comment 3 Thomas Julou 2010-08-02 11:22:43 CDT
(In reply to comment #2)
> You do not specify which "File" menu...

Sorry…

>  - when the editor is active, the open menu is accessible and works fine to
> open additional text files (displaid as new tab). However if I select an image,
> Fiji will try forever to open it without success and basically freeze.

This is with the editor File menu. I agree I should not open an image this way. However, as the open menu item has the same shortcut, it is not very convenient: maybe the editor open item could be accessed with cmd-alt-O rather than cmd-O (already in use for Open in the main menu file).

> - to the contrary, if one script and one image are already opened, if the image
> is active and I use the open menu to open another text file, Fiji freezes after
> opening a new tab. I get a similar freezeif I drag and drop a text file on the
> status bar while another text file is already opened.

This is when using the general File menu. I agree I could use the editor menu but again they share the same shortcut. Moreover, it seems to me reasonable to expect that the general open menu is able to open an additional text file when one is already open…

> Everything seems to work fine here under linux 64 and Java 1.6.0_20.
> I can open an image, with an open macro in the script editor and I could open a
> further image and a further image from the Samples link.

Do you think using 1.5.0 may be the reason for the trouble?

> I wonder if you are trying to open a very large image from the File menu of the
> Script Editor (which would not be the right thing to do anyway). Just for the
> record I can open images like that and they are shown as garbled text in a new
> Script Editor tab.

This is it: smaller image files are shown as garbled text in a new tab…
Comment 4 Johannes Schindelin 2010-08-29 19:28:50 CDT
Unfortunately, I do not see any convenient way out. The menu of the script editor is really only meant for working with scripts, and it would mean a lot of work to change the behavior such that, e.g. File>Open would try to open as image before trying to open as text.

I would be willing to guide somebody through the required work, but I do not want to do it myself, nor do I have the time to.
Comment 5 Thomas Julou 2010-09-04 11:46:58 CDT
(In reply to comment #4)
> Unfortunately, I do not see any convenient way out. The menu of the script
> editor is really only meant for working with scripts, and it would mean a lot
> of work to change the behavior such that, e.g. File>Open would try to open as
> image before trying to open as text.
> 
> I would be willing to guide somebody through the required work, but I do not
> want to do it myself, nor do I have the time to.

Maybe a light workaround would be:
 - to check the size of the file opened by the script editor and to display a warning (do you really want to proceed?) if it's larger than 100kb or 1mb
 - to set cmd-alt-O as the script open menu shortcut
 
And still, there will remain a need to fix the drag and drop bug for text files (when one is already opened)… at least to my opinion. For this, I have no suggestion as I have no clue of the underlying code…
Comment 6 Johannes Schindelin 2010-09-17 11:14:41 CDT
I thought a bit more about this. How about using the list of supported languages' extensions and resort to IJ.open() (i.e. let ImageJ handle the loading) when the respective file name does not have any of these extensions? Would that be good enough for you?
Comment 7 Thomas Julou 2010-09-17 11:27:56 CDT
(In reply to comment #6)
> I thought a bit more about this. How about using the list of supported
> languages' extensions and resort to IJ.open() (i.e. let ImageJ handle the
> loading) when the respective file name does not have any of these extensions?
> Would that be good enough for you?

That sounds good actually...
Comment 8 Johannes Schindelin 2010-09-22 15:40:41 CDT
Hmm. The proposed method would have made it hard to load .html and .txt files (as they are not extensions of registered languages). So I went for this instead: the files are checked first whether they are binary (simple heuristic: if there is a NUL byte in the first 8000, it is not text). If they are, ImageJ opens the thing. Uploaded and pushed.
Comment 9 Thomas Julou 2010-09-22 18:17:35 CDT
(In reply to comment #8)
> Hmm. The proposed method would have made it hard to load .html and .txt files
> (as they are not extensions of registered languages). So I went for this
> instead: the files are checked first whether they are binary (simple heuristic:
> if there is a NUL byte in the first 8000, it is not text). If they are, ImageJ
> opens the thing. Uploaded and pushed.

That works great!

Still remains a bug when trying to open "text" files not from the editor menu:
 - if one tab is already open in the editor, Fiji will crash if I drag and drop another text file on the status bar
 - if one tab is already open in the editor, opening a text file from the image menu, will open a new empty tab called New_ and freeze Fiji.

Any idea on how to fix this? Shall I open a new bug report for this?