Re: How to know if a file is supported by imageJ without preloading?
Posted by
simon andrews (BI) on
Feb 11, 2010; 12:32pm
URL: http://imagej.273.s1.nabble.com/How-to-know-if-a-file-is-supported-by-imageJ-without-preloading-tp3689405p3689406.html
On 08/02/2010 14:37, Juanjo Vega wrote:
> Hello everybody,
>
> I'm developing a new plugin and I need a way to know when a file is
> supported by imageJ.
>
> I'm implementing a browser with a preview and the idea is to know when a
> file is supported or not to show one or another icon. The main idea is
> to use something like: "isASupportedFileType(): boolean", so new file
> types will return "true" when a new plugin will be added.
>
> Right now I'm filtering items by their extension and that's not cool at
> all =P
That may not be cool but actually it's the only practical way to do it.
I went through this when I was developing our image browser. As
others have pointed out there are methods in both ImageJ and BioFormats
to determine whether a file can be read, the problem is that they have
to read the files to determine this, and in some cases they can take a
long time to return. I found that big compressed archive files could
take tens of seconds to return, which is unusably long if you're only
trying to decide what icon to use.
If you wanted to go that way you could set a timer on the call and have
an 'unknown' icon if it look too long to determine perhaps?
Simon.